| [2] | 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/types.h> |
|---|
| 13 | #include <linux/major.h> |
|---|
| 14 | #include <linux/fs.h> |
|---|
| 15 | |
|---|
| 16 | enum { |
|---|
| 17 | /* These three have identical behaviour; use the second one if DOS FDISK gets |
|---|
| 18 | confused about extended/logical partitions starting past cylinder 1023. */ |
|---|
| 19 | DOS_EXTENDED_PARTITION = 5, |
|---|
| 20 | LINUX_EXTENDED_PARTITION = 0x85, |
|---|
| 21 | WIN98_EXTENDED_PARTITION = 0x0f, |
|---|
| 22 | |
|---|
| 23 | LINUX_SWAP_PARTITION = 0x82, |
|---|
| 24 | LINUX_RAID_PARTITION = 0xfd, /* autodetect RAID partition */ |
|---|
| 25 | |
|---|
| 26 | SOLARIS_X86_PARTITION = LINUX_SWAP_PARTITION, |
|---|
| 27 | NEW_SOLARIS_X86_PARTITION = 0xbf, |
|---|
| 28 | |
|---|
| 29 | DM6_AUX1PARTITION = 0x51, /* no DDO: use xlated geom */ |
|---|
| 30 | DM6_AUX3PARTITION = 0x53, /* no DDO: use xlated geom */ |
|---|
| 31 | DM6_PARTITION = 0x54, /* has DDO: use xlated geom & offset */ |
|---|
| 32 | EZD_PARTITION = 0x55, /* EZ-DRIVE */ |
|---|
| 33 | |
|---|
| 34 | FREEBSD_PARTITION = 0xa5, /* FreeBSD Partition ID */ |
|---|
| 35 | OPENBSD_PARTITION = 0xa6, /* OpenBSD Partition ID */ |
|---|
| 36 | NETBSD_PARTITION = 0xa9, /* NetBSD Partition ID */ |
|---|
| 37 | BSDI_PARTITION = 0xb7, /* BSDI Partition ID */ |
|---|
| 38 | MINIX_PARTITION = 0x81, /* Minix Partition ID */ |
|---|
| 39 | UNIXWARE_PARTITION = 0x63 /* Same as GNU_HURD and SCO Unix */ |
|---|
| 40 | }; |
|---|
| 41 | |
|---|
| 42 | struct partition { |
|---|
| 43 | unsigned char boot_ind; /* 0x80 - active */ |
|---|
| 44 | unsigned char head; /* starting head */ |
|---|
| 45 | unsigned char sector; /* starting sector */ |
|---|
| 46 | unsigned char cyl; /* starting cylinder */ |
|---|
| 47 | unsigned char sys_ind; /* What partition type */ |
|---|
| 48 | unsigned char end_head; /* end head */ |
|---|
| 49 | unsigned char end_sector; /* end sector */ |
|---|
| 50 | unsigned char end_cyl; /* end cylinder */ |
|---|
| 51 | unsigned int start_sect; /* starting sector counting from 0 */ |
|---|
| 52 | unsigned int nr_sects; /* nr of sectors in partition */ |
|---|
| 53 | } __attribute__((packed)); |
|---|
| 54 | |
|---|
| 55 | #ifdef CONFIG_SOLARIS_X86_PARTITION |
|---|
| 56 | |
|---|
| 57 | #define SOLARIS_X86_NUMSLICE 8 |
|---|
| 58 | #define SOLARIS_X86_VTOC_SANE (0x600DDEEEUL) |
|---|
| 59 | |
|---|
| 60 | struct solaris_x86_slice { |
|---|
| 61 | __le16 s_tag; /* ID tag of partition */ |
|---|
| 62 | __le16 s_flag; /* permission flags */ |
|---|
| 63 | __le32 s_start; /* start sector no of partition */ |
|---|
| 64 | __le32 s_size; /* # of blocks in partition */ |
|---|
| 65 | }; |
|---|
| 66 | |
|---|
| 67 | struct solaris_x86_vtoc { |
|---|
| 68 | unsigned int v_bootinfo[3]; /* info needed by mboot (unsupported) */ |
|---|
| 69 | __le32 v_sanity; /* to verify vtoc sanity */ |
|---|
| 70 | __le32 v_version; /* layout version */ |
|---|
| 71 | char v_volume[8]; /* volume name */ |
|---|
| 72 | __le16 v_sectorsz; /* sector size in bytes */ |
|---|
| 73 | __le16 v_nparts; /* number of partitions */ |
|---|
| 74 | unsigned int v_reserved[10]; /* free space */ |
|---|
| 75 | struct solaris_x86_slice |
|---|
| 76 | v_slice[SOLARIS_X86_NUMSLICE]; /* slice headers */ |
|---|
| 77 | unsigned int timestamp[SOLARIS_X86_NUMSLICE]; /* timestamp (unsupported) */ |
|---|
| 78 | char v_asciilabel[128]; /* for compatibility */ |
|---|
| 79 | }; |
|---|
| 80 | |
|---|
| 81 | #endif /* CONFIG_SOLARIS_X86_PARTITION */ |
|---|
| 82 | |
|---|
| 83 | #ifdef CONFIG_BSD_DISKLABEL |
|---|
| 84 | /* |
|---|
| 85 | * BSD disklabel support by Yossi Gottlieb <yogo@math.tau.ac.il> |
|---|
| 86 | * updated by Marc Espie <Marc.Espie@openbsd.org> |
|---|
| 87 | */ |
|---|
| 88 | |
|---|
| 89 | /* check against BSD src/sys/sys/disklabel.h for consistency */ |
|---|
| 90 | |
|---|
| 91 | #define BSD_DISKMAGIC (0x82564557UL) /* The disk magic number */ |
|---|
| 92 | #define BSD_MAXPARTITIONS 16 |
|---|
| 93 | #define OPENBSD_MAXPARTITIONS 16 |
|---|
| 94 | #define BSD_FS_UNUSED 0 /* disklabel unused partition entry ID */ |
|---|
| 95 | struct bsd_disklabel { |
|---|
| 96 | __le32 d_magic; /* the magic number */ |
|---|
| 97 | __s16 d_type; /* drive type */ |
|---|
| 98 | __s16 d_subtype; /* controller/d_type specific */ |
|---|
| 99 | char d_typename[16]; /* type name, e.g. "eagle" */ |
|---|
| 100 | char d_packname[16]; /* pack identifier */ |
|---|
| 101 | __u32 d_secsize; /* # of bytes per sector */ |
|---|
| 102 | __u32 d_nsectors; /* # of data sectors per track */ |
|---|
| 103 | __u32 d_ntracks; /* # of tracks per cylinder */ |
|---|
| 104 | __u32 d_ncylinders; /* # of data cylinders per unit */ |
|---|
| 105 | __u32 d_secpercyl; /* # of data sectors per cylinder */ |
|---|
| 106 | __u32 d_secperunit; /* # of data sectors per unit */ |
|---|
| 107 | __u16 d_sparespertrack; /* # of spare sectors per track */ |
|---|
| 108 | __u16 d_sparespercyl; /* # of spare sectors per cylinder */ |
|---|
| 109 | __u32 d_acylinders; /* # of alt. cylinders per unit */ |
|---|
| 110 | __u16 d_rpm; /* rotational speed */ |
|---|
| 111 | __u16 d_interleave; /* hardware sector interleave */ |
|---|
| 112 | __u16 d_trackskew; /* sector 0 skew, per track */ |
|---|
| 113 | __u16 d_cylskew; /* sector 0 skew, per cylinder */ |
|---|
| 114 | __u32 d_headswitch; /* head switch time, usec */ |
|---|
| 115 | __u32 d_trkseek; /* track-to-track seek, usec */ |
|---|
| 116 | __u32 d_flags; /* generic flags */ |
|---|
| 117 | #define NDDATA 5 |
|---|
| 118 | __u32 d_drivedata[NDDATA]; /* drive-type specific information */ |
|---|
| 119 | #define NSPARE 5 |
|---|
| 120 | __u32 d_spare[NSPARE]; /* reserved for future use */ |
|---|
| 121 | __le32 d_magic2; /* the magic number (again) */ |
|---|
| 122 | __le16 d_checksum; /* xor of data incl. partitions */ |
|---|
| 123 | |
|---|
| 124 | /* filesystem and partition information: */ |
|---|
| 125 | __le16 d_npartitions; /* number of partitions in following */ |
|---|
| 126 | __le32 d_bbsize; /* size of boot area at sn0, bytes */ |
|---|
| 127 | __le32 d_sbsize; /* max size of fs superblock, bytes */ |
|---|
| 128 | struct bsd_partition { /* the partition table */ |
|---|
| 129 | __le32 p_size; /* number of sectors in partition */ |
|---|
| 130 | __le32 p_offset; /* starting sector */ |
|---|
| 131 | __le32 p_fsize; /* filesystem basic fragment size */ |
|---|
| 132 | __u8 p_fstype; /* filesystem type, see below */ |
|---|
| 133 | __u8 p_frag; /* filesystem fragments per block */ |
|---|
| 134 | __le16 p_cpg; /* filesystem cylinders per group */ |
|---|
| 135 | } d_partitions[BSD_MAXPARTITIONS]; /* actually may be more */ |
|---|
| 136 | }; |
|---|
| 137 | |
|---|
| 138 | #endif /* CONFIG_BSD_DISKLABEL */ |
|---|
| 139 | |
|---|
| 140 | #ifdef CONFIG_UNIXWARE_DISKLABEL |
|---|
| 141 | /* |
|---|
| 142 | * Unixware slices support by Andrzej Krzysztofowicz <ankry@mif.pg.gda.pl> |
|---|
| 143 | * and Krzysztof G. Baranowski <kgb@knm.org.pl> |
|---|
| 144 | */ |
|---|
| 145 | |
|---|
| 146 | #define UNIXWARE_DISKMAGIC (0xCA5E600DUL) /* The disk magic number */ |
|---|
| 147 | #define UNIXWARE_DISKMAGIC2 (0x600DDEEEUL) /* The slice table magic nr */ |
|---|
| 148 | #define UNIXWARE_NUMSLICE 16 |
|---|
| 149 | #define UNIXWARE_FS_UNUSED 0 /* Unused slice entry ID */ |
|---|
| 150 | |
|---|
| 151 | struct unixware_slice { |
|---|
| 152 | __le16 s_label; /* label */ |
|---|
| 153 | __le16 s_flags; /* permission flags */ |
|---|
| 154 | __le32 start_sect; /* starting sector */ |
|---|
| 155 | __le32 nr_sects; /* number of sectors in slice */ |
|---|
| 156 | }; |
|---|
| 157 | |
|---|
| 158 | struct unixware_disklabel { |
|---|
| 159 | __le32 d_type; /* drive type */ |
|---|
| 160 | __le32 d_magic; /* the magic number */ |
|---|
| 161 | __le32 d_version; /* version number */ |
|---|
| 162 | char d_serial[12]; /* serial number of the device */ |
|---|
| 163 | __le32 d_ncylinders; /* # of data cylinders per device */ |
|---|
| 164 | __le32 d_ntracks; /* # of tracks per cylinder */ |
|---|
| 165 | __le32 d_nsectors; /* # of data sectors per track */ |
|---|
| 166 | __le32 d_secsize; /* # of bytes per sector */ |
|---|
| 167 | __le32 d_part_start; /* # of first sector of this partition */ |
|---|
| 168 | __le32 d_unknown1[12]; /* ? */ |
|---|
| 169 | __le32 d_alt_tbl; /* byte offset of alternate table */ |
|---|
| 170 | __le32 d_alt_len; /* byte length of alternate table */ |
|---|
| 171 | __le32 d_phys_cyl; /* # of physical cylinders per device */ |
|---|
| 172 | __le32 d_phys_trk; /* # of physical tracks per cylinder */ |
|---|
| 173 | __le32 d_phys_sec; /* # of physical sectors per track */ |
|---|
| 174 | __le32 d_phys_bytes; /* # of physical bytes per sector */ |
|---|
| 175 | __le32 d_unknown2; /* ? */ |
|---|
| 176 | __le32 d_unknown3; /* ? */ |
|---|
| 177 | __le32 d_pad[8]; /* pad */ |
|---|
| 178 | |
|---|
| 179 | struct unixware_vtoc { |
|---|
| 180 | __le32 v_magic; /* the magic number */ |
|---|
| 181 | __le32 v_version; /* version number */ |
|---|
| 182 | char v_name[8]; /* volume name */ |
|---|
| 183 | __le16 v_nslices; /* # of slices */ |
|---|
| 184 | __le16 v_unknown1; /* ? */ |
|---|
| 185 | __le32 v_reserved[10]; /* reserved */ |
|---|
| 186 | struct unixware_slice |
|---|
| 187 | v_slice[UNIXWARE_NUMSLICE]; /* slice headers */ |
|---|
| 188 | } vtoc; |
|---|
| 189 | |
|---|
| 190 | }; /* 408 */ |
|---|
| 191 | |
|---|
| 192 | #endif /* CONFIG_UNIXWARE_DISKLABEL */ |
|---|
| 193 | |
|---|
| 194 | #ifdef CONFIG_MINIX_SUBPARTITION |
|---|
| 195 | # define MINIX_NR_SUBPARTITIONS 4 |
|---|
| 196 | #endif /* CONFIG_MINIX_SUBPARTITION */ |
|---|
| 197 | |
|---|
| 198 | #endif |
|---|