Commit 9bcf4717 authored by Alexander Viro's avatar Alexander Viro Committed by Linus Torvalds

[PATCH] fs/partitions endianness annotations

Signed-off-by: default avatarAl Viro <viro@parcelfarce.linux.org.uk>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 694763a3
...@@ -53,16 +53,16 @@ adfs_partition(struct parsed_partitions *state, char *name, char *data, ...@@ -53,16 +53,16 @@ adfs_partition(struct parsed_partitions *state, char *name, char *data,
#ifdef CONFIG_ACORN_PARTITION_RISCIX #ifdef CONFIG_ACORN_PARTITION_RISCIX
struct riscix_part { struct riscix_part {
__u32 start; __le32 start;
__u32 length; __le32 length;
__u32 one; __le32 one;
char name[16]; char name[16];
}; };
struct riscix_record { struct riscix_record {
__u32 magic; __le32 magic;
#define RISCIX_MAGIC cpu_to_le32(0x4a657320) #define RISCIX_MAGIC cpu_to_le32(0x4a657320)
__u32 date; __le32 date;
struct riscix_part part[8]; struct riscix_part part[8];
}; };
...@@ -111,9 +111,9 @@ riscix_partition(struct parsed_partitions *state, struct block_device *bdev, ...@@ -111,9 +111,9 @@ riscix_partition(struct parsed_partitions *state, struct block_device *bdev,
#define LINUX_SWAP_MAGIC 0xdeafab1e #define LINUX_SWAP_MAGIC 0xdeafab1e
struct linux_part { struct linux_part {
__u32 magic; __le32 magic;
__u32 start_sect; __le32 start_sect;
__u32 nr_sects; __le32 nr_sects;
}; };
static int static int
...@@ -306,8 +306,8 @@ adfspart_check_ADFS(struct parsed_partitions *state, struct block_device *bdev) ...@@ -306,8 +306,8 @@ adfspart_check_ADFS(struct parsed_partitions *state, struct block_device *bdev)
#ifdef CONFIG_ACORN_PARTITION_ICS #ifdef CONFIG_ACORN_PARTITION_ICS
struct ics_part { struct ics_part {
__u32 start; __le32 start;
__s32 size; __le32 size;
}; };
static int adfspart_check_ICSLinux(struct block_device *bdev, unsigned long block) static int adfspart_check_ICSLinux(struct block_device *bdev, unsigned long block)
...@@ -336,7 +336,7 @@ static inline int valid_ics_sector(const unsigned char *data) ...@@ -336,7 +336,7 @@ static inline int valid_ics_sector(const unsigned char *data)
for (i = 0, sum = 0x50617274; i < 508; i++) for (i = 0, sum = 0x50617274; i < 508; i++)
sum += data[i]; sum += data[i];
sum -= le32_to_cpu(*(__u32 *)(&data[508])); sum -= le32_to_cpu(*(__le32 *)(&data[508]));
return sum == 0; return sum == 0;
} }
...@@ -412,11 +412,11 @@ adfspart_check_ICS(struct parsed_partitions *state, struct block_device *bdev) ...@@ -412,11 +412,11 @@ adfspart_check_ICS(struct parsed_partitions *state, struct block_device *bdev)
#ifdef CONFIG_ACORN_PARTITION_POWERTEC #ifdef CONFIG_ACORN_PARTITION_POWERTEC
struct ptec_part { struct ptec_part {
__u32 unused1; __le32 unused1;
__u32 unused2; __le32 unused2;
__u32 start; __le32 start;
__u32 size; __le32 size;
__u32 unused5; __le32 unused5;
char type[8]; char type[8];
}; };
...@@ -486,10 +486,10 @@ adfspart_check_POWERTEC(struct parsed_partitions *state, struct block_device *bd ...@@ -486,10 +486,10 @@ adfspart_check_POWERTEC(struct parsed_partitions *state, struct block_device *bd
struct eesox_part { struct eesox_part {
char magic[6]; char magic[6];
char name[10]; char name[10];
u32 start; __le32 start;
u32 unused6; __le32 unused6;
u32 unused7; __le32 unused7;
u32 unused8; __le32 unused8;
}; };
/* /*
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
#include "amiga.h" #include "amiga.h"
static __inline__ u32 static __inline__ u32
checksum_block(u32 *m, int size) checksum_block(__be32 *m, int size)
{ {
u32 sum = 0; u32 sum = 0;
...@@ -45,17 +45,17 @@ amiga_partition(struct parsed_partitions *state, struct block_device *bdev) ...@@ -45,17 +45,17 @@ amiga_partition(struct parsed_partitions *state, struct block_device *bdev)
bdevname(bdev, b), blk); bdevname(bdev, b), blk);
goto rdb_done; goto rdb_done;
} }
if (*(u32 *)data != cpu_to_be32(IDNAME_RIGIDDISK)) if (*(__be32 *)data != cpu_to_be32(IDNAME_RIGIDDISK))
continue; continue;
rdb = (struct RigidDiskBlock *)data; rdb = (struct RigidDiskBlock *)data;
if (checksum_block((u32 *)data, be32_to_cpu(rdb->rdb_SummedLongs) & 0x7F) == 0) if (checksum_block((__be32 *)data, be32_to_cpu(rdb->rdb_SummedLongs) & 0x7F) == 0)
break; break;
/* Try again with 0xdc..0xdf zeroed, Windows might have /* Try again with 0xdc..0xdf zeroed, Windows might have
* trashed it. * trashed it.
*/ */
*(u32 *)(data+0xdc) = 0; *(__be32 *)(data+0xdc) = 0;
if (checksum_block((u32 *)data, if (checksum_block((__be32 *)data,
be32_to_cpu(rdb->rdb_SummedLongs) & 0x7F)==0) { be32_to_cpu(rdb->rdb_SummedLongs) & 0x7F)==0) {
printk("Warning: Trashed word at 0xd0 in block %d " printk("Warning: Trashed word at 0xd0 in block %d "
"ignored in checksum calculation\n",blk); "ignored in checksum calculation\n",blk);
...@@ -85,7 +85,7 @@ amiga_partition(struct parsed_partitions *state, struct block_device *bdev) ...@@ -85,7 +85,7 @@ amiga_partition(struct parsed_partitions *state, struct block_device *bdev)
blk = be32_to_cpu(pb->pb_Next); blk = be32_to_cpu(pb->pb_Next);
if (pb->pb_ID != cpu_to_be32(IDNAME_PARTITION)) if (pb->pb_ID != cpu_to_be32(IDNAME_PARTITION))
continue; continue;
if (checksum_block((u32 *)pb, be32_to_cpu(pb->pb_SummedLongs) & 0x7F) != 0 ) if (checksum_block((__be32 *)pb, be32_to_cpu(pb->pb_SummedLongs) & 0x7F) != 0 )
continue; continue;
/* Tell Kernel about it */ /* Tell Kernel about it */
...@@ -105,7 +105,7 @@ amiga_partition(struct parsed_partitions *state, struct block_device *bdev) ...@@ -105,7 +105,7 @@ amiga_partition(struct parsed_partitions *state, struct block_device *bdev)
{ {
/* Be even more informative to aid mounting */ /* Be even more informative to aid mounting */
char dostype[4]; char dostype[4];
u32 *dt = (u32 *)dostype; __be32 *dt = (__be32 *)dostype;
*dt = pb->pb_Environment[16]; *dt = pb->pb_Environment[16];
if (dostype[3] < ' ') if (dostype[3] < ' ')
printk(" (%c%c%c^%c)", printk(" (%c%c%c^%c)",
......
...@@ -15,8 +15,8 @@ struct partition_info ...@@ -15,8 +15,8 @@ struct partition_info
{ {
u8 flg; /* bit 0: active; bit 7: bootable */ u8 flg; /* bit 0: active; bit 7: bootable */
char id[3]; /* "GEM", "BGM", "XGM", or other */ char id[3]; /* "GEM", "BGM", "XGM", or other */
u32 st; /* start of partition */ __be32 st; /* start of partition */
u32 siz; /* length of partition */ __be32 siz; /* length of partition */
}; };
struct rootsector struct rootsector
......
...@@ -66,20 +66,20 @@ ...@@ -66,20 +66,20 @@
0xa2, 0x3c, 0x23, 0x8f, 0x2a, 0x3d, 0xf9, 0x28) 0xa2, 0x3c, 0x23, 0x8f, 0x2a, 0x3d, 0xf9, 0x28)
typedef struct _gpt_header { typedef struct _gpt_header {
u64 signature; __le64 signature;
u32 revision; __le32 revision;
u32 header_size; __le32 header_size;
u32 header_crc32; __le32 header_crc32;
u32 reserved1; __le32 reserved1;
u64 my_lba; __le64 my_lba;
u64 alternate_lba; __le64 alternate_lba;
u64 first_usable_lba; __le64 first_usable_lba;
u64 last_usable_lba; __le64 last_usable_lba;
efi_guid_t disk_guid; efi_guid_t disk_guid;
u64 partition_entry_lba; __le64 partition_entry_lba;
u32 num_partition_entries; __le32 num_partition_entries;
u32 sizeof_partition_entry; __le32 sizeof_partition_entry;
u32 partition_entry_array_crc32; __le32 partition_entry_array_crc32;
u8 reserved2[GPT_BLOCK_SIZE - 92]; u8 reserved2[GPT_BLOCK_SIZE - 92];
} __attribute__ ((packed)) gpt_header; } __attribute__ ((packed)) gpt_header;
...@@ -92,18 +92,18 @@ typedef struct _gpt_entry_attributes { ...@@ -92,18 +92,18 @@ typedef struct _gpt_entry_attributes {
typedef struct _gpt_entry { typedef struct _gpt_entry {
efi_guid_t partition_type_guid; efi_guid_t partition_type_guid;
efi_guid_t unique_partition_guid; efi_guid_t unique_partition_guid;
u64 starting_lba; __le64 starting_lba;
u64 ending_lba; __le64 ending_lba;
gpt_entry_attributes attributes; gpt_entry_attributes attributes;
efi_char16_t partition_name[72 / sizeof (efi_char16_t)]; efi_char16_t partition_name[72 / sizeof (efi_char16_t)];
} __attribute__ ((packed)) gpt_entry; } __attribute__ ((packed)) gpt_entry;
typedef struct _legacy_mbr { typedef struct _legacy_mbr {
u8 boot_code[440]; u8 boot_code[440];
u32 unique_mbr_signature; __le32 unique_mbr_signature;
u16 unknown; __le16 unknown;
struct partition partition_record[4]; struct partition partition_record[4];
u16 signature; __le16 signature;
} __attribute__ ((packed)) legacy_mbr; } __attribute__ ((packed)) legacy_mbr;
/* Functions */ /* Functions */
......
...@@ -566,7 +566,7 @@ static BOOL ldm_validate_partition_table (struct block_device *bdev) ...@@ -566,7 +566,7 @@ static BOOL ldm_validate_partition_table (struct block_device *bdev)
return FALSE; return FALSE;
} }
if (*(u16*) (data + 0x01FE) != cpu_to_le16 (MSDOS_LABEL_MAGIC)) if (*(__le16*) (data + 0x01FE) != cpu_to_le16 (MSDOS_LABEL_MAGIC))
goto out; goto out;
p = (struct partition*)(data + 0x01BE); p = (struct partition*)(data + 0x01BE);
......
...@@ -99,9 +99,9 @@ struct parsed_partitions; ...@@ -99,9 +99,9 @@ struct parsed_partitions;
#define TOC_BITMAP2 "log" /* bitmaps in the TOCBLOCK. */ #define TOC_BITMAP2 "log" /* bitmaps in the TOCBLOCK. */
/* Most numbers we deal with are big-endian and won't be aligned. */ /* Most numbers we deal with are big-endian and won't be aligned. */
#define BE16(x) ((u16)be16_to_cpu(get_unaligned((u16*)(x)))) #define BE16(x) ((u16)be16_to_cpu(get_unaligned((__be16*)(x))))
#define BE32(x) ((u32)be32_to_cpu(get_unaligned((u32*)(x)))) #define BE32(x) ((u32)be32_to_cpu(get_unaligned((__be32*)(x))))
#define BE64(x) ((u64)be64_to_cpu(get_unaligned((u64*)(x)))) #define BE64(x) ((u64)be64_to_cpu(get_unaligned((__be64*)(x))))
/* Borrowed from msdos.c */ /* Borrowed from msdos.c */
#define SYS_IND(p) (get_unaligned(&(p)->sys_ind)) #define SYS_IND(p) (get_unaligned(&(p)->sys_ind))
......
...@@ -8,23 +8,23 @@ ...@@ -8,23 +8,23 @@
#define APPLE_AUX_TYPE "Apple_UNIX_SVR2" #define APPLE_AUX_TYPE "Apple_UNIX_SVR2"
struct mac_partition { struct mac_partition {
__u16 signature; /* expected to be MAC_PARTITION_MAGIC */ __be16 signature; /* expected to be MAC_PARTITION_MAGIC */
__u16 res1; __be16 res1;
__u32 map_count; /* # blocks in partition map */ __be32 map_count; /* # blocks in partition map */
__u32 start_block; /* absolute starting block # of partition */ __be32 start_block; /* absolute starting block # of partition */
__u32 block_count; /* number of blocks in partition */ __be32 block_count; /* number of blocks in partition */
char name[32]; /* partition name */ char name[32]; /* partition name */
char type[32]; /* string type description */ char type[32]; /* string type description */
__u32 data_start; /* rel block # of first data block */ __be32 data_start; /* rel block # of first data block */
__u32 data_count; /* number of data blocks */ __be32 data_count; /* number of data blocks */
__u32 status; /* partition status bits */ __be32 status; /* partition status bits */
__u32 boot_start; __be32 boot_start;
__u32 boot_size; __be32 boot_size;
__u32 boot_load; __be32 boot_load;
__u32 boot_load2; __be32 boot_load2;
__u32 boot_entry; __be32 boot_entry;
__u32 boot_entry2; __be32 boot_entry2;
__u32 boot_cksum; __be32 boot_cksum;
char processor[16]; /* identifies ISA of boot */ char processor[16]; /* identifies ISA of boot */
/* there is more stuff after this that we don't need */ /* there is more stuff after this that we don't need */
}; };
...@@ -35,9 +35,9 @@ struct mac_partition { ...@@ -35,9 +35,9 @@ struct mac_partition {
/* Driver descriptor structure, in block 0 */ /* Driver descriptor structure, in block 0 */
struct mac_driver_desc { struct mac_driver_desc {
__u16 signature; /* expected to be MAC_DRIVER_MAGIC */ __be16 signature; /* expected to be MAC_DRIVER_MAGIC */
__u16 block_size; __be16 block_size;
__u32 block_count; __be32 block_count;
/* ... more stuff */ /* ... more stuff */
}; };
......
...@@ -17,34 +17,34 @@ int osf_partition(struct parsed_partitions *state, struct block_device *bdev) ...@@ -17,34 +17,34 @@ int osf_partition(struct parsed_partitions *state, struct block_device *bdev)
Sector sect; Sector sect;
unsigned char *data; unsigned char *data;
struct disklabel { struct disklabel {
u32 d_magic; __le32 d_magic;
u16 d_type,d_subtype; __le16 d_type,d_subtype;
u8 d_typename[16]; u8 d_typename[16];
u8 d_packname[16]; u8 d_packname[16];
u32 d_secsize; __le32 d_secsize;
u32 d_nsectors; __le32 d_nsectors;
u32 d_ntracks; __le32 d_ntracks;
u32 d_ncylinders; __le32 d_ncylinders;
u32 d_secpercyl; __le32 d_secpercyl;
u32 d_secprtunit; __le32 d_secprtunit;
u16 d_sparespertrack; __le16 d_sparespertrack;
u16 d_sparespercyl; __le16 d_sparespercyl;
u32 d_acylinders; __le32 d_acylinders;
u16 d_rpm, d_interleave, d_trackskew, d_cylskew; __le16 d_rpm, d_interleave, d_trackskew, d_cylskew;
u32 d_headswitch, d_trkseek, d_flags; __le32 d_headswitch, d_trkseek, d_flags;
u32 d_drivedata[5]; __le32 d_drivedata[5];
u32 d_spare[5]; __le32 d_spare[5];
u32 d_magic2; __le32 d_magic2;
u16 d_checksum; __le16 d_checksum;
u16 d_npartitions; __le16 d_npartitions;
u32 d_bbsize, d_sbsize; __le32 d_bbsize, d_sbsize;
struct d_partition { struct d_partition {
u32 p_size; __le32 p_size;
u32 p_offset; __le32 p_offset;
u32 p_fsize; __le32 p_fsize;
u8 p_fstype; u8 p_fstype;
u8 p_frag; u8 p_frag;
u16 p_cpg; __le16 p_cpg;
} d_partitions[8]; } d_partitions[8];
} * label; } * label;
struct d_partition * partition; struct d_partition * partition;
......
...@@ -8,30 +8,32 @@ ...@@ -8,30 +8,32 @@
#include "sgi.h" #include "sgi.h"
struct sgi_disklabel { struct sgi_disklabel {
s32 magic_mushroom; /* Big fat spliff... */ __be32 magic_mushroom; /* Big fat spliff... */
s16 root_part_num; /* Root partition number */ __be16 root_part_num; /* Root partition number */
s16 swap_part_num; /* Swap partition number */ __be16 swap_part_num; /* Swap partition number */
s8 boot_file[16]; /* Name of boot file for ARCS */ s8 boot_file[16]; /* Name of boot file for ARCS */
u8 _unused0[48]; /* Device parameter useless crapola.. */ u8 _unused0[48]; /* Device parameter useless crapola.. */
struct sgi_volume { struct sgi_volume {
s8 name[8]; /* Name of volume */ s8 name[8]; /* Name of volume */
s32 block_num; /* Logical block number */ __be32 block_num; /* Logical block number */
s32 num_bytes; /* How big, in bytes */ __be32 num_bytes; /* How big, in bytes */
} volume[15]; } volume[15];
struct sgi_partition { struct sgi_partition {
u32 num_blocks; /* Size in logical blocks */ __be32 num_blocks; /* Size in logical blocks */
u32 first_block; /* First logical block */ __be32 first_block; /* First logical block */
s32 type; /* Type of this partition */ __be32 type; /* Type of this partition */
} partitions[16]; } partitions[16];
s32 csum; /* Disk label checksum */ __be32 csum; /* Disk label checksum */
s32 _unused1; /* Padding */ __be32 _unused1; /* Padding */
}; };
int sgi_partition(struct parsed_partitions *state, struct block_device *bdev) int sgi_partition(struct parsed_partitions *state, struct block_device *bdev)
{ {
int i, csum, magic; int i, csum;
__be32 magic;
int slot = 1; int slot = 1;
unsigned int *ui, start, blocks, cs; unsigned int start, blocks;
__be32 *ui, cs;
Sector sect; Sector sect;
struct sgi_disklabel *label; struct sgi_disklabel *label;
struct sgi_partition *p; struct sgi_partition *p;
...@@ -44,12 +46,12 @@ int sgi_partition(struct parsed_partitions *state, struct block_device *bdev) ...@@ -44,12 +46,12 @@ int sgi_partition(struct parsed_partitions *state, struct block_device *bdev)
magic = label->magic_mushroom; magic = label->magic_mushroom;
if(be32_to_cpu(magic) != SGI_LABEL_MAGIC) { if(be32_to_cpu(magic) != SGI_LABEL_MAGIC) {
/*printk("Dev %s SGI disklabel: bad magic %08x\n", /*printk("Dev %s SGI disklabel: bad magic %08x\n",
bdevname(bdev, b), magic);*/ bdevname(bdev, b), be32_to_cpu(magic));*/
put_dev_sector(sect); put_dev_sector(sect);
return 0; return 0;
} }
ui = ((unsigned int *) (label + 1)) - 1; ui = ((__be32 *) (label + 1)) - 1;
for(csum = 0; ui >= ((unsigned int *) label);) { for(csum = 0; ui >= ((__be32 *) label);) {
cs = *ui--; cs = *ui--;
csum += be32_to_cpu(cs); csum += be32_to_cpu(cs);
} }
......
...@@ -12,9 +12,10 @@ ...@@ -12,9 +12,10 @@
int sun_partition(struct parsed_partitions *state, struct block_device *bdev) int sun_partition(struct parsed_partitions *state, struct block_device *bdev)
{ {
int i, csum; int i;
__be16 csum;
int slot = 1; int slot = 1;
unsigned short *ush; __be16 *ush;
Sector sect; Sector sect;
struct sun_disklabel { struct sun_disklabel {
unsigned char info[128]; /* Informative text string */ unsigned char info[128]; /* Informative text string */
...@@ -26,22 +27,22 @@ int sun_partition(struct parsed_partitions *state, struct block_device *bdev) ...@@ -26,22 +27,22 @@ int sun_partition(struct parsed_partitions *state, struct block_device *bdev)
unsigned char flags; unsigned char flags;
} infos[8]; } infos[8];
unsigned char spare[246]; /* Boot information etc. */ unsigned char spare[246]; /* Boot information etc. */
unsigned short rspeed; /* Disk rotational speed */ __be16 rspeed; /* Disk rotational speed */
unsigned short pcylcount; /* Physical cylinder count */ __be16 pcylcount; /* Physical cylinder count */
unsigned short sparecyl; /* extra sects per cylinder */ __be16 sparecyl; /* extra sects per cylinder */
unsigned char spare2[4]; /* More magic... */ unsigned char spare2[4]; /* More magic... */
unsigned short ilfact; /* Interleave factor */ __be16 ilfact; /* Interleave factor */
unsigned short ncyl; /* Data cylinder count */ __be16 ncyl; /* Data cylinder count */
unsigned short nacyl; /* Alt. cylinder count */ __be16 nacyl; /* Alt. cylinder count */
unsigned short ntrks; /* Tracks per cylinder */ __be16 ntrks; /* Tracks per cylinder */
unsigned short nsect; /* Sectors per track */ __be16 nsect; /* Sectors per track */
unsigned char spare3[4]; /* Even more magic... */ unsigned char spare3[4]; /* Even more magic... */
struct sun_partition { struct sun_partition {
__u32 start_cylinder; __be32 start_cylinder;
__u32 num_sectors; __be32 num_sectors;
} partitions[8]; } partitions[8];
unsigned short magic; /* Magic number */ __be16 magic; /* Magic number */
unsigned short csum; /* Label xor'd checksum */ __be16 csum; /* Label xor'd checksum */
} * label; } * label;
struct sun_partition *p; struct sun_partition *p;
unsigned long spc; unsigned long spc;
...@@ -59,8 +60,8 @@ int sun_partition(struct parsed_partitions *state, struct block_device *bdev) ...@@ -59,8 +60,8 @@ int sun_partition(struct parsed_partitions *state, struct block_device *bdev)
return 0; return 0;
} }
/* Look at the checksum */ /* Look at the checksum */
ush = ((unsigned short *) (label+1)) - 1; ush = ((__be16 *) (label+1)) - 1;
for (csum = 0; ush >= ((unsigned short *) label);) for (csum = 0; ush >= ((__be16 *) label);)
csum ^= *ush--; csum ^= *ush--;
if (csum) { if (csum) {
printk("Dev %s Sun disklabel: Csum bad, label corrupted\n", printk("Dev %s Sun disklabel: Csum bad, label corrupted\n",
......
...@@ -42,6 +42,8 @@ enum { ...@@ -42,6 +42,8 @@ enum {
UNIXWARE_PARTITION = 0x63, /* Same as GNU_HURD and SCO Unix */ UNIXWARE_PARTITION = 0x63, /* Same as GNU_HURD and SCO Unix */
}; };
#ifndef __KERNEL__
struct partition { struct partition {
unsigned char boot_ind; /* 0x80 - active */ unsigned char boot_ind; /* 0x80 - active */
unsigned char head; /* starting head */ unsigned char head; /* starting head */
...@@ -55,7 +57,22 @@ struct partition { ...@@ -55,7 +57,22 @@ struct partition {
unsigned int nr_sects; /* nr of sectors in partition */ unsigned int nr_sects; /* nr of sectors in partition */
} __attribute__((packed)); } __attribute__((packed));
#endif
#ifdef __KERNEL__ #ifdef __KERNEL__
struct partition {
unsigned char boot_ind; /* 0x80 - active */
unsigned char head; /* starting head */
unsigned char sector; /* starting sector */
unsigned char cyl; /* starting cylinder */
unsigned char sys_ind; /* What partition type */
unsigned char end_head; /* end head */
unsigned char end_sector; /* end sector */
unsigned char end_cyl; /* end cylinder */
__le32 start_sect; /* starting sector counting from 0 */
__le32 nr_sects; /* nr of sectors in partition */
} __attribute__((packed));
struct hd_struct { struct hd_struct {
sector_t start_sect; sector_t start_sect;
sector_t nr_sects; sector_t nr_sects;
...@@ -218,19 +235,19 @@ static inline void set_capacity(struct gendisk *disk, sector_t size) ...@@ -218,19 +235,19 @@ static inline void set_capacity(struct gendisk *disk, sector_t size)
#define SOLARIS_X86_VTOC_SANE (0x600DDEEEUL) #define SOLARIS_X86_VTOC_SANE (0x600DDEEEUL)
struct solaris_x86_slice { struct solaris_x86_slice {
ushort s_tag; /* ID tag of partition */ __le16 s_tag; /* ID tag of partition */
ushort s_flag; /* permission flags */ __le16 s_flag; /* permission flags */
unsigned int s_start; /* start sector no of partition */ __le32 s_start; /* start sector no of partition */
unsigned int s_size; /* # of blocks in partition */ __le32 s_size; /* # of blocks in partition */
}; };
struct solaris_x86_vtoc { struct solaris_x86_vtoc {
unsigned int v_bootinfo[3]; /* info needed by mboot (unsupported) */ unsigned int v_bootinfo[3]; /* info needed by mboot (unsupported) */
unsigned int v_sanity; /* to verify vtoc sanity */ __le32 v_sanity; /* to verify vtoc sanity */
unsigned int v_version; /* layout version */ __le32 v_version; /* layout version */
char v_volume[8]; /* volume name */ char v_volume[8]; /* volume name */
ushort v_sectorsz; /* sector size in bytes */ __le16 v_sectorsz; /* sector size in bytes */
ushort v_nparts; /* number of partitions */ __le16 v_nparts; /* number of partitions */
unsigned int v_reserved[10]; /* free space */ unsigned int v_reserved[10]; /* free space */
struct solaris_x86_slice struct solaris_x86_slice
v_slice[SOLARIS_X86_NUMSLICE]; /* slice headers */ v_slice[SOLARIS_X86_NUMSLICE]; /* slice headers */
...@@ -253,7 +270,7 @@ struct solaris_x86_vtoc { ...@@ -253,7 +270,7 @@ struct solaris_x86_vtoc {
#define OPENBSD_MAXPARTITIONS 16 #define OPENBSD_MAXPARTITIONS 16
#define BSD_FS_UNUSED 0 /* disklabel unused partition entry ID */ #define BSD_FS_UNUSED 0 /* disklabel unused partition entry ID */
struct bsd_disklabel { struct bsd_disklabel {
__u32 d_magic; /* the magic number */ __le32 d_magic; /* the magic number */
__s16 d_type; /* drive type */ __s16 d_type; /* drive type */
__s16 d_subtype; /* controller/d_type specific */ __s16 d_subtype; /* controller/d_type specific */
char d_typename[16]; /* type name, e.g. "eagle" */ char d_typename[16]; /* type name, e.g. "eagle" */
...@@ -278,20 +295,20 @@ struct bsd_disklabel { ...@@ -278,20 +295,20 @@ struct bsd_disklabel {
__u32 d_drivedata[NDDATA]; /* drive-type specific information */ __u32 d_drivedata[NDDATA]; /* drive-type specific information */
#define NSPARE 5 #define NSPARE 5
__u32 d_spare[NSPARE]; /* reserved for future use */ __u32 d_spare[NSPARE]; /* reserved for future use */
__u32 d_magic2; /* the magic number (again) */ __le32 d_magic2; /* the magic number (again) */
__u16 d_checksum; /* xor of data incl. partitions */ __le16 d_checksum; /* xor of data incl. partitions */
/* filesystem and partition information: */ /* filesystem and partition information: */
__u16 d_npartitions; /* number of partitions in following */ __le16 d_npartitions; /* number of partitions in following */
__u32 d_bbsize; /* size of boot area at sn0, bytes */ __le32 d_bbsize; /* size of boot area at sn0, bytes */
__u32 d_sbsize; /* max size of fs superblock, bytes */ __le32 d_sbsize; /* max size of fs superblock, bytes */
struct bsd_partition { /* the partition table */ struct bsd_partition { /* the partition table */
__u32 p_size; /* number of sectors in partition */ __le32 p_size; /* number of sectors in partition */
__u32 p_offset; /* starting sector */ __le32 p_offset; /* starting sector */
__u32 p_fsize; /* filesystem basic fragment size */ __le32 p_fsize; /* filesystem basic fragment size */
__u8 p_fstype; /* filesystem type, see below */ __u8 p_fstype; /* filesystem type, see below */
__u8 p_frag; /* filesystem fragments per block */ __u8 p_frag; /* filesystem fragments per block */
__u16 p_cpg; /* filesystem cylinders per group */ __le16 p_cpg; /* filesystem cylinders per group */
} d_partitions[BSD_MAXPARTITIONS]; /* actually may be more */ } d_partitions[BSD_MAXPARTITIONS]; /* actually may be more */
}; };
...@@ -309,40 +326,40 @@ struct bsd_disklabel { ...@@ -309,40 +326,40 @@ struct bsd_disklabel {
#define UNIXWARE_FS_UNUSED 0 /* Unused slice entry ID */ #define UNIXWARE_FS_UNUSED 0 /* Unused slice entry ID */
struct unixware_slice { struct unixware_slice {
__u16 s_label; /* label */ __le16 s_label; /* label */
__u16 s_flags; /* permission flags */ __le16 s_flags; /* permission flags */
__u32 start_sect; /* starting sector */ __le32 start_sect; /* starting sector */
__u32 nr_sects; /* number of sectors in slice */ __le32 nr_sects; /* number of sectors in slice */
}; };
struct unixware_disklabel { struct unixware_disklabel {
__u32 d_type; /* drive type */ __le32 d_type; /* drive type */
__u32 d_magic; /* the magic number */ __le32 d_magic; /* the magic number */
__u32 d_version; /* version number */ __le32 d_version; /* version number */
char d_serial[12]; /* serial number of the device */ char d_serial[12]; /* serial number of the device */
__u32 d_ncylinders; /* # of data cylinders per device */ __le32 d_ncylinders; /* # of data cylinders per device */
__u32 d_ntracks; /* # of tracks per cylinder */ __le32 d_ntracks; /* # of tracks per cylinder */
__u32 d_nsectors; /* # of data sectors per track */ __le32 d_nsectors; /* # of data sectors per track */
__u32 d_secsize; /* # of bytes per sector */ __le32 d_secsize; /* # of bytes per sector */
__u32 d_part_start; /* # of first sector of this partition */ __le32 d_part_start; /* # of first sector of this partition */
__u32 d_unknown1[12]; /* ? */ __le32 d_unknown1[12]; /* ? */
__u32 d_alt_tbl; /* byte offset of alternate table */ __le32 d_alt_tbl; /* byte offset of alternate table */
__u32 d_alt_len; /* byte length of alternate table */ __le32 d_alt_len; /* byte length of alternate table */
__u32 d_phys_cyl; /* # of physical cylinders per device */ __le32 d_phys_cyl; /* # of physical cylinders per device */
__u32 d_phys_trk; /* # of physical tracks per cylinder */ __le32 d_phys_trk; /* # of physical tracks per cylinder */
__u32 d_phys_sec; /* # of physical sectors per track */ __le32 d_phys_sec; /* # of physical sectors per track */
__u32 d_phys_bytes; /* # of physical bytes per sector */ __le32 d_phys_bytes; /* # of physical bytes per sector */
__u32 d_unknown2; /* ? */ __le32 d_unknown2; /* ? */
__u32 d_unknown3; /* ? */ __le32 d_unknown3; /* ? */
__u32 d_pad[8]; /* pad */ __le32 d_pad[8]; /* pad */
struct unixware_vtoc { struct unixware_vtoc {
__u32 v_magic; /* the magic number */ __le32 v_magic; /* the magic number */
__u32 v_version; /* version number */ __le32 v_version; /* version number */
char v_name[8]; /* volume name */ char v_name[8]; /* volume name */
__u16 v_nslices; /* # of slices */ __le16 v_nslices; /* # of slices */
__u16 v_unknown1; /* ? */ __le16 v_unknown1; /* ? */
__u32 v_reserved[10]; /* reserved */ __le32 v_reserved[10]; /* reserved */
struct unixware_slice struct unixware_slice
v_slice[UNIXWARE_NUMSLICE]; /* slice headers */ v_slice[UNIXWARE_NUMSLICE]; /* slice headers */
} vtoc; } vtoc;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment