xref: /xnu-11215/bsd/sys/disktab.h (revision a5e72196)
1 /*
2  * Copyright (c) 2000-2002 Apple Computer, Inc. All rights reserved.
3  *
4  * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
5  *
6  * This file contains Original Code and/or Modifications of Original Code
7  * as defined in and that are subject to the Apple Public Source License
8  * Version 2.0 (the 'License'). You may not use this file except in
9  * compliance with the License. The rights granted to you under the License
10  * may not be used to create, or enable the creation or redistribution of,
11  * unlawful or unlicensed copies of an Apple operating system, or to
12  * circumvent, violate, or enable the circumvention or violation of, any
13  * terms of an Apple operating system software license agreement.
14  *
15  * Please obtain a copy of the License at
16  * http://www.opensource.apple.com/apsl/ and read it before using this file.
17  *
18  * The Original Code and all software distributed under the License are
19  * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20  * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21  * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22  * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23  * Please see the License for the specific language governing rights and
24  * limitations under the License.
25  *
26  * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
27  */
28 /*
29  * HISTORY:
30  * 16-Mar-88  John Seamons (jks) at NeXT
31  *	Cleaned up to support standard disk label definitions.
32  *
33  * 24-Feb-88  Mike DeMoney (mike) at NeXT
34  *	Added d_boot0_blkno to indicate logical block number
35  *	of "block 0" boot.  This blkno is in d_secsize sectors.
36  *	Added d_bootfile to indicate the default operating system
37  *	image to be booted by the blk 0 boot.
38  *	Changed d_name and d_type to be char arrays rather than ptrs
39  *	so they are part of label.  This limits length of info in
40  *	/etc/disktab, sorry.
41  */
42 
43 #ifndef _SYS_DISKTAB_
44 #define _SYS_DISKTAB_
45 
46 #include <sys/appleapiopts.h>
47 
48 #ifdef  __APPLE_API_OBSOLETE
49 
50 /*
51  * Disk description table, see disktab(5)
52  */
53 #ifndef KERNEL
54 #define DISKTAB         "/etc/disktab"
55 #endif  /* !KERNEL */
56 
57 #define MAXDNMLEN       24      // drive name length
58 #define MAXMPTLEN       16      // mount point length
59 #define MAXFSTLEN       8       // file system type length
60 #define MAXTYPLEN       24      // drive type length
61 #define NBOOTS          2       // # of boot blocks
62 #define MAXBFLEN        24      // bootfile name length
63 #define MAXHNLEN        32      // host name length
64 #define NPART           8       // # of partitions
65 
66 typedef struct partition {
67 	int     p_base;         /* base sector# of partition */
68 	int     p_size;         /* #sectors in partition */
69 	short   p_bsize;        /* block size in bytes */
70 	short   p_fsize;        /* frag size in bytes */
71 	char    p_opt;          /* 's'pace/'t'ime optimization pref */
72 	short   p_cpg;          /* cylinders per group */
73 	short   p_density;      /* bytes per inode density */
74 	char    p_minfree;      /* minfree (%) */
75 	char    p_newfs;        /* run newfs during init */
76 	char    p_mountpt[MAXMPTLEN];/* mount point */
77 	char    p_automnt;      /* auto-mount when inserted */
78 	char    p_type[MAXFSTLEN];/* file system type */
79 } partition_t;
80 
81 typedef struct disktab {
82 	char    d_name[MAXDNMLEN];      /* drive name */
83 	char    d_type[MAXTYPLEN];      /* drive type */
84 	int     d_secsize;              /* sector size in bytes */
85 	int     d_ntracks;              /* # tracks/cylinder */
86 	int     d_nsectors;             /* # sectors/track */
87 	int     d_ncylinders;           /* # cylinders */
88 	int     d_rpm;                  /* revolutions/minute */
89 	short   d_front;                /* size of front porch (sectors) */
90 	short   d_back;                 /* size of back porch (sectors) */
91 	short   d_ngroups;              /* number of alt groups */
92 	short   d_ag_size;              /* alt group size (sectors) */
93 	short   d_ag_alts;              /* alternate sectors / alt group */
94 	short   d_ag_off;               /* sector offset to first alternate */
95 	int     d_boot0_blkno[NBOOTS];  /* "blk 0" boot locations */
96 	char    d_bootfile[MAXBFLEN];   /* default bootfile */
97 	char    d_hostname[MAXHNLEN];   /* host name */
98 	char    d_rootpartition;        /* root partition e.g. 'a' */
99 	char    d_rwpartition;          /* r/w partition e.g. 'b' */
100 	partition_t d_partitions[NPART];
101 } disktab_t;
102 
103 #ifndef KERNEL
104 struct  disktab *getdiskbyname(), *getdiskbydev();
105 #endif  /* !KERNEL */
106 
107 #endif  /* __APPLE_API_OBSOLETE */
108 
109 #endif  /* _SYS_DISKTAB_ */
110