root / lab4 / .minix-src / include / sys / disklabel.h @ 14
History | View | Annotate | Download (16.7 KB)
1 | 13 | up20180614 | /* $NetBSD: disklabel.h,v 1.118 2015/01/02 19:42:07 christos Exp $ */
|
---|---|---|---|
2 | |||
3 | /*
|
||
4 | * Copyright (c) 1987, 1988, 1993
|
||
5 | * The Regents of the University of California. 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 | * 3. Neither the name of the University nor the names of its contributors
|
||
16 | * may be used to endorse or promote products derived from this software
|
||
17 | * without specific prior written permission.
|
||
18 | *
|
||
19 | * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||
20 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||
21 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||
22 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||
23 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||
24 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||
25 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||
26 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||
27 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||
28 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||
29 | * SUCH DAMAGE.
|
||
30 | *
|
||
31 | * @(#)disklabel.h 8.2 (Berkeley) 7/10/94
|
||
32 | */
|
||
33 | |||
34 | #ifndef _SYS_DISKLABEL_H_
|
||
35 | #define _SYS_DISKLABEL_H_
|
||
36 | |||
37 | /*
|
||
38 | * We need <machine/types.h> for __HAVE_OLD_DISKLABEL
|
||
39 | */
|
||
40 | #ifndef _LOCORE
|
||
41 | #include <sys/types.h> |
||
42 | #endif
|
||
43 | |||
44 | /*
|
||
45 | * Each disk has a label which includes information about the hardware
|
||
46 | * disk geometry, filesystem partitions, and drive specific information.
|
||
47 | * The location of the label, as well as the number of partitions the
|
||
48 | * label can describe and the number of the "whole disk" (raw)
|
||
49 | * partition are machine dependent.
|
||
50 | */
|
||
51 | #if HAVE_NBTOOL_CONFIG_H
|
||
52 | #undef MAXPARTITIONS
|
||
53 | #define MAXPARTITIONS MAXMAXPARTITIONS
|
||
54 | #else
|
||
55 | #include <machine/disklabel.h> |
||
56 | #endif /* HAVE_NBTOOL_CONFIG_H */ |
||
57 | |||
58 | /*
|
||
59 | * The absolute maximum number of disk partitions allowed.
|
||
60 | * This is the maximum value of MAXPARTITIONS for which 'struct disklabel'
|
||
61 | * is <= DEV_BSIZE bytes long. If MAXPARTITIONS is greater than this, beware.
|
||
62 | */
|
||
63 | #define MAXMAXPARTITIONS 22 |
||
64 | #if MAXPARTITIONS > MAXMAXPARTITIONS
|
||
65 | #warning beware: MAXPARTITIONS bigger than MAXMAXPARTITIONS
|
||
66 | #endif
|
||
67 | |||
68 | /*
|
||
69 | * Ports can switch their MAXPARTITIONS once, as follows:
|
||
70 | *
|
||
71 | * - define OLDMAXPARTITIONS in <machine/disklabel.h> as the old number
|
||
72 | * - define MAXPARTITIONS as the new number
|
||
73 | * - define DISKUNIT, DISKPART and DISKMINOR macros in <machine/disklabel.h>
|
||
74 | * as appropriate for the port (see the i386 one for an example).
|
||
75 | * - define __HAVE_OLD_DISKLABEL in <machine/types.h>
|
||
76 | */
|
||
77 | |||
78 | #if defined(_KERNEL) && defined(__HAVE_OLD_DISKLABEL) && \
|
||
79 | (MAXPARTITIONS < OLDMAXPARTITIONS) |
||
80 | #error "can only grow disklabel size" |
||
81 | #endif
|
||
82 | |||
83 | |||
84 | /*
|
||
85 | * Translate between device numbers and major/disk unit/disk partition.
|
||
86 | */
|
||
87 | #ifndef __HAVE_OLD_DISKLABEL
|
||
88 | #if !HAVE_NBTOOL_CONFIG_H
|
||
89 | #define DISKUNIT(dev) (minor(dev) / MAXPARTITIONS)
|
||
90 | #define DISKPART(dev) (minor(dev) % MAXPARTITIONS)
|
||
91 | #define DISKMINOR(unit, part) \
|
||
92 | (((unit) * MAXPARTITIONS) + (part)) |
||
93 | #endif /* !HAVE_NBTOOL_CONFIG_H */ |
||
94 | #endif
|
||
95 | #define MAKEDISKDEV(maj, unit, part) \
|
||
96 | (makedev((maj), DISKMINOR((unit), (part)))) |
||
97 | |||
98 | #define DISKMAGIC ((uint32_t)0x82564557) /* The disk magic number */ |
||
99 | |||
100 | #ifndef _LOCORE
|
||
101 | struct partition { /* the partition table */ |
||
102 | uint32_t p_size; /* number of sectors in partition */
|
||
103 | uint32_t p_offset; /* starting sector */
|
||
104 | union {
|
||
105 | uint32_t fsize; /* FFS, ADOS: filesystem basic fragment size */
|
||
106 | uint32_t cdsession; /* ISO9660: session offset */
|
||
107 | } __partition_u2; |
||
108 | #define p_fsize __partition_u2.fsize
|
||
109 | #define p_cdsession __partition_u2.cdsession
|
||
110 | uint8_t p_fstype; /* filesystem type, see below */
|
||
111 | uint8_t p_frag; /* filesystem fragments per block */
|
||
112 | union {
|
||
113 | uint16_t cpg; /* UFS: FS cylinders per group */
|
||
114 | uint16_t sgs; /* LFS: FS segment shift */
|
||
115 | } __partition_u1; |
||
116 | #define p_cpg __partition_u1.cpg
|
||
117 | #define p_sgs __partition_u1.sgs
|
||
118 | }; |
||
119 | struct disklabel {
|
||
120 | uint32_t d_magic; /* the magic number */
|
||
121 | uint16_t d_type; /* drive type */
|
||
122 | uint16_t d_subtype; /* controller/d_type specific */
|
||
123 | char d_typename[16]; /* type name, e.g. "eagle" */ |
||
124 | |||
125 | /*
|
||
126 | * d_packname contains the pack identifier and is returned when
|
||
127 | * the disklabel is read off the disk or in-core copy.
|
||
128 | * d_boot0 and d_boot1 are the (optional) names of the
|
||
129 | * primary (block 0) and secondary (block 1-15) bootstraps
|
||
130 | * as found in /usr/mdec. These are returned when using
|
||
131 | * getdiskbyname(3) to retrieve the values from /etc/disktab.
|
||
132 | */
|
||
133 | union {
|
||
134 | char un_d_packname[16]; /* pack identifier */ |
||
135 | struct {
|
||
136 | char *un_d_boot0; /* primary bootstrap name */ |
||
137 | char *un_d_boot1; /* secondary bootstrap name */ |
||
138 | } un_b; |
||
139 | uint64_t un_d_pad; /* force 8 byte alignment */
|
||
140 | } d_un; |
||
141 | #define d_packname d_un.un_d_packname
|
||
142 | #define d_boot0 d_un.un_b.un_d_boot0
|
||
143 | #define d_boot1 d_un.un_b.un_d_boot1
|
||
144 | |||
145 | /* disk geometry: */
|
||
146 | uint32_t d_secsize; /* # of bytes per sector */
|
||
147 | uint32_t d_nsectors; /* # of data sectors per track */
|
||
148 | uint32_t d_ntracks; /* # of tracks per cylinder */
|
||
149 | uint32_t d_ncylinders; /* # of data cylinders per unit */
|
||
150 | uint32_t d_secpercyl; /* # of data sectors per cylinder */
|
||
151 | uint32_t d_secperunit; /* # of data sectors per unit */
|
||
152 | |||
153 | /*
|
||
154 | * Spares (bad sector replacements) below are not counted in
|
||
155 | * d_nsectors or d_secpercyl. Spare sectors are assumed to
|
||
156 | * be physical sectors which occupy space at the end of each
|
||
157 | * track and/or cylinder.
|
||
158 | */
|
||
159 | uint16_t d_sparespertrack; /* # of spare sectors per track */
|
||
160 | uint16_t d_sparespercyl; /* # of spare sectors per cylinder */
|
||
161 | /*
|
||
162 | * Alternative cylinders include maintenance, replacement,
|
||
163 | * configuration description areas, etc.
|
||
164 | */
|
||
165 | uint32_t d_acylinders; /* # of alt. cylinders per unit */
|
||
166 | |||
167 | /* hardware characteristics: */
|
||
168 | /*
|
||
169 | * d_interleave, d_trackskew and d_cylskew describe perturbations
|
||
170 | * in the media format used to compensate for a slow controller.
|
||
171 | * Interleave is physical sector interleave, set up by the
|
||
172 | * formatter or controller when formatting. When interleaving is
|
||
173 | * in use, logically adjacent sectors are not physically
|
||
174 | * contiguous, but instead are separated by some number of
|
||
175 | * sectors. It is specified as the ratio of physical sectors
|
||
176 | * traversed per logical sector. Thus an interleave of 1:1
|
||
177 | * implies contiguous layout, while 2:1 implies that logical
|
||
178 | * sector 0 is separated by one sector from logical sector 1.
|
||
179 | * d_trackskew is the offset of sector 0 on track N relative to
|
||
180 | * sector 0 on track N-1 on the same cylinder. Finally, d_cylskew
|
||
181 | * is the offset of sector 0 on cylinder N relative to sector 0
|
||
182 | * on cylinder N-1.
|
||
183 | */
|
||
184 | uint16_t d_rpm; /* rotational speed */
|
||
185 | uint16_t d_interleave; /* hardware sector interleave */
|
||
186 | uint16_t d_trackskew; /* sector 0 skew, per track */
|
||
187 | uint16_t d_cylskew; /* sector 0 skew, per cylinder */
|
||
188 | uint32_t d_headswitch; /* head switch time, usec */
|
||
189 | uint32_t d_trkseek; /* track-to-track seek, usec */
|
||
190 | uint32_t d_flags; /* generic flags */
|
||
191 | #define NDDATA 5 |
||
192 | uint32_t d_drivedata[NDDATA]; /* drive-type specific information */
|
||
193 | #define NSPARE 5 |
||
194 | uint32_t d_spare[NSPARE]; /* reserved for future use */
|
||
195 | uint32_t d_magic2; /* the magic number (again) */
|
||
196 | uint16_t d_checksum; /* xor of data incl. partitions */
|
||
197 | |||
198 | /* filesystem and partition information: */
|
||
199 | uint16_t d_npartitions; /* number of partitions in following */
|
||
200 | uint32_t d_bbsize; /* size of boot area at sn0, bytes */
|
||
201 | uint32_t d_sbsize; /* max size of fs superblock, bytes */
|
||
202 | struct partition d_partitions[MAXPARTITIONS];
|
||
203 | /* the partition table, actually may be more */
|
||
204 | }; |
||
205 | |||
206 | #if defined(__HAVE_OLD_DISKLABEL) && !HAVE_NBTOOL_CONFIG_H
|
||
207 | /*
|
||
208 | * Same as above, but with OLDMAXPARTITIONS partitions. For use in
|
||
209 | * the old DIOC* ioctl calls.
|
||
210 | */
|
||
211 | struct olddisklabel {
|
||
212 | uint32_t d_magic; |
||
213 | uint16_t d_type; |
||
214 | uint16_t d_subtype; |
||
215 | char d_typename[16]; |
||
216 | union {
|
||
217 | char un_d_packname[16]; |
||
218 | struct {
|
||
219 | char *un_d_boot0;
|
||
220 | char *un_d_boot1;
|
||
221 | } un_b; |
||
222 | } d_un; |
||
223 | uint32_t d_secsize; |
||
224 | uint32_t d_nsectors; |
||
225 | uint32_t d_ntracks; |
||
226 | uint32_t d_ncylinders; |
||
227 | uint32_t d_secpercyl; |
||
228 | uint32_t d_secperunit; |
||
229 | uint16_t d_sparespertrack; |
||
230 | uint16_t d_sparespercyl; |
||
231 | uint32_t d_acylinders; |
||
232 | uint16_t d_rpm; |
||
233 | uint16_t d_interleave; |
||
234 | uint16_t d_trackskew; |
||
235 | uint16_t d_cylskew; |
||
236 | uint32_t d_headswitch; |
||
237 | uint32_t d_trkseek; |
||
238 | uint32_t d_flags; |
||
239 | uint32_t d_drivedata[NDDATA]; |
||
240 | uint32_t d_spare[NSPARE]; |
||
241 | uint32_t d_magic2; |
||
242 | uint16_t d_checksum; |
||
243 | uint16_t d_npartitions; |
||
244 | uint32_t d_bbsize; |
||
245 | uint32_t d_sbsize; |
||
246 | struct opartition {
|
||
247 | uint32_t p_size; |
||
248 | uint32_t p_offset; |
||
249 | union {
|
||
250 | uint32_t fsize; |
||
251 | uint32_t cdsession; |
||
252 | } __partition_u2; |
||
253 | uint8_t p_fstype; |
||
254 | uint8_t p_frag; |
||
255 | union {
|
||
256 | uint16_t cpg; |
||
257 | uint16_t sgs; |
||
258 | } __partition_u1; |
||
259 | } d_partitions[OLDMAXPARTITIONS]; |
||
260 | }; |
||
261 | #endif /* __HAVE_OLD_DISKLABEL */ |
||
262 | #else /* _LOCORE */ |
||
263 | /*
|
||
264 | * offsets for asm boot files.
|
||
265 | */
|
||
266 | .set d_secsize,40
|
||
267 | .set d_nsectors,44
|
||
268 | .set d_ntracks,48
|
||
269 | .set d_ncylinders,52
|
||
270 | .set d_secpercyl,56
|
||
271 | .set d_secperunit,60
|
||
272 | .set d_end_,148+(MAXPARTITIONS*16) |
||
273 | #endif /* _LOCORE */ |
||
274 | |||
275 | /*
|
||
276 | * We normally use C99 initialisers (just in case the lists below are out
|
||
277 | * of sequence, or have gaps), but lint doesn't grok them.
|
||
278 | * Maybe some host compilers don't either, but many have for quite some time.
|
||
279 | */
|
||
280 | |||
281 | #ifndef lint
|
||
282 | #define ARRAY_INIT(element,value) [element]=value
|
||
283 | #else
|
||
284 | #define ARRAY_INIT(element,value) value
|
||
285 | #endif
|
||
286 | |||
287 | /* Use pre-processor magic to get all the parameters one one line... */
|
||
288 | |||
289 | /* d_type values: */
|
||
290 | #define DKTYPE_DEFN(x) \
|
||
291 | x(UNKNOWN, 0, "unknown") \ |
||
292 | x(SMD, 1, "SMD") /* SMD, XSMD; VAX hp/up */ \ |
||
293 | x(MSCP, 2, "MSCP") /* MSCP */ \ |
||
294 | x(DEC, 3, "old DEC") /* other DEC (rk, rl) */ \ |
||
295 | x(SCSI, 4, "SCSI") /* SCSI */ \ |
||
296 | x(ESDI, 5, "ESDI") /* ESDI interface */ \ |
||
297 | x(ST506, 6, "ST506") /* ST506 etc. */ \ |
||
298 | x(HPIB, 7, "HP-IB") /* CS/80 on HP-IB */ \ |
||
299 | x(HPFL, 8, "HP-FL") /* HP Fiber-link */ \ |
||
300 | x(TYPE_9, 9, "type 9") \ |
||
301 | x(FLOPPY, 10, "floppy") /* floppy */ \ |
||
302 | x(CCD, 11, "ccd") /* concatenated disk device */ \ |
||
303 | x(VND, 12, "vnd") /* uvnode pseudo-disk */ \ |
||
304 | x(ATAPI, 13, "ATAPI") /* ATAPI */ \ |
||
305 | x(RAID, 14, "RAID") /* RAIDframe */ \ |
||
306 | x(LD, 15, "ld") /* logical disk */ \ |
||
307 | x(JFS2, 16, "jfs") /* IBM JFS2 */ \ |
||
308 | x(CGD, 17, "cgd") /* cryptographic pseudo-disk */ \ |
||
309 | x(VINUM, 18, "vinum") /* vinum volume */ \ |
||
310 | x(FLASH, 19, "flash") /* flash memory devices */ \ |
||
311 | x(DM, 20, "dm") /* device-mapper pseudo-disk devices */\ |
||
312 | x(RUMPD, 21, "rumpd") /* rump virtual disk */ \ |
||
313 | x(MD, 22, "md") /* memory disk */ \ |
||
314 | |||
315 | #ifndef _LOCORE
|
||
316 | #define DKTYPE_NUMS(tag, number, name) __CONCAT(DKTYPE_,tag=number),
|
||
317 | #ifndef DKTYPE_ENUMNAME
|
||
318 | #define DKTYPE_ENUMNAME
|
||
319 | #endif
|
||
320 | enum DKTYPE_ENUMNAME { DKTYPE_DEFN(DKTYPE_NUMS) DKMAXTYPES };
|
||
321 | #undef DKTYPE_NUMS
|
||
322 | #endif
|
||
323 | |||
324 | #ifdef DKTYPENAMES
|
||
325 | #define DKTYPE_NAMES(tag, number, name) ARRAY_INIT(number,name),
|
||
326 | static const char *const dktypenames[] = { DKTYPE_DEFN(DKTYPE_NAMES) NULL }; |
||
327 | #undef DKTYPE_NAMES
|
||
328 | #endif
|
||
329 | |||
330 | /*
|
||
331 | * Partition type names, numbers, label-names, fsck prog, and mount prog
|
||
332 | */
|
||
333 | #define FSTYPE_DEFN(x) \
|
||
334 | x(UNUSED, 0, "unused", NULL, NULL) /* unused */ \ |
||
335 | x(SWAP, 1, "swap", NULL, NULL) /* swap */ \ |
||
336 | x(V6, 2, "Version 6", NULL, NULL) /* Sixth Edition */ \ |
||
337 | x(V7, 3, "Version 7", "v7fs", "v7fs") /* Seventh Edition */ \ |
||
338 | x(SYSV, 4, "System V", NULL, NULL) /* System V */ \ |
||
339 | x(V71K, 5, "4.1BSD", NULL, NULL) /* V7, 1K blocks (4.1, 2.9) */ \ |
||
340 | x(V8, 6, "Eighth Edition",NULL, NULL) /* Eighth Edition, 4K blocks */ \ |
||
341 | x(BSDFFS, 7, "4.2BSD", "ffs", "ffs") /* 4.2BSD fast file system */ \ |
||
342 | x(MSDOS, 8, "MSDOS", "msdos", "msdos") /* MSDOS file system */ \ |
||
343 | x(BSDLFS, 9, "4.4LFS", "lfs", "lfs") /* 4.4BSD log-structured FS */ \ |
||
344 | x(OTHER, 10, "unknown", NULL, NULL) /* in use, unknown/unsupported */\ |
||
345 | x(HPFS, 11, "HPFS", NULL, NULL) /* OS/2 high-performance FS */ \ |
||
346 | x(ISO9660, 12, "ISO9660", NULL, "cd9660")/* ISO 9660, normally CD-ROM */ \ |
||
347 | x(BOOT, 13, "boot", NULL, NULL) /* bootstrap code in partition */\ |
||
348 | x(ADOS, 14, "ADOS", NULL, "ados") /* AmigaDOS fast file system */ \ |
||
349 | x(HFS, 15, "HFS", NULL, NULL) /* Macintosh HFS */ \ |
||
350 | x(FILECORE,16, "FILECORE", NULL, "filecore")/* Acorn Filecore FS */ \ |
||
351 | x(EX2FS, 17, "Linux Ext2","ext2fs","ext2fs")/* Linux Extended 2 FS */ \ |
||
352 | x(NTFS, 18, "NTFS", NULL, "ntfs") /* Windows/NT file system */ \ |
||
353 | x(RAID, 19, "RAID", NULL, NULL) /* RAIDframe component */ \ |
||
354 | x(CCD, 20, "ccd", NULL, NULL) /* concatenated disk component */\ |
||
355 | x(JFS2, 21, "jfs", NULL, NULL) /* IBM JFS2 */ \ |
||
356 | x(APPLEUFS,22, "Apple UFS", "ffs", "ffs") /* Apple UFS */ \ |
||
357 | /* XXX this is not the same as FreeBSD. How to solve? */ \
|
||
358 | x(VINUM, 23, "vinum", NULL, NULL) /* Vinum */ \ |
||
359 | x(UDF, 24, "UDF", NULL, "udf") /* UDF */ \ |
||
360 | x(SYSVBFS, 25, "SysVBFS", NULL, "sysvbfs")/* System V boot file system */ \ |
||
361 | x(EFS, 26, "EFS", NULL, "efs") /* SGI's Extent Filesystem */ \ |
||
362 | x(NILFS, 27, "NiLFS", NULL, "nilfs") /* NTT's NiLFS(2) */ \ |
||
363 | x(CGD, 28, "cgd", NULL, NULL) /* Cryptographic disk */ \ |
||
364 | x(MINIXFS3,29, "MINIX FSv3", NULL, NULL) /* MINIX file system v3 */ |
||
365 | |||
366 | |||
367 | #ifndef _LOCORE
|
||
368 | #define FS_TYPENUMS(tag, number, name, fsck, mount) __CONCAT(FS_,tag=number),
|
||
369 | #ifndef FSTYPE_ENUMNAME
|
||
370 | #define FSTYPE_ENUMNAME
|
||
371 | #endif
|
||
372 | enum FSTYPE_ENUMNAME { FSTYPE_DEFN(FS_TYPENUMS) FSMAXTYPES };
|
||
373 | #undef FS_TYPENUMS
|
||
374 | #endif
|
||
375 | |||
376 | #ifdef FSTYPENAMES
|
||
377 | #define FS_TYPENAMES(tag, number, name, fsck, mount) ARRAY_INIT(number,name),
|
||
378 | static const char *const fstypenames[] = { FSTYPE_DEFN(FS_TYPENAMES) NULL }; |
||
379 | #undef FS_TYPENAMES
|
||
380 | #endif
|
||
381 | |||
382 | #ifdef FSCKNAMES
|
||
383 | /* These are the names MOUNT_XXX from <sys/mount.h> */
|
||
384 | #define FS_FSCKNAMES(tag, number, name, fsck, mount) ARRAY_INIT(number,fsck),
|
||
385 | static const char *const fscknames[] = { FSTYPE_DEFN(FS_FSCKNAMES) NULL }; |
||
386 | #undef FS_FSCKNAMES
|
||
387 | #define FSMAXNAMES FSMAXTYPES
|
||
388 | #endif
|
||
389 | |||
390 | #ifdef MOUNTNAMES
|
||
391 | /* These are the names MOUNT_XXX from <sys/mount.h> */
|
||
392 | #define FS_MOUNTNAMES(tag, number, name, fsck, mount) ARRAY_INIT(number,mount),
|
||
393 | static const char *const mountnames[] = { FSTYPE_DEFN(FS_MOUNTNAMES) NULL }; |
||
394 | #undef FS_MOUNTNAMES
|
||
395 | #define FSMAXMOUNTNAMES FSMAXTYPES
|
||
396 | #endif
|
||
397 | |||
398 | /*
|
||
399 | * flags shared by various drives:
|
||
400 | */
|
||
401 | #define D_REMOVABLE 0x01 /* removable media */ |
||
402 | #define D_ECC 0x02 /* supports ECC */ |
||
403 | #define D_BADSECT 0x04 /* supports bad sector forw. */ |
||
404 | #define D_RAMDISK 0x08 /* disk emulator */ |
||
405 | #define D_CHAIN 0x10 /* can do back-back transfers */ |
||
406 | #define D_SCSI_MMC 0x20 /* SCSI MMC sessioned media */ |
||
407 | |||
408 | /*
|
||
409 | * Drive data for SMD.
|
||
410 | */
|
||
411 | #define d_smdflags d_drivedata[0] |
||
412 | #define D_SSE 0x1 /* supports skip sectoring */ |
||
413 | #define d_mindist d_drivedata[1] |
||
414 | #define d_maxdist d_drivedata[2] |
||
415 | #define d_sdist d_drivedata[3] |
||
416 | |||
417 | /*
|
||
418 | * Drive data for ST506.
|
||
419 | */
|
||
420 | #define d_precompcyl d_drivedata[0] |
||
421 | #define d_gap3 d_drivedata[1] /* used only when formatting */ |
||
422 | |||
423 | /*
|
||
424 | * Drive data for SCSI.
|
||
425 | */
|
||
426 | #define d_blind d_drivedata[0] |
||
427 | |||
428 | #ifndef _LOCORE
|
||
429 | /*
|
||
430 | * Structure used to perform a format or other raw operation,
|
||
431 | * returning data and/or register values. Register identification
|
||
432 | * and format are device- and driver-dependent. Currently unused.
|
||
433 | */
|
||
434 | struct format_op {
|
||
435 | char *df_buf;
|
||
436 | int df_count; /* value-result */ |
||
437 | daddr_t df_startblk; |
||
438 | int df_reg[8]; /* result */ |
||
439 | }; |
||
440 | |||
441 | #ifdef _KERNEL
|
||
442 | /*
|
||
443 | * Structure used internally to retrieve information about a partition
|
||
444 | * on a disk.
|
||
445 | */
|
||
446 | struct partinfo {
|
||
447 | struct disklabel *disklab;
|
||
448 | struct partition *part;
|
||
449 | }; |
||
450 | |||
451 | struct disk;
|
||
452 | |||
453 | int disk_read_sectors(void (*)(struct buf *), const struct disklabel *, |
||
454 | struct buf *, unsigned int, int); |
||
455 | void diskerr(const struct buf *, const char *, const char *, int, |
||
456 | int, const struct disklabel *); |
||
457 | u_int dkcksum(struct disklabel *);
|
||
458 | u_int dkcksum_sized(struct disklabel *, size_t);
|
||
459 | int setdisklabel(struct disklabel *, struct disklabel *, u_long, |
||
460 | struct cpu_disklabel *);
|
||
461 | const char *readdisklabel(dev_t, void (*)(struct buf *), |
||
462 | struct disklabel *, struct cpu_disklabel *); |
||
463 | int writedisklabel(dev_t, void (*)(struct buf *), struct disklabel *, |
||
464 | struct cpu_disklabel *);
|
||
465 | const char *convertdisklabel(struct disklabel *, void (*)(struct buf *), |
||
466 | struct buf *, uint32_t);
|
||
467 | int bounds_check_with_label(struct disk *, struct buf *, int); |
||
468 | int bounds_check_with_mediasize(struct buf *, int, uint64_t); |
||
469 | const char *getfstypename(int); |
||
470 | #endif
|
||
471 | #endif /* _LOCORE */ |
||
472 | |||
473 | #if !defined(_KERNEL) && !defined(_LOCORE)
|
||
474 | |||
475 | #include <sys/cdefs.h> |
||
476 | |||
477 | #endif
|
||
478 | |||
479 | #endif /* !_SYS_DISKLABEL_H_ */ |