]>
Commit | Line | Data |
---|---|---|
1c79356b A |
1 | /* |
2 | * Copyright (c) 2000 Apple Computer, Inc. All rights reserved. | |
3 | * | |
4 | * @APPLE_LICENSE_HEADER_START@ | |
5 | * | |
6 | * The contents of this file constitute Original Code as defined in and | |
7 | * are subject to the Apple Public Source License Version 1.1 (the | |
8 | * "License"). You may not use this file except in compliance with the | |
9 | * License. Please obtain a copy of the License at | |
10 | * http://www.apple.com/publicsource and read it before using this file. | |
11 | * | |
12 | * This Original Code and all software distributed under the License are | |
13 | * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER | |
14 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, | |
15 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, | |
16 | * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the | |
17 | * License for the specific language governing rights and limitations | |
18 | * under the License. | |
19 | * | |
20 | * @APPLE_LICENSE_HEADER_END@ | |
21 | */ | |
22 | /* Copyright (c) 1991 by NeXT Computer, Inc. | |
23 | * | |
24 | * File: bsd/dev/disk_label.h - NeXT disk label definition. | |
25 | * | |
26 | * HISTORY | |
27 | * 28-Mar-92 Doug Mitchell at NeXT | |
28 | * Split out from <bsd/dev/disk.h>. | |
29 | */ | |
30 | ||
31 | #ifndef _BSD_DEV_DISK_LABEL_ | |
32 | #define _BSD_DEV_DISK_LABEL_ | |
33 | ||
34 | #include <sys/disktab.h> | |
35 | ||
36 | #define NLABELS 4 /* # of labels on a disk */ | |
37 | #define MAXLBLLEN 24 /* dl_label[] size */ | |
38 | #define NBAD 1670 /* sized to make label ~= 8KB */ | |
39 | ||
40 | /* | |
41 | * if dl_version >= DL_V3 then the bad block table is relocated | |
42 | * to a structure separate from the disk label. | |
43 | */ | |
44 | typedef union { | |
45 | unsigned short DL_v3_checksum; | |
46 | int DL_bad[NBAD]; /* block number that is bad */ | |
47 | } dl_un_t; | |
48 | ||
49 | typedef struct disk_label { | |
50 | int dl_version; // label version number | |
51 | int dl_label_blkno; // block # where this label is | |
52 | int dl_size; // size of media area (sectors) | |
53 | char dl_label[MAXLBLLEN]; // media label | |
54 | unsigned dl_flags; // flags (see DL_xxx, below) | |
55 | unsigned dl_tag; // volume tag | |
56 | struct disktab dl_dt; // common info in disktab | |
57 | dl_un_t dl_un; | |
58 | unsigned short dl_checksum; // ones complement checksum | |
59 | ||
60 | /* add things here so dl_checksum stays in a fixed place */ | |
61 | } disk_label_t; | |
62 | ||
63 | /* | |
64 | * Known label versions. | |
65 | */ | |
66 | #define DL_V1 0x4e655854 /* version #1: "NeXT" */ | |
67 | #define DL_V2 0x646c5632 /* version #2: "dlV2" */ | |
68 | #define DL_V3 0x646c5633 /* version #3: "dlV3" */ | |
69 | #define DL_VERSION DL_V3 /* default version */ | |
70 | ||
71 | ||
72 | /* | |
73 | * dl_flags values | |
74 | */ | |
75 | #define DL_UNINIT 0x80000000 /* label is uninitialized */ | |
76 | ||
77 | /* | |
78 | * Aliases for disktab fields | |
79 | */ | |
80 | #define dl_name dl_dt.d_name | |
81 | #define dl_type dl_dt.d_type | |
82 | #define dl_part dl_dt.d_partitions | |
83 | #define dl_front dl_dt.d_front | |
84 | #define dl_back dl_dt.d_back | |
85 | #define dl_ngroups dl_dt.d_ngroups | |
86 | #define dl_ag_size dl_dt.d_ag_size | |
87 | #define dl_ag_alts dl_dt.d_ag_alts | |
88 | #define dl_ag_off dl_dt.d_ag_off | |
89 | #define dl_secsize dl_dt.d_secsize | |
90 | #define dl_ncyl dl_dt.d_ncylinders | |
91 | #define dl_nsect dl_dt.d_nsectors | |
92 | #define dl_ntrack dl_dt.d_ntracks | |
93 | #define dl_rpm dl_dt.d_rpm | |
94 | #define dl_bootfile dl_dt.d_bootfile | |
95 | #define dl_boot0_blkno dl_dt.d_boot0_blkno | |
96 | #define dl_hostname dl_dt.d_hostname | |
97 | #define dl_rootpartition dl_dt.d_rootpartition | |
98 | #define dl_rwpartition dl_dt.d_rwpartition | |
99 | ||
100 | /* | |
101 | * Other aliases | |
102 | */ | |
103 | #define dl_v3_checksum dl_un.DL_v3_checksum | |
104 | #define dl_bad dl_un.DL_bad | |
105 | ||
106 | #endif /* _BSD_DEV_DISK_LABEL_ */ | |
107 |