1 1.5 reinoud /* $NetBSD: udf_strat_bootstrap.c,v 1.5 2016/05/24 09:55:57 reinoud Exp $ */ 2 1.1 reinoud 3 1.1 reinoud /* 4 1.1 reinoud * Copyright (c) 2006, 2008 Reinoud Zandijk 5 1.1 reinoud * All rights reserved. 6 1.1 reinoud * 7 1.1 reinoud * Redistribution and use in source and binary forms, with or without 8 1.1 reinoud * modification, are permitted provided that the following conditions 9 1.1 reinoud * are met: 10 1.1 reinoud * 1. Redistributions of source code must retain the above copyright 11 1.1 reinoud * notice, this list of conditions and the following disclaimer. 12 1.1 reinoud * 2. Redistributions in binary form must reproduce the above copyright 13 1.1 reinoud * notice, this list of conditions and the following disclaimer in the 14 1.1 reinoud * documentation and/or other materials provided with the distribution. 15 1.1 reinoud * 16 1.1 reinoud * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 17 1.1 reinoud * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 18 1.1 reinoud * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 19 1.1 reinoud * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 20 1.1 reinoud * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 21 1.1 reinoud * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 22 1.1 reinoud * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 23 1.1 reinoud * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 1.1 reinoud * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 25 1.1 reinoud * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 1.1 reinoud * 27 1.1 reinoud */ 28 1.1 reinoud 29 1.1 reinoud #include <sys/cdefs.h> 30 1.1 reinoud #ifndef lint 31 1.5 reinoud __KERNEL_RCSID(0, "$NetBSD: udf_strat_bootstrap.c,v 1.5 2016/05/24 09:55:57 reinoud Exp $"); 32 1.1 reinoud #endif /* not lint */ 33 1.1 reinoud 34 1.1 reinoud 35 1.1 reinoud #if defined(_KERNEL_OPT) 36 1.1 reinoud #include "opt_compat_netbsd.h" 37 1.1 reinoud #endif 38 1.1 reinoud 39 1.1 reinoud #include <sys/param.h> 40 1.1 reinoud #include <sys/systm.h> 41 1.1 reinoud #include <sys/sysctl.h> 42 1.1 reinoud #include <sys/namei.h> 43 1.1 reinoud #include <sys/proc.h> 44 1.1 reinoud #include <sys/kernel.h> 45 1.1 reinoud #include <sys/vnode.h> 46 1.1 reinoud #include <miscfs/genfs/genfs_node.h> 47 1.1 reinoud #include <sys/mount.h> 48 1.1 reinoud #include <sys/buf.h> 49 1.1 reinoud #include <sys/file.h> 50 1.1 reinoud #include <sys/device.h> 51 1.1 reinoud #include <sys/disklabel.h> 52 1.1 reinoud #include <sys/ioctl.h> 53 1.1 reinoud #include <sys/dirent.h> 54 1.1 reinoud #include <sys/stat.h> 55 1.1 reinoud #include <sys/conf.h> 56 1.1 reinoud #include <sys/kauth.h> 57 1.1 reinoud #include <sys/kthread.h> 58 1.1 reinoud #include <dev/clock_subr.h> 59 1.1 reinoud 60 1.1 reinoud #include <fs/udf/ecma167-udf.h> 61 1.1 reinoud #include <fs/udf/udf_mount.h> 62 1.1 reinoud 63 1.1 reinoud #include "udf.h" 64 1.1 reinoud #include "udf_subr.h" 65 1.1 reinoud #include "udf_bswap.h" 66 1.1 reinoud 67 1.1 reinoud 68 1.1 reinoud #define VTOI(vnode) ((struct udf_node *) vnode->v_data) 69 1.1 reinoud #define PRIV(ump) ((struct strat_private *) ump->strategy_private) 70 1.1 reinoud 71 1.1 reinoud /* --------------------------------------------------------------------- */ 72 1.1 reinoud 73 1.1 reinoud static int 74 1.1 reinoud udf_create_logvol_dscr_bootstrap(struct udf_strat_args *args) 75 1.1 reinoud { 76 1.1 reinoud panic("udf_create_logvol_dscr_bootstrap: not possible\n"); 77 1.1 reinoud return 0; 78 1.1 reinoud } 79 1.1 reinoud 80 1.1 reinoud 81 1.1 reinoud static void 82 1.1 reinoud udf_free_logvol_dscr_bootstrap(struct udf_strat_args *args) 83 1.1 reinoud { 84 1.1 reinoud panic("udf_free_logvol_dscr_bootstrap: no node descriptor reading\n"); 85 1.1 reinoud } 86 1.1 reinoud 87 1.1 reinoud 88 1.1 reinoud static int 89 1.1 reinoud udf_read_logvol_dscr_bootstrap(struct udf_strat_args *args) 90 1.1 reinoud { 91 1.1 reinoud panic("udf_read_logvol_dscr_bootstrap: no node descriptor reading\n"); 92 1.1 reinoud return 0; 93 1.1 reinoud } 94 1.1 reinoud 95 1.1 reinoud 96 1.1 reinoud static int 97 1.1 reinoud udf_write_logvol_dscr_bootstrap(struct udf_strat_args *args) 98 1.1 reinoud { 99 1.1 reinoud panic("udf_write_logvol_dscr_bootstrap: no writing\n"); 100 1.1 reinoud } 101 1.1 reinoud 102 1.1 reinoud /* --------------------------------------------------------------------- */ 103 1.1 reinoud 104 1.1 reinoud static void 105 1.1 reinoud udf_queuebuf_bootstrap(struct udf_strat_args *args) 106 1.1 reinoud { 107 1.1 reinoud struct udf_mount *ump = args->ump; 108 1.1 reinoud struct buf *buf = args->nestbuf; 109 1.1 reinoud 110 1.1 reinoud KASSERT(ump); 111 1.1 reinoud KASSERT(buf); 112 1.1 reinoud KASSERT(buf->b_iodone == nestiobuf_iodone); 113 1.1 reinoud 114 1.1 reinoud KASSERT(buf->b_flags & B_READ); 115 1.1 reinoud VOP_STRATEGY(ump->devvp, buf); 116 1.1 reinoud } 117 1.1 reinoud 118 1.5 reinoud 119 1.5 reinoud static void 120 1.5 reinoud udf_sync_caches_bootstrap(struct udf_strat_args *args) 121 1.5 reinoud { 122 1.5 reinoud /* empty */ 123 1.5 reinoud } 124 1.5 reinoud 125 1.5 reinoud 126 1.1 reinoud static void 127 1.1 reinoud udf_discstrat_init_bootstrap(struct udf_strat_args *args) 128 1.1 reinoud { 129 1.1 reinoud /* empty */ 130 1.1 reinoud } 131 1.1 reinoud 132 1.1 reinoud 133 1.1 reinoud static void 134 1.1 reinoud udf_discstrat_finish_bootstrap(struct udf_strat_args *args) 135 1.1 reinoud { 136 1.1 reinoud /* empty */ 137 1.1 reinoud } 138 1.1 reinoud 139 1.1 reinoud /* --------------------------------------------------------------------- */ 140 1.1 reinoud 141 1.1 reinoud struct udf_strategy udf_strat_bootstrap = 142 1.1 reinoud { 143 1.1 reinoud udf_create_logvol_dscr_bootstrap, 144 1.1 reinoud udf_free_logvol_dscr_bootstrap, 145 1.1 reinoud udf_read_logvol_dscr_bootstrap, 146 1.1 reinoud udf_write_logvol_dscr_bootstrap, 147 1.1 reinoud udf_queuebuf_bootstrap, 148 1.5 reinoud udf_sync_caches_bootstrap, 149 1.1 reinoud udf_discstrat_init_bootstrap, 150 1.1 reinoud udf_discstrat_finish_bootstrap 151 1.1 reinoud }; 152 1.1 reinoud 153 1.1 reinoud 154