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