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