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