summaryrefslogtreecommitdiffstats
path: root/shlibs/blkid/src/partitions
diff options
context:
space:
mode:
authorKarel Zak2009-10-16 02:34:28 +0200
committerKarel Zak2009-10-16 02:34:28 +0200
commit11854e2eff8b15411bbbc35c95dc77d6a722cc6b (patch)
tree723a35834ce281bbea4c867088dc774467368867 /shlibs/blkid/src/partitions
parentinclude: use c.h in canonicalize.h (diff)
downloadkernel-qcow2-util-linux-11854e2eff8b15411bbbc35c95dc77d6a722cc6b.tar.gz
kernel-qcow2-util-linux-11854e2eff8b15411bbbc35c95dc77d6a722cc6b.tar.xz
kernel-qcow2-util-linux-11854e2eff8b15411bbbc35c95dc77d6a722cc6b.zip
libblkid: add missing packed attributes
This patch add __attribute__((packed)) to almost all superblock and disk label definitions. Well, in many cases this is not necessary, but it's a cheap way how to keep the code robust... Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'shlibs/blkid/src/partitions')
-rw-r--r--shlibs/blkid/src/partitions/bsd.c2
-rw-r--r--shlibs/blkid/src/partitions/mac.c4
-rw-r--r--shlibs/blkid/src/partitions/sgi.c8
-rw-r--r--shlibs/blkid/src/partitions/solaris_x86.c4
-rw-r--r--shlibs/blkid/src/partitions/unixware.c4
5 files changed, 11 insertions, 11 deletions
diff --git a/shlibs/blkid/src/partitions/bsd.c b/shlibs/blkid/src/partitions/bsd.c
index 829e3d01f..9d0d7e5ef 100644
--- a/shlibs/blkid/src/partitions/bsd.c
+++ b/shlibs/blkid/src/partitions/bsd.c
@@ -89,7 +89,7 @@ struct bsd_disklabel {
uint8_t p_fstype; /* filesystem type, see below */
uint8_t p_frag; /* filesystem fragments per block */
uint16_t p_cpg; /* filesystem cylinders per group */
- } d_partitions[BSD_MAXPARTITIONS]; /* actually may be more */
+ } __attribute__((packed)) d_partitions[BSD_MAXPARTITIONS]; /* actually may be more */
} __attribute__((packed));
diff --git a/shlibs/blkid/src/partitions/mac.c b/shlibs/blkid/src/partitions/mac.c
index c51b11aba..7f4a30b0a 100644
--- a/shlibs/blkid/src/partitions/mac.c
+++ b/shlibs/blkid/src/partitions/mac.c
@@ -42,7 +42,7 @@ struct mac_partition {
char processor[16]; /* identifies ISA of boot */
/* there is more stuff after this that we don't need */
-};
+} __attribute__((packed));
/*
* Driver descriptor structure, in block 0
@@ -54,7 +54,7 @@ struct mac_driver_desc {
uint32_t block_count; /* number of blocks on the device */
/* there is more stuff after this that we don't need */
-};
+} __attribute__((packed));
static inline unsigned char *get_mac_block(
blkid_probe pr,
diff --git a/shlibs/blkid/src/partitions/sgi.c b/shlibs/blkid/src/partitions/sgi.c
index 5ebf9dedb..c1094b786 100644
--- a/shlibs/blkid/src/partitions/sgi.c
+++ b/shlibs/blkid/src/partitions/sgi.c
@@ -47,7 +47,7 @@ struct sgi_device_parameter {
uint16_t xylogics_gap2;
uint16_t xylogics_readgate;
uint16_t xylogics_writecont;
-};
+} __attribute__((packed));
struct sgi_disklabel {
uint32_t magic; /* magic number */
@@ -61,18 +61,18 @@ struct sgi_disklabel {
unsigned char name[8]; /* name of volume */
uint32_t block_num; /* logical block number */
uint32_t num_bytes; /* how big, in bytes */
- } volume[15];
+ } __attribute__((packed)) volume[15];
struct sgi_partition {
uint32_t num_blocks; /* size in logical blocks */
uint32_t first_block; /* first logical block */
uint32_t type; /* type of this partition */
- } partitions[SGI_MAXPARTITIONS];
+ } __attribute__((packed)) partitions[SGI_MAXPARTITIONS];
/* checksum is the 32bit 2's complement sum of the disklabel */
uint32_t csum; /* disk label checksum */
uint32_t padding; /* padding */
-};
+} __attribute__((packed));
static uint32_t count_checksum(struct sgi_disklabel *label)
{
diff --git a/shlibs/blkid/src/partitions/solaris_x86.c b/shlibs/blkid/src/partitions/solaris_x86.c
index 964c406c7..fe39a1036 100644
--- a/shlibs/blkid/src/partitions/solaris_x86.c
+++ b/shlibs/blkid/src/partitions/solaris_x86.c
@@ -39,7 +39,7 @@ struct solaris_slice {
uint16_t s_flag; /* permission flags */
uint32_t s_start; /* start sector no of partition */
uint32_t s_size; /* # of blocks in partition */
-};
+} __attribute__((packed));
struct solaris_vtoc {
unsigned int v_bootinfo[3]; /* info needed by mboot (unsupported) */
@@ -55,7 +55,7 @@ struct solaris_vtoc {
unsigned int timestamp[SOLARIS_MAXPARTITIONS]; /* timestamp (unsupported) */
char v_asciilabel[128]; /* for compatibility */
-};
+} __attribute__((packed));
static int probe_solaris_pt(blkid_probe pr, const struct blkid_idmag *mag)
{
diff --git a/shlibs/blkid/src/partitions/unixware.c b/shlibs/blkid/src/partitions/unixware.c
index b4c8f6be2..70b6626f3 100644
--- a/shlibs/blkid/src/partitions/unixware.c
+++ b/shlibs/blkid/src/partitions/unixware.c
@@ -58,7 +58,7 @@ struct unixware_partition {
uint16_t s_flags; /* permission flags */
uint32_t start_sect; /* starting sector */
uint32_t nr_sects; /* number of sectors */
-};
+} __attribute__((packed));
struct unixware_disklabel {
uint32_t d_type; /* drive type */
@@ -91,7 +91,7 @@ struct unixware_disklabel {
struct unixware_partition
v_slice[UNIXWARE_MAXPARTITIONS]; /* partition */
- } vtoc;
+ } __attribute__((packed)) vtoc;
};
static int probe_unixware_pt(blkid_probe pr, const struct blkid_idmag *mag)