1 #ifndef _LINUX_GENHD_H
2 #define _LINUX_GENHD_H
3
4 /*
5 * genhd.h Copyright (C) 1992 Drew Eckhardt
6 * Generic hard disk header file by
7 * Drew Eckhardt
8 *
9 * <drew@colorado.edu>
10 */
11
12 #include <linux/config.h>
13
14 #define CONFIG_MSDOS_PARTITION 1
15
16 #ifdef __alpha__
17 #define CONFIG_OSF_PARTITION 1
18 #endif
19
20 #if defined(__sparc__) || defined(CONFIG_SMD_DISKLABEL)
21 #define CONFIG_SUN_PARTITION 1
22 #endif
23
24 /* These two have identical behaviour; use the second one if DOS fdisk gets
25 confused about extended/logical partitions starting past cylinder 1023. */
26 #define DOS_EXTENDED_PARTITION 5
27 #define LINUX_EXTENDED_PARTITION 0x85
28
29 #define DM6_PARTITION 0x54 /* has DDO: use xlated geom & offset */
30 #define EZD_PARTITION 0x55 /* EZ-DRIVE: same as DM6 (we think) */
31 #define DM6_AUX1PARTITION 0x51 /* no DDO: use xlated geom */
32 #define DM6_AUX3PARTITION 0x53 /* no DDO: use xlated geom */
33
34 struct partition {
35 unsigned char boot_ind; /* 0x80 - active */
36 unsigned char head; /* starting head */
37 unsigned char sector; /* starting sector */
38 unsigned char cyl; /* starting cylinder */
39 unsigned char sys_ind; /* What partition type */
40 unsigned char end_head; /* end head */
41 unsigned char end_sector; /* end sector */
42 unsigned char end_cyl; /* end cylinder */
43 unsigned int start_sect; /* starting sector counting from 0 */
44 unsigned int nr_sects; /* nr of sectors in partition */
45 };
46
47 struct hd_struct {
48 long start_sect;
49 long nr_sects;
50 };
51
52 struct gendisk {
53 int major; /* major number of driver */
54 const char *major_name; /* name of major driver */
55 int minor_shift; /* number of times minor is shifted to
56 get real minor */
57 int max_p; /* maximum partitions per device */
58 int max_nr; /* maximum number of real devices */
59
60 void (*init)(struct gendisk *); /* Initialization called before we do our thing */
61 struct hd_struct *part; /* partition table */
62 int *sizes; /* device size in blocks, copied to blk_size[] */
63 int nr_real; /* number of real devices */
64
65 void *real_devices; /* internal use */
66 struct gendisk *next;
67 };
68
69 #ifdef CONFIG_BSD_DISKLABEL
70 /*
71 * BSD disklabel support by Yossi Gottlieb <yogo@math.tau.ac.il>
72 */
73
74 #define BSD_PARTITION 0xa5 /* Partition ID */
75
76 #define BSD_DISKMAGIC (0x82564557UL) /* The disk magic number */
77 #define BSD_MAXPARTITIONS 8
78 #define BSD_FS_UNUSED 0 /* disklabel unused partition entry ID */
79 struct bsd_disklabel {
80 __u32 d_magic; /* the magic number */
81 __s16 d_type; /* drive type */
82 __s16 d_subtype; /* controller/d_type specific */
83 char d_typename[16]; /* type name, e.g. "eagle" */
84 char d_packname[16]; /* pack identifier */
85 __u32 d_secsize; /* # of bytes per sector */
86 __u32 d_nsectors; /* # of data sectors per track */
87 __u32 d_ntracks; /* # of tracks per cylinder */
88 __u32 d_ncylinders; /* # of data cylinders per unit */
89 __u32 d_secpercyl; /* # of data sectors per cylinder */
90 __u32 d_secperunit; /* # of data sectors per unit */
91 __u16 d_sparespertrack; /* # of spare sectors per track */
92 __u16 d_sparespercyl; /* # of spare sectors per cylinder */
93 __u32 d_acylinders; /* # of alt. cylinders per unit */
94 __u16 d_rpm; /* rotational speed */
95 __u16 d_interleave; /* hardware sector interleave */
96 __u16 d_trackskew; /* sector 0 skew, per track */
97 __u16 d_cylskew; /* sector 0 skew, per cylinder */
98 __u32 d_headswitch; /* head switch time, usec */
99 __u32 d_trkseek; /* track-to-track seek, usec */
100 __u32 d_flags; /* generic flags */
101 #define NDDATA 5
102 __u32 d_drivedata[NDDATA]; /* drive-type specific information */
103 #define NSPARE 5
104 __u32 d_spare[NSPARE]; /* reserved for future use */
105 __u32 d_magic2; /* the magic number (again) */
106 __u16 d_checksum; /* xor of data incl. partitions */
107
108 /* filesystem and partition information: */
109 __u16 d_npartitions; /* number of partitions in following */
110 __u32 d_bbsize; /* size of boot area at sn0, bytes */
111 __u32 d_sbsize; /* max size of fs superblock, bytes */
112 struct bsd_partition { /* the partition table */
113 __u32 p_size; /* number of sectors in partition */
114 __u32 p_offset; /* starting sector */
115 __u32 p_fsize; /* filesystem basic fragment size */
116 __u8 p_fstype; /* filesystem type, see below */
117 __u8 p_frag; /* filesystem fragments per block */
118 __u16 p_cpg; /* filesystem cylinders per group */
119 } d_partitions[BSD_MAXPARTITIONS]; /* actually may be more */
120 };
121
122 #endif /* CONFIG_BSD_DISKLABEL */
123
124 extern struct gendisk *gendisk_head; /* linked list of disks */
125
126 /*
127 * disk_name() is used by genhd.c and md.c.
128 * It formats the devicename of the indicated disk
129 * into the supplied buffer, and returns a pointer
130 * to that same buffer (for convenience).
131 */
132 char *disk_name (struct gendisk *hd, int minor, char *buf);
133
134 #endif