dkwedge_rdb.c revision 1.4.2.2 1 1.4.2.2 pgoyette /* $NetBSD: dkwedge_rdb.c,v 1.4.2.2 2017/03/20 06:57:27 pgoyette Exp $ */
2 1.4.2.2 pgoyette
3 1.4.2.2 pgoyette /*
4 1.4.2.2 pgoyette * Adapted from arch/amiga/amiga/disksubr.c:
5 1.4.2.2 pgoyette *
6 1.4.2.2 pgoyette * Copyright (c) 1982, 1986, 1988 Regents of the University of California.
7 1.4.2.2 pgoyette * All rights reserved.
8 1.4.2.2 pgoyette *
9 1.4.2.2 pgoyette * Redistribution and use in source and binary forms, with or without
10 1.4.2.2 pgoyette * modification, are permitted provided that the following conditions
11 1.4.2.2 pgoyette * are met:
12 1.4.2.2 pgoyette * 1. Redistributions of source code must retain the above copyright
13 1.4.2.2 pgoyette * notice, this list of conditions and the following disclaimer.
14 1.4.2.2 pgoyette * 2. Redistributions in binary form must reproduce the above copyright
15 1.4.2.2 pgoyette * notice, this list of conditions and the following disclaimer in the
16 1.4.2.2 pgoyette * documentation and/or other materials provided with the distribution.
17 1.4.2.2 pgoyette * 3. Neither the name of the University nor the names of its contributors
18 1.4.2.2 pgoyette * may be used to endorse or promote products derived from this software
19 1.4.2.2 pgoyette * without specific prior written permission.
20 1.4.2.2 pgoyette *
21 1.4.2.2 pgoyette * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
22 1.4.2.2 pgoyette * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 1.4.2.2 pgoyette * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 1.4.2.2 pgoyette * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
25 1.4.2.2 pgoyette * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 1.4.2.2 pgoyette * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27 1.4.2.2 pgoyette * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 1.4.2.2 pgoyette * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 1.4.2.2 pgoyette * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 1.4.2.2 pgoyette * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 1.4.2.2 pgoyette * SUCH DAMAGE.
32 1.4.2.2 pgoyette *
33 1.4.2.2 pgoyette * @(#)ufs_disksubr.c 7.16 (Berkeley) 5/4/91
34 1.4.2.2 pgoyette */
35 1.4.2.2 pgoyette
36 1.4.2.2 pgoyette /*
37 1.4.2.2 pgoyette * Copyright (c) 1994 Christian E. Hopps
38 1.4.2.2 pgoyette *
39 1.4.2.2 pgoyette * Redistribution and use in source and binary forms, with or without
40 1.4.2.2 pgoyette * modification, are permitted provided that the following conditions
41 1.4.2.2 pgoyette * are met:
42 1.4.2.2 pgoyette * 1. Redistributions of source code must retain the above copyright
43 1.4.2.2 pgoyette * notice, this list of conditions and the following disclaimer.
44 1.4.2.2 pgoyette * 2. Redistributions in binary form must reproduce the above copyright
45 1.4.2.2 pgoyette * notice, this list of conditions and the following disclaimer in the
46 1.4.2.2 pgoyette * documentation and/or other materials provided with the distribution.
47 1.4.2.2 pgoyette * 3. All advertising materials mentioning features or use of this software
48 1.4.2.2 pgoyette * must display the following acknowledgement:
49 1.4.2.2 pgoyette * This product includes software developed by the University of
50 1.4.2.2 pgoyette * California, Berkeley and its contributors.
51 1.4.2.2 pgoyette * 4. Neither the name of the University nor the names of its contributors
52 1.4.2.2 pgoyette * may be used to endorse or promote products derived from this software
53 1.4.2.2 pgoyette * without specific prior written permission.
54 1.4.2.2 pgoyette *
55 1.4.2.2 pgoyette * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
56 1.4.2.2 pgoyette * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
57 1.4.2.2 pgoyette * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
58 1.4.2.2 pgoyette * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
59 1.4.2.2 pgoyette * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
60 1.4.2.2 pgoyette * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
61 1.4.2.2 pgoyette * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
62 1.4.2.2 pgoyette * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
63 1.4.2.2 pgoyette * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
64 1.4.2.2 pgoyette * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
65 1.4.2.2 pgoyette * SUCH DAMAGE.
66 1.4.2.2 pgoyette *
67 1.4.2.2 pgoyette * @(#)ufs_disksubr.c 7.16 (Berkeley) 5/4/91
68 1.4.2.2 pgoyette */
69 1.4.2.2 pgoyette
70 1.4.2.2 pgoyette #include <sys/cdefs.h>
71 1.4.2.2 pgoyette __KERNEL_RCSID(0, "$NetBSD: dkwedge_rdb.c,v 1.4.2.2 2017/03/20 06:57:27 pgoyette Exp $");
72 1.4.2.2 pgoyette
73 1.4.2.2 pgoyette #include <sys/param.h>
74 1.4.2.2 pgoyette #include <sys/disklabel_rdb.h>
75 1.4.2.2 pgoyette #include <sys/disk.h>
76 1.4.2.2 pgoyette #include <sys/endian.h>
77 1.4.2.2 pgoyette #include <sys/malloc.h>
78 1.4.2.2 pgoyette #ifdef _KERNEL
79 1.4.2.2 pgoyette #include <sys/systm.h>
80 1.4.2.2 pgoyette #endif
81 1.4.2.2 pgoyette
82 1.4.2.2 pgoyette /*
83 1.4.2.2 pgoyette * In /usr/src/sys/dev/scsipi/sd.c, routine sdstart() adjusts the
84 1.4.2.2 pgoyette * block numbers, it changes from DEV_BSIZE units to physical units:
85 1.4.2.2 pgoyette * blkno = bp->b_blkno / (lp->d_secsize / DEV_BSIZE);
86 1.4.2.2 pgoyette * As long as media with sector sizes of 512 bytes are used, this
87 1.4.2.2 pgoyette * doesn't matter (divide by 1), but for successful usage of media with
88 1.4.2.2 pgoyette * greater sector sizes (e.g. 640MB MO-media with 2048 bytes/sector)
89 1.4.2.2 pgoyette * we must multiply block numbers with (lp->d_secsize / DEV_BSIZE)
90 1.4.2.2 pgoyette * to keep "unchanged" physical block numbers.
91 1.4.2.2 pgoyette */
92 1.4.2.2 pgoyette #define SD_C_ADJUSTS_NR
93 1.4.2.2 pgoyette #ifdef SD_C_ADJUSTS_NR
94 1.4.2.2 pgoyette #define ADJUST_NR(x) ((x) * (secsize / DEV_BSIZE))
95 1.4.2.2 pgoyette #else
96 1.4.2.2 pgoyette #define ADJUST_NR(x) (x)
97 1.4.2.2 pgoyette #endif
98 1.4.2.2 pgoyette
99 1.4.2.2 pgoyette #ifdef _KERNEL
100 1.4.2.2 pgoyette #define DKW_MALLOC(SZ) malloc((SZ), M_DEVBUF, M_WAITOK)
101 1.4.2.2 pgoyette #define DKW_FREE(PTR) free((PTR), M_DEVBUF)
102 1.4.2.2 pgoyette #define DKW_REALLOC(PTR, NEWSZ) realloc((PTR), (NEWSZ), M_DEVBUF, M_WAITOK)
103 1.4.2.2 pgoyette #else
104 1.4.2.2 pgoyette #define DKW_MALLOC(SZ) malloc((SZ))
105 1.4.2.2 pgoyette #define DKW_FREE(PTR) free((PTR))
106 1.4.2.2 pgoyette #define DKW_REALLOC(PTR, NEWSZ) realloc((PTR), (NEWSZ))
107 1.4.2.2 pgoyette #endif
108 1.4.2.2 pgoyette
109 1.4.2.2 pgoyette static unsigned rdbchksum(void *);
110 1.4.2.2 pgoyette static unsigned char getarchtype(unsigned);
111 1.4.2.2 pgoyette static const char *archtype_to_ptype(unsigned char);
112 1.4.2.2 pgoyette
113 1.4.2.2 pgoyette static int
114 1.4.2.2 pgoyette dkwedge_discover_rdb(struct disk *pdk, struct vnode *vp)
115 1.4.2.2 pgoyette {
116 1.4.2.2 pgoyette struct dkwedge_info dkw;
117 1.4.2.2 pgoyette struct partblock *pbp;
118 1.4.2.2 pgoyette struct rdblock *rbp;
119 1.4.2.2 pgoyette void *bp;
120 1.4.2.2 pgoyette int error;
121 1.4.2.2 pgoyette unsigned blk_per_cyl, bufsize, newsecsize, nextb, secsize, tabsize;
122 1.4.2.2 pgoyette const char *ptype;
123 1.4.2.2 pgoyette unsigned char archtype;
124 1.4.2.2 pgoyette bool found, root, swap;
125 1.4.2.2 pgoyette
126 1.4.2.2 pgoyette secsize = DEV_BSIZE << pdk->dk_blkshift;
127 1.4.2.2 pgoyette bufsize = roundup(MAX(sizeof(struct partblock), sizeof(struct rdblock)),
128 1.4.2.2 pgoyette secsize);
129 1.4.2.2 pgoyette bp = DKW_MALLOC(bufsize);
130 1.4.2.2 pgoyette
131 1.4.2.2 pgoyette /*
132 1.4.2.2 pgoyette * find the RDB block
133 1.4.2.2 pgoyette * XXX bsdlabel should be detected by the other method
134 1.4.2.2 pgoyette */
135 1.4.2.2 pgoyette for (nextb = 0; nextb < RDB_MAXBLOCKS; nextb++) {
136 1.4.2.2 pgoyette error = dkwedge_read(pdk, vp, ADJUST_NR(nextb), bp, bufsize);
137 1.4.2.2 pgoyette if (error) {
138 1.4.2.2 pgoyette aprint_error("%s: unable to read RDB @ %u, "
139 1.4.2.2 pgoyette "error = %d\n", pdk->dk_name, nextb, error);
140 1.4.2.2 pgoyette error = ESRCH;
141 1.4.2.2 pgoyette goto done;
142 1.4.2.2 pgoyette }
143 1.4.2.2 pgoyette rbp = (struct rdblock *)bp;
144 1.4.2.2 pgoyette if (be32toh(rbp->id) == RDBLOCK_ID) {
145 1.4.2.2 pgoyette if (rdbchksum(rbp) == 0)
146 1.4.2.2 pgoyette break;
147 1.4.2.2 pgoyette else
148 1.4.2.2 pgoyette aprint_error("%s: RDB bad checksum @ %u\n",
149 1.4.2.2 pgoyette pdk->dk_name, nextb);
150 1.4.2.2 pgoyette }
151 1.4.2.2 pgoyette }
152 1.4.2.2 pgoyette
153 1.4.2.2 pgoyette if (nextb == RDB_MAXBLOCKS) {
154 1.4.2.2 pgoyette error = ESRCH;
155 1.4.2.2 pgoyette goto done;
156 1.4.2.2 pgoyette }
157 1.4.2.2 pgoyette
158 1.4.2.2 pgoyette newsecsize = be32toh(rbp->nbytes);
159 1.4.2.2 pgoyette if (secsize != newsecsize) {
160 1.4.2.2 pgoyette aprint_verbose("secsize changed from %u to %u\n",
161 1.4.2.2 pgoyette secsize, newsecsize);
162 1.4.2.2 pgoyette secsize = newsecsize;
163 1.4.2.2 pgoyette bufsize = roundup(MAX(sizeof(struct partblock),
164 1.4.2.2 pgoyette sizeof(struct rdblock)), secsize);
165 1.4.2.2 pgoyette bp = DKW_REALLOC(bp, bufsize);
166 1.4.2.2 pgoyette }
167 1.4.2.2 pgoyette
168 1.4.2.2 pgoyette strlcpy(dkw.dkw_parent, pdk->dk_name, sizeof(dkw.dkw_parent));
169 1.4.2.2 pgoyette
170 1.4.2.2 pgoyette found = root = swap = false;
171 1.4.2.2 pgoyette /*
172 1.4.2.2 pgoyette * scan for partition blocks
173 1.4.2.2 pgoyette */
174 1.4.2.2 pgoyette for (nextb = be32toh(rbp->partbhead); nextb != RDBNULL;
175 1.4.2.2 pgoyette nextb = be32toh(pbp->next)) {
176 1.4.2.2 pgoyette error = dkwedge_read(pdk, vp, ADJUST_NR(nextb), bp, bufsize);
177 1.4.2.2 pgoyette if (error) {
178 1.4.2.2 pgoyette aprint_error("%s: unable to read RDB partition block @ "
179 1.4.2.2 pgoyette "%u, error = %d\n", pdk->dk_name, nextb, error);
180 1.4.2.2 pgoyette error = ESRCH;
181 1.4.2.2 pgoyette goto done;
182 1.4.2.2 pgoyette }
183 1.4.2.2 pgoyette pbp = (struct partblock *)bp;
184 1.4.2.2 pgoyette
185 1.4.2.2 pgoyette if (be32toh(pbp->id) != PARTBLOCK_ID) {
186 1.4.2.2 pgoyette aprint_error(
187 1.4.2.2 pgoyette "%s: RDB partition block @ %u bad id\n",
188 1.4.2.2 pgoyette pdk->dk_name, nextb);
189 1.4.2.2 pgoyette error = ESRCH;
190 1.4.2.2 pgoyette goto done;
191 1.4.2.2 pgoyette }
192 1.4.2.2 pgoyette if (rdbchksum(pbp)) {
193 1.4.2.2 pgoyette aprint_error(
194 1.4.2.2 pgoyette "%s: RDB partition block @ %u bad checksum\n",
195 1.4.2.2 pgoyette pdk->dk_name, nextb);
196 1.4.2.2 pgoyette error = ESRCH;
197 1.4.2.2 pgoyette goto done;
198 1.4.2.2 pgoyette }
199 1.4.2.2 pgoyette
200 1.4.2.2 pgoyette tabsize = be32toh(pbp->e.tabsize);
201 1.4.2.2 pgoyette if (tabsize < 11) {
202 1.4.2.2 pgoyette /*
203 1.4.2.2 pgoyette * not enough info, too funky for us.
204 1.4.2.2 pgoyette * I don't want to skip I want it fixed.
205 1.4.2.2 pgoyette */
206 1.4.2.2 pgoyette aprint_error(
207 1.4.2.2 pgoyette "%s: RDB partition block @ %u bad partition info "
208 1.4.2.2 pgoyette "(environ < 11)\n",
209 1.4.2.2 pgoyette pdk->dk_name, nextb);
210 1.4.2.2 pgoyette error = ESRCH;
211 1.4.2.2 pgoyette goto done;
212 1.4.2.2 pgoyette }
213 1.4.2.2 pgoyette
214 1.4.2.2 pgoyette /*
215 1.4.2.2 pgoyette * XXXX should be ">" however some vendors don't know
216 1.4.2.2 pgoyette * what a table size is so, we hack for them.
217 1.4.2.2 pgoyette * the other checks can fail for all I care but this
218 1.4.2.2 pgoyette * is a very common value. *sigh*.
219 1.4.2.2 pgoyette */
220 1.4.2.2 pgoyette if (tabsize >= 16)
221 1.4.2.2 pgoyette archtype = getarchtype(be32toh(pbp->e.dostype));
222 1.4.2.2 pgoyette else
223 1.4.2.2 pgoyette archtype = ADT_UNKNOWN;
224 1.4.2.2 pgoyette
225 1.4.2.2 pgoyette switch (archtype) {
226 1.4.2.2 pgoyette case ADT_NETBSDROOT:
227 1.4.2.2 pgoyette if (root) {
228 1.4.2.2 pgoyette aprint_error("%s: more than one root RDB "
229 1.4.2.2 pgoyette "partition, ignoring\n", pdk->dk_name);
230 1.4.2.2 pgoyette continue;
231 1.4.2.2 pgoyette }
232 1.4.2.2 pgoyette root = true;
233 1.4.2.2 pgoyette break;
234 1.4.2.2 pgoyette case ADT_NETBSDSWAP:
235 1.4.2.2 pgoyette if (swap) {
236 1.4.2.2 pgoyette aprint_error("%s: more than one swap RDB "
237 1.4.2.2 pgoyette "partition , ignoring\n", pdk->dk_name);
238 1.4.2.2 pgoyette continue;
239 1.4.2.2 pgoyette }
240 1.4.2.2 pgoyette swap = true;
241 1.4.2.2 pgoyette break;
242 1.4.2.2 pgoyette default:
243 1.4.2.2 pgoyette break;
244 1.4.2.2 pgoyette }
245 1.4.2.2 pgoyette
246 1.4.2.2 pgoyette if (pbp->partname[0] + 1 < sizeof(pbp->partname))
247 1.4.2.2 pgoyette pbp->partname[pbp->partname[0] + 1] = 0;
248 1.4.2.2 pgoyette else
249 1.4.2.2 pgoyette pbp->partname[sizeof(pbp->partname) - 1] = 0;
250 1.4.2.2 pgoyette strlcpy(dkw.dkw_wname, pbp->partname + 1,
251 1.4.2.2 pgoyette sizeof(dkw.dkw_wname));
252 1.4.2.2 pgoyette
253 1.4.2.2 pgoyette ptype = archtype_to_ptype(archtype);
254 1.4.2.2 pgoyette strlcpy(dkw.dkw_ptype, ptype, sizeof(dkw.dkw_ptype));
255 1.4.2.2 pgoyette
256 1.4.2.2 pgoyette blk_per_cyl =
257 1.4.2.2 pgoyette be32toh(pbp->e.secpertrk) * be32toh(pbp->e.numheads)
258 1.4.2.2 pgoyette * ((be32toh(pbp->e.sizeblock) << 2) / secsize);
259 1.4.2.2 pgoyette dkw.dkw_size = (uint64_t)(be32toh(pbp->e.highcyl)
260 1.4.2.2 pgoyette - be32toh(pbp->e.lowcyl) + 1) * blk_per_cyl;
261 1.4.2.2 pgoyette dkw.dkw_offset = (daddr_t)be32toh(pbp->e.lowcyl) * blk_per_cyl;
262 1.4.2.2 pgoyette
263 1.4.2.2 pgoyette error = dkwedge_add(&dkw);
264 1.4.2.2 pgoyette if (error == EEXIST) {
265 1.4.2.2 pgoyette aprint_error(
266 1.4.2.2 pgoyette "%s: wedge named '%s' already exists, ignoring\n",
267 1.4.2.2 pgoyette pdk->dk_name, dkw.dkw_wname);
268 1.4.2.2 pgoyette } else if (error)
269 1.4.2.2 pgoyette aprint_error("%s: error %d adding partition %s\n",
270 1.4.2.2 pgoyette pdk->dk_name, error, dkw.dkw_wname);
271 1.4.2.2 pgoyette else
272 1.4.2.2 pgoyette found = true;
273 1.4.2.2 pgoyette }
274 1.4.2.2 pgoyette
275 1.4.2.2 pgoyette if (found)
276 1.4.2.2 pgoyette error = 0;
277 1.4.2.2 pgoyette else
278 1.4.2.2 pgoyette error = ESRCH;
279 1.4.2.2 pgoyette done:
280 1.4.2.2 pgoyette DKW_FREE(bp);
281 1.4.2.2 pgoyette return error;
282 1.4.2.2 pgoyette }
283 1.4.2.2 pgoyette
284 1.4.2.2 pgoyette static unsigned
285 1.4.2.2 pgoyette rdbchksum(void *bdata)
286 1.4.2.2 pgoyette {
287 1.4.2.2 pgoyette unsigned *blp, cnt, val;
288 1.4.2.2 pgoyette
289 1.4.2.2 pgoyette blp = bdata;
290 1.4.2.2 pgoyette cnt = be32toh(blp[1]);
291 1.4.2.2 pgoyette val = 0;
292 1.4.2.2 pgoyette
293 1.4.2.2 pgoyette while (cnt--)
294 1.4.2.2 pgoyette val += be32toh(*blp++);
295 1.4.2.2 pgoyette return(val);
296 1.4.2.2 pgoyette }
297 1.4.2.2 pgoyette
298 1.4.2.2 pgoyette static unsigned char
299 1.4.2.2 pgoyette getarchtype(unsigned dostype)
300 1.4.2.2 pgoyette {
301 1.4.2.2 pgoyette unsigned t3, b1;
302 1.4.2.2 pgoyette
303 1.4.2.2 pgoyette t3 = dostype & 0xffffff00;
304 1.4.2.2 pgoyette b1 = dostype & 0x000000ff;
305 1.4.2.2 pgoyette
306 1.4.2.2 pgoyette switch (t3) {
307 1.4.2.2 pgoyette case DOST_NBR:
308 1.4.2.2 pgoyette return ADT_NETBSDROOT;
309 1.4.2.2 pgoyette case DOST_NBS:
310 1.4.2.2 pgoyette return ADT_NETBSDSWAP;
311 1.4.2.2 pgoyette case DOST_NBU:
312 1.4.2.2 pgoyette return ADT_NETBSDUSER;
313 1.4.2.2 pgoyette case DOST_MUFS: /* check for 'muFS'? */
314 1.4.2.2 pgoyette case DOST_DOS:
315 1.4.2.2 pgoyette return ADT_AMIGADOS;
316 1.4.2.2 pgoyette case DOST_AMIX:
317 1.4.2.2 pgoyette return ADT_AMIX;
318 1.4.2.2 pgoyette
319 1.4.2.2 pgoyette case DOST_XXXBSD:
320 1.4.2.2 pgoyette #ifdef DIAGNOSTIC
321 1.4.2.2 pgoyette aprint_verbose("deprecated dostype found: 0x%x\n",
322 1.4.2.2 pgoyette dostype);
323 1.4.2.2 pgoyette #endif
324 1.4.2.2 pgoyette switch (b1) {
325 1.4.2.2 pgoyette case 'R':
326 1.4.2.2 pgoyette return ADT_NETBSDROOT;
327 1.4.2.2 pgoyette case 'S':
328 1.4.2.2 pgoyette return ADT_NETBSDSWAP;
329 1.4.2.2 pgoyette default:
330 1.4.2.2 pgoyette return ADT_NETBSDUSER;
331 1.4.2.2 pgoyette }
332 1.4.2.2 pgoyette
333 1.4.2.2 pgoyette case DOST_EXT2:
334 1.4.2.2 pgoyette return ADT_EXT2;
335 1.4.2.2 pgoyette case DOST_RAID:
336 1.4.2.2 pgoyette return ADT_RAID;
337 1.4.2.2 pgoyette default:
338 1.4.2.2 pgoyette #ifdef DIAGNOSTIC
339 1.4.2.2 pgoyette aprint_verbose("warning unknown dostype: 0x%x\n",
340 1.4.2.2 pgoyette dostype);
341 1.4.2.2 pgoyette #endif
342 1.4.2.2 pgoyette return ADT_UNKNOWN;
343 1.4.2.2 pgoyette }
344 1.4.2.2 pgoyette }
345 1.4.2.2 pgoyette
346 1.4.2.2 pgoyette static const char *
347 1.4.2.2 pgoyette archtype_to_ptype(unsigned char archtype)
348 1.4.2.2 pgoyette {
349 1.4.2.2 pgoyette switch (archtype) {
350 1.4.2.2 pgoyette case ADT_NETBSDROOT:
351 1.4.2.2 pgoyette case ADT_NETBSDUSER:
352 1.4.2.2 pgoyette return DKW_PTYPE_FFS;
353 1.4.2.2 pgoyette case ADT_NETBSDSWAP:
354 1.4.2.2 pgoyette return DKW_PTYPE_SWAP;
355 1.4.2.2 pgoyette case ADT_AMIGADOS:
356 1.4.2.2 pgoyette return DKW_PTYPE_AMIGADOS;
357 1.4.2.2 pgoyette case ADT_EXT2:
358 1.4.2.2 pgoyette return DKW_PTYPE_EXT2FS;
359 1.4.2.2 pgoyette default:
360 1.4.2.2 pgoyette return DKW_PTYPE_UNKNOWN;
361 1.4.2.2 pgoyette }
362 1.4.2.2 pgoyette }
363 1.4.2.2 pgoyette
364 1.4.2.2 pgoyette #ifdef _KERNEL
365 1.4.2.2 pgoyette DKWEDGE_DISCOVERY_METHOD_DECL(RDB, 15, dkwedge_discover_rdb);
366 1.4.2.2 pgoyette #endif
367