#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];
};
#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
#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)
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;
}
#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];
};
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;
};
/*
#include "amiga.h"
static __inline__ u32
-checksum_block(u32 *m, int size)
+checksum_block(__be32 *m, int size)
{
u32 sum = 0;
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);
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 */
{
/* 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)",
{
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
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;
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 */
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);
#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))
#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 */
};
/* 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 */
};
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;
#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;
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);
}
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 */
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;
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",
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 */
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;
#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 */
#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" */
__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 */
};
#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;