]> git.hungrycats.org Git - linux/commitdiff
[PATCH] fs/partitions endianness annotations
authorAlexander Viro <viro@www.linux.org.uk>
Wed, 6 Oct 2004 00:52:26 +0000 (17:52 -0700)
committerLinus Torvalds <torvalds@ppc970.osdl.org>
Wed, 6 Oct 2004 00:52:26 +0000 (17:52 -0700)
Signed-off-by: Al Viro <viro@parcelfarce.linux.org.uk>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
fs/partitions/acorn.c
fs/partitions/amiga.c
fs/partitions/atari.h
fs/partitions/efi.h
fs/partitions/ldm.c
fs/partitions/ldm.h
fs/partitions/mac.h
fs/partitions/osf.c
fs/partitions/sgi.c
fs/partitions/sun.c
include/linux/genhd.h

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