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