udf_strat_bootstrap.c revision 1.1 1 /* $NetBSD: udf_strat_bootstrap.c,v 1.1 2008/05/14 16:49:48 reinoud 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.1 2008/05/14 16:49:48 reinoud Exp $");
32 #endif /* not lint */
33
34
35 #if defined(_KERNEL_OPT)
36 #include "opt_quota.h"
37 #include "opt_compat_netbsd.h"
38 #endif
39
40 #include <sys/param.h>
41 #include <sys/systm.h>
42 #include <sys/sysctl.h>
43 #include <sys/namei.h>
44 #include <sys/proc.h>
45 #include <sys/kernel.h>
46 #include <sys/vnode.h>
47 #include <miscfs/genfs/genfs_node.h>
48 #include <sys/mount.h>
49 #include <sys/buf.h>
50 #include <sys/file.h>
51 #include <sys/device.h>
52 #include <sys/disklabel.h>
53 #include <sys/ioctl.h>
54 #include <sys/malloc.h>
55 #include <sys/dirent.h>
56 #include <sys/stat.h>
57 #include <sys/conf.h>
58 #include <sys/kauth.h>
59 #include <sys/kthread.h>
60 #include <dev/clock_subr.h>
61
62 #include <fs/udf/ecma167-udf.h>
63 #include <fs/udf/udf_mount.h>
64
65 #if defined(_KERNEL_OPT)
66 #include "opt_udf.h"
67 #endif
68
69 #include "udf.h"
70 #include "udf_subr.h"
71 #include "udf_bswap.h"
72
73
74 #define VTOI(vnode) ((struct udf_node *) vnode->v_data)
75 #define PRIV(ump) ((struct strat_private *) ump->strategy_private)
76
77 /* --------------------------------------------------------------------- */
78
79 static int
80 udf_create_logvol_dscr_bootstrap(struct udf_strat_args *args)
81 {
82 panic("udf_create_logvol_dscr_bootstrap: not possible\n");
83 return 0;
84 }
85
86
87 static void
88 udf_free_logvol_dscr_bootstrap(struct udf_strat_args *args)
89 {
90 panic("udf_free_logvol_dscr_bootstrap: no node descriptor reading\n");
91 }
92
93
94 static int
95 udf_read_logvol_dscr_bootstrap(struct udf_strat_args *args)
96 {
97 panic("udf_read_logvol_dscr_bootstrap: no node descriptor reading\n");
98 return 0;
99 }
100
101
102 static int
103 udf_write_logvol_dscr_bootstrap(struct udf_strat_args *args)
104 {
105 panic("udf_write_logvol_dscr_bootstrap: no writing\n");
106 }
107
108 /* --------------------------------------------------------------------- */
109
110 static void
111 udf_queuebuf_bootstrap(struct udf_strat_args *args)
112 {
113 struct udf_mount *ump = args->ump;
114 struct buf *buf = args->nestbuf;
115
116 KASSERT(ump);
117 KASSERT(buf);
118 KASSERT(buf->b_iodone == nestiobuf_iodone);
119
120 KASSERT(buf->b_flags & B_READ);
121 VOP_STRATEGY(ump->devvp, buf);
122 }
123
124 static void
125 udf_discstrat_init_bootstrap(struct udf_strat_args *args)
126 {
127 /* empty */
128 }
129
130
131 static void
132 udf_discstrat_finish_bootstrap(struct udf_strat_args *args)
133 {
134 /* empty */
135 }
136
137 /* --------------------------------------------------------------------- */
138
139 struct udf_strategy udf_strat_bootstrap =
140 {
141 udf_create_logvol_dscr_bootstrap,
142 udf_free_logvol_dscr_bootstrap,
143 udf_read_logvol_dscr_bootstrap,
144 udf_write_logvol_dscr_bootstrap,
145 udf_queuebuf_bootstrap,
146 udf_discstrat_init_bootstrap,
147 udf_discstrat_finish_bootstrap
148 };
149
150
151