Merge branch 'vendor/MDOCML'
[dragonfly.git] / include / disktab.h
1 /*
2  * Copyright (c) 1983, 1993
3  *      The Regents of the University of California.  All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  * 1. Redistributions of source code must retain the above copyright
9  *    notice, this list of conditions and the following disclaimer.
10  * 2. Redistributions in binary form must reproduce the above copyright
11  *    notice, this list of conditions and the following disclaimer in the
12  *    documentation and/or other materials provided with the distribution.
13  * 3. All advertising materials mentioning features or use of this software
14  *    must display the following acknowledgement:
15  *      This product includes software developed by the University of
16  *      California, Berkeley and its contributors.
17  * 4. Neither the name of the University nor the names of its contributors
18  *    may be used to endorse or promote products derived from this software
19  *    without specific prior written permission.
20  *
21  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
22  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
25  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31  * SUCH DAMAGE.
32  *
33  * @(#)disktab.h        8.1 (Berkeley) 6/2/93
34  * $DragonFly: src/include/disktab.h,v 1.4 2007/06/18 05:13:33 dillon Exp $
35  */
36
37 #ifndef _DISKTAB_H_
38 #define _DISKTAB_H_
39
40 #ifndef _MACHINE_TYPES_H_
41 #include <machine/types.h>
42 #endif
43
44 /*
45  * Disk description table, see disktab(5)
46  */
47 #ifndef _PATH_DISKTAB
48 #define _PATH_DISKTAB   "/etc/disktab"
49 #endif
50
51 #define MAXDTPARTITIONS         16
52
53 struct  disktab {
54         char    d_typename[16];         /* drive type (string) */
55         int     d_typeid;               /* drive type (id) */
56
57         /*
58          * disk_info mandatory fields (not necessarily mandatory for disktab).
59          * If d_media_blksize and one of d_media_size or d_media_blocks
60          * is set, the remainining d_media_size/d_media_blocks field will
61          * be constructed by getdisktabbyname().
62          */
63         __uint64_t d_media_size;
64         __uint64_t d_media_blocks;
65         int     d_media_blksize;
66         int     d_dsflags;
67
68         /*
69          * disk_info optional fields.  
70          */
71         unsigned int    d_nheads;       /* (used to be d_ntracks) */
72         unsigned int    d_secpertrack;  /* (used to be d_nsectors) */
73         unsigned int    d_secpercyl;
74         unsigned int    d_ncylinders;
75
76         int     d_rpm;                  /* revolutions/minute */
77         int     d_badsectforw;          /* supports DEC bad144 std */
78         int     d_sectoffset;           /* use sect rather than cyl offsets */
79         int     d_npartitions;          /* number of partitions */
80         int     d_interleave;
81         int     d_trackskew;
82         int     d_cylskew;
83         int     d_headswitch;
84         int     d_trkseek;
85
86         unsigned int    d_bbsize;       /* size of boot area */
87         unsigned int    d_sbsize;       /* max size of fs superblock */
88
89         /*
90          * The partition table is variable length but does not necessarily
91          * represent the maximum possible number of partitions for any
92          * particular type of disklabel.
93          */
94         struct  dt_partition {
95                 __uint64_t p_offset;    /* offset, in sectors */
96                 __uint64_t p_size;      /* #sectors in partition */
97                 int       p_fstype;
98                 int       p_fsize;      /* fragment size */
99                 int       p_frag;       /* bsize = fsize * frag */
100                 char      p_fstypestr[32];
101         } d_partitions[MAXDTPARTITIONS];
102 };
103
104 #ifndef _KERNEL
105 __BEGIN_DECLS
106 struct disklabel32;
107 struct disktab *getdisktabbyname (const char *);
108 struct disklabel32 *getdiskbyname (const char *);
109 __END_DECLS
110 #endif
111
112 #endif /* !_DISKTAB_H_ */