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