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