5 * genhd.h Copyright (C) 1992 Drew Eckhardt
6 * Generic hard disk header file by
12 #include <linux/config.h>
13 #include <linux/types.h>
15 #define CONFIG_MSDOS_PARTITION 1
18 #define CONFIG_OSF_PARTITION 1
21 #if defined(__sparc__) || defined(CONFIG_SMD_DISKLABEL)
22 #define CONFIG_SUN_PARTITION 1
25 #if defined(CONFIG_SGI) || defined(CONFIG_SGI_DISKLABEL)
26 #define CONFIG_SGI_PARTITION 1
29 /* These three have identical behaviour; use the second one if DOS fdisk gets
30 confused about extended/logical partitions starting past cylinder 1023. */
31 #define DOS_EXTENDED_PARTITION 5
32 #define LINUX_EXTENDED_PARTITION 0x85
33 #define WIN98_EXTENDED_PARTITION 0x0f
35 #define LINUX_SWAP_PARTITION 0x82
37 #ifdef CONFIG_SOLARIS_X86_PARTITION
38 #define SOLARIS_X86_PARTITION LINUX_SWAP_PARTITION
41 #define DM6_PARTITION 0x54 /* has DDO: use xlated geom & offset */
42 #define EZD_PARTITION 0x55 /* EZ-DRIVE */
43 #define DM6_AUX1PARTITION 0x51 /* no DDO: use xlated geom */
44 #define DM6_AUX3PARTITION 0x53 /* no DDO: use xlated geom */
47 unsigned char boot_ind
; /* 0x80 - active */
48 unsigned char head
; /* starting head */
49 unsigned char sector
; /* starting sector */
50 unsigned char cyl
; /* starting cylinder */
51 unsigned char sys_ind
; /* What partition type */
52 unsigned char end_head
; /* end head */
53 unsigned char end_sector
; /* end sector */
54 unsigned char end_cyl
; /* end cylinder */
55 unsigned int start_sect
; /* starting sector counting from 0 */
56 unsigned int nr_sects
; /* nr of sectors in partition */
57 } __attribute__((packed
));
65 int major
; /* major number of driver */
66 const char *major_name
; /* name of major driver */
67 int minor_shift
; /* number of times minor is shifted to
69 int max_p
; /* maximum partitions per device */
70 int max_nr
; /* maximum number of real devices */
72 void (*init
)(struct gendisk
*); /* Initialization called before we do our thing */
73 struct hd_struct
*part
; /* [indexed by minor] */
74 int *sizes
; /* [idem], device size in blocks */
75 int nr_real
; /* number of real devices */
77 void *real_devices
; /* internal use */
81 #ifdef CONFIG_SOLARIS_X86_PARTITION
83 #define SOLARIS_X86_NUMSLICE 8
84 #define SOLARIS_X86_VTOC_SANE (0x600DDEEEUL)
86 struct solaris_x86_slice
{
87 ushort s_tag
; /* ID tag of partition */
88 ushort s_flag
; /* permision flags */
89 daddr_t s_start
; /* start sector no of partition */
90 long s_size
; /* # of blocks in partition */
93 struct solaris_x86_vtoc
{
94 unsigned long v_bootinfo
[3]; /* info needed by mboot (unsupported) */
95 unsigned long v_sanity
; /* to verify vtoc sanity */
96 unsigned long v_version
; /* layout version */
97 char v_volume
[8]; /* volume name */
98 ushort v_sectorsz
; /* sector size in bytes */
99 ushort v_nparts
; /* number of partitions */
100 unsigned long v_reserved
[10]; /* free space */
101 struct solaris_x86_slice
102 v_slice
[SOLARIS_X86_NUMSLICE
]; /* slice headers */
103 time_t timestamp
[SOLARIS_X86_NUMSLICE
]; /* timestamp (unsupported) */
104 char v_asciilabel
[128]; /* for compatibility */
107 #endif /* CONFIG_SOLARIS_X86_PARTITION */
109 #ifdef CONFIG_BSD_DISKLABEL
111 * BSD disklabel support by Yossi Gottlieb <yogo@math.tau.ac.il>
112 * updated by Marc Espie <Marc.Espie@openbsd.org>
114 #define FREEBSD_PARTITION 0xa5 /* FreeBSD Partition ID */
115 #define OPENBSD_PARTITION 0xa6 /* OpenBSD Partition ID */
116 #define NETBSD_PARTITION 0xa9 /* NetBSD Partition ID */
117 #define BSDI_PARTITION 0xb7 /* BSDI Partition ID */
119 /* Ours is not to wonder why.. */
120 #define BSD_PARTITION FREEBSD_PARTITION
122 /* check against BSD src/sys/sys/disklabel.h for consistency */
124 #define BSD_DISKMAGIC (0x82564557UL) /* The disk magic number */
125 #define BSD_MAXPARTITIONS 8
126 #define OPENBSD_MAXPARTITIONS 16
127 #define BSD_FS_UNUSED 0 /* disklabel unused partition entry ID */
128 struct bsd_disklabel
{
129 __u32 d_magic
; /* the magic number */
130 __s16 d_type
; /* drive type */
131 __s16 d_subtype
; /* controller/d_type specific */
132 char d_typename
[16]; /* type name, e.g. "eagle" */
133 char d_packname
[16]; /* pack identifier */
134 __u32 d_secsize
; /* # of bytes per sector */
135 __u32 d_nsectors
; /* # of data sectors per track */
136 __u32 d_ntracks
; /* # of tracks per cylinder */
137 __u32 d_ncylinders
; /* # of data cylinders per unit */
138 __u32 d_secpercyl
; /* # of data sectors per cylinder */
139 __u32 d_secperunit
; /* # of data sectors per unit */
140 __u16 d_sparespertrack
; /* # of spare sectors per track */
141 __u16 d_sparespercyl
; /* # of spare sectors per cylinder */
142 __u32 d_acylinders
; /* # of alt. cylinders per unit */
143 __u16 d_rpm
; /* rotational speed */
144 __u16 d_interleave
; /* hardware sector interleave */
145 __u16 d_trackskew
; /* sector 0 skew, per track */
146 __u16 d_cylskew
; /* sector 0 skew, per cylinder */
147 __u32 d_headswitch
; /* head switch time, usec */
148 __u32 d_trkseek
; /* track-to-track seek, usec */
149 __u32 d_flags
; /* generic flags */
151 __u32 d_drivedata
[NDDATA
]; /* drive-type specific information */
153 __u32 d_spare
[NSPARE
]; /* reserved for future use */
154 __u32 d_magic2
; /* the magic number (again) */
155 __u16 d_checksum
; /* xor of data incl. partitions */
157 /* filesystem and partition information: */
158 __u16 d_npartitions
; /* number of partitions in following */
159 __u32 d_bbsize
; /* size of boot area at sn0, bytes */
160 __u32 d_sbsize
; /* max size of fs superblock, bytes */
161 struct bsd_partition
{ /* the partition table */
162 __u32 p_size
; /* number of sectors in partition */
163 __u32 p_offset
; /* starting sector */
164 __u32 p_fsize
; /* filesystem basic fragment size */
165 __u8 p_fstype
; /* filesystem type, see below */
166 __u8 p_frag
; /* filesystem fragments per block */
167 __u16 p_cpg
; /* filesystem cylinders per group */
168 } d_partitions
[BSD_MAXPARTITIONS
]; /* actually may be more */
171 #endif /* CONFIG_BSD_DISKLABEL */
173 #ifdef CONFIG_UNIXWARE_DISKLABEL
175 * Unixware slices support by Andrzej Krzysztofowicz <ankry@mif.pg.gda.pl>
176 * and Krzysztof G. Baranowski <kgb@knm.org.pl>
179 #define UNIXWARE_PARTITION 0x63 /* Partition ID, same as */
180 /* GNU_HURD and SCO Unix */
181 #define UNIXWARE_DISKMAGIC (0xCA5E600DUL) /* The disk magic number */
182 #define UNIXWARE_DISKMAGIC2 (0x600DDEEEUL) /* The slice table magic nr */
183 #define UNIXWARE_NUMSLICE 16
184 #define UNIXWARE_FS_UNUSED 0 /* Unused slice entry ID */
186 struct unixware_slice
{
187 __u16 s_label
; /* label */
188 __u16 s_flags
; /* permission flags */
189 __u32 start_sect
; /* starting sector */
190 __u32 nr_sects
; /* number of sectors in slice */
193 struct unixware_disklabel
{
194 __u32 d_type
; /* drive type */
195 __u32 d_magic
; /* the magic number */
196 __u32 d_version
; /* version number */
197 char d_serial
[12]; /* serial number of the device */
198 __u32 d_ncylinders
; /* # of data cylinders per device */
199 __u32 d_ntracks
; /* # of tracks per cylinder */
200 __u32 d_nsectors
; /* # of data sectors per track */
201 __u32 d_secsize
; /* # of bytes per sector */
202 __u32 d_part_start
; /* # of first sector of this partition */
203 __u32 d_unknown1
[12]; /* ? */
204 __u32 d_alt_tbl
; /* byte offset of alternate table */
205 __u32 d_alt_len
; /* byte length of alternate table */
206 __u32 d_phys_cyl
; /* # of physical cylinders per device */
207 __u32 d_phys_trk
; /* # of physical tracks per cylinder */
208 __u32 d_phys_sec
; /* # of physical sectors per track */
209 __u32 d_phys_bytes
; /* # of physical bytes per sector */
210 __u32 d_unknown2
; /* ? */
211 __u32 d_unknown3
; /* ? */
212 __u32 d_pad
[8]; /* pad */
214 struct unixware_vtoc
{
215 __u32 v_magic
; /* the magic number */
216 __u32 v_version
; /* version number */
217 char v_name
[8]; /* volume name */
218 __u16 v_nslices
; /* # of slices */
219 __u16 v_unknown1
; /* ? */
220 __u32 v_reserved
[10]; /* reserved */
221 struct unixware_slice
222 v_slice
[UNIXWARE_NUMSLICE
]; /* slice headers */
227 #endif /* CONFIG_UNIXWARE_DISKLABEL */
230 extern struct gendisk
*gendisk_head
; /* linked list of disks */
232 char *disk_name (struct gendisk
*hd
, int minor
, char *buf
);
234 int get_hardsect_size(kdev_t dev
);