]> err.no Git - util-linux/commitdiff
libblkid: add missing packed attributes, add new UFS magic strings
authorKarel Zak <kzak@redhat.com>
Mon, 30 Nov 2009 11:46:55 +0000 (12:46 +0100)
committerKarel Zak <kzak@redhat.com>
Mon, 30 Nov 2009 11:46:55 +0000 (12:46 +0100)
Signed-off-by: Karel Zak <kzak@redhat.com>
21 files changed:
shlibs/blkid/src/probers/adaptec_raid.c
shlibs/blkid/src/probers/cramfs.c
shlibs/blkid/src/probers/ext.c
shlibs/blkid/src/probers/gfs.c
shlibs/blkid/src/probers/hpfs.c
shlibs/blkid/src/probers/iso9660.c
shlibs/blkid/src/probers/luks.c
shlibs/blkid/src/probers/ntfs.c
shlibs/blkid/src/probers/nvidia_raid.c
shlibs/blkid/src/probers/reiserfs.c
shlibs/blkid/src/probers/romfs.c
shlibs/blkid/src/probers/silicon_raid.c
shlibs/blkid/src/probers/squashfs.c
shlibs/blkid/src/probers/swap.c
shlibs/blkid/src/probers/sysv.c
shlibs/blkid/src/probers/udf.c
shlibs/blkid/src/probers/ufs.c
shlibs/blkid/src/probers/vfat.c
shlibs/blkid/src/probers/via_raid.c
shlibs/blkid/src/probers/xfs.c
shlibs/blkid/src/probers/zfs.c

index 5e8b3a758f7988b0b50f5504c8428dcfc85fafbe..fd1fc718f56fa6df13646a7b924698c49833692f 100644 (file)
@@ -67,7 +67,7 @@ struct adaptec_metadata {
        uint32_t        raidtbl;
        uint16_t        raidline;
        uint8_t         res9[0xF6];
-};
+} __attribute__((packed));
 
 #define AD_SIGNATURE   "DPTM"
 #define AD_MAGIC       0x37FC4D1E
index 0ea124b3047ab2a26e8bf64983496193b2d2a0cd..428ef50114aa5c1261230d19da9c033f7daf4c6f 100644 (file)
@@ -30,9 +30,9 @@ struct cramfs_super
                uint32_t        edition;
                uint32_t        blocks;
                uint32_t        files;
-       } info;
+       } __attribute__((packed)) info;
        uint8_t         name[16];
-};
+} __attribute__((packed));
 
 static int probe_cramfs(blkid_probe pr, const struct blkid_idmag *mag)
 {
index c27411d2425da72f1b211ee73b72ace7b08a6767..26490f3a2593b257904e226b973f1e19425396a1 100644 (file)
@@ -76,7 +76,7 @@ struct ext2_super_block {
        uint64_t                s_mmp_block;
        uint32_t                s_raid_stripe_width;
        uint32_t                s_reserved[163];
-};
+} __attribute__((packed));
 
 /* magic string */
 #define EXT_SB_MAGIC                           "\123\357"
index 584561cf356b1021e404c02351ede3c03d59280a..c716643b5eee103d83182e86382065a0a1ab0410 100644 (file)
@@ -56,7 +56,7 @@ struct gfs2_sb {
        struct gfs2_inum __pad3; /* Was quota inode in gfs1 */
        struct gfs2_inum __pad4; /* Was licence inode in gfs1 */
        uint8_t sb_uuid[16]; /* The UUID maybe 0 for backwards compat */
-};
+} __attribute__((packed));
 
 static int probe_gfs(blkid_probe pr, const struct blkid_idmag *mag)
 {
index 2f5f0d198399f2d3b867a14a43b56a5388893379..9e1219c4f5218cd685d40b380e64fbcbd2061bc1 100644 (file)
@@ -39,20 +39,20 @@ struct hpfs_boot_block
        uint8_t         sig_hpfs[8];
        uint8_t         pad[448];
        uint8_t         magic[2];
-};
+} __attribute__((packed));
 
 struct hpfs_super_block
 {
        uint8_t         magic[4];
        uint8_t         magic1[4];
        uint8_t         version;
-};
+} __attribute__((packed));
 
 struct hpfs_spare_super
 {
        uint8_t         magic[4];
        uint8_t         magic1[4];
-};
+} __attribute__((packed));
 
 
 #define HPFS_SB_OFFSET                 0x2000
index 1ebcccf0649efccc830fcde37459a4aa22dfbc66..16d232ae8a2eb95c6550d3f74783b5f29824a853 100644 (file)
@@ -30,7 +30,7 @@ struct iso_volume_descriptor {
        unsigned char   unused[8];
        unsigned char   space_size[8];
        unsigned char   escape_sequences[8];
-};
+} __attribute__((packed));
 
 #define ISO_SUPERBLOCK_OFFSET          0x8000
 #define ISO_SECTOR_SIZE                        0x800
@@ -47,7 +47,7 @@ struct high_sierra_volume_descriptor {
        unsigned char   unused1;
        unsigned char   system_id[32];
        unsigned char   volume_id[32];
-};
+} __attribute__((packed));
 
 /* returns 1 if the begin of @ascii is equal to @utf16 string.
  */
index 2fe4ff3b4a128429f4be4e89bfbf359c69813875..5e5f4ff3180b82b9fe678626de764b7eaca21a5a 100644 (file)
@@ -37,7 +37,7 @@ struct luks_phdr {
        uint8_t         mkDigestSalt[LUKS_SALTSIZE];
        uint32_t        mkDigestIterations;
        uint8_t         uuid[UUID_STRING_L];
-};
+} __attribute__((packed));
 
 static int probe_luks(blkid_probe pr, const struct blkid_idmag *mag)
 {
index 55a186a3839190b483ecca153c1ee314162985d4..8d183c680afaefe7ce9ff42a70e3521fbf22d40a 100644 (file)
@@ -27,7 +27,7 @@ struct ntfs_super_block {
        uint8_t         reserved2[3];
        uint64_t        volume_serial;
        uint16_t        checksum;
-};
+} __attribute__((packed));
 
 struct master_file_table_record {
        uint32_t        magic;
index 76361763c3d9c969530446ec9be6484dc6e5739f..8bdd24148354ba05b6530218b0825164e04bd4e1 100644 (file)
@@ -21,7 +21,7 @@ struct nv_metadata {
        uint32_t        size;
        uint32_t        chksum;
        uint16_t        version;
-};
+} __attribute__((packed));
 
 #define NVIDIA_SIGNATURE               "NVIDIA"
 
index f9a46787e7804cc2291388123cfacff705d556e0..6d9e2b92678b970be9ad81f666b0072ae66a299e 100644 (file)
@@ -28,7 +28,7 @@ struct reiserfs_super_block {
        uint32_t        rs_dummy4[5];
        unsigned char   rs_uuid[16];
        char            rs_label[16];
-};
+} __attribute__((packed));
 
 struct reiser4_super_block {
        unsigned char   rs4_magic[16];
@@ -36,7 +36,7 @@ struct reiser4_super_block {
        unsigned char   rs4_uuid[16];
        unsigned char   rs4_label[16];
        uint64_t        rs4_dummy2;
-};
+} __attribute__((packed));
 
 static int probe_reiser(blkid_probe pr, const struct blkid_idmag *mag)
 {
index b5c20ab7f713131697291f5c380e052129ef6f0b..e70db090c85783f8d8ad938e3d8e66a1d8843e45 100644 (file)
@@ -21,7 +21,7 @@ struct romfs_super_block {
        unsigned char   ros_magic[8];
        uint32_t        ros_dummy1[2];
        unsigned char   ros_volume[16];
-};
+} __attribute__((packed));
 
 static int probe_romfs(blkid_probe pr, const struct blkid_idmag *mag)
 {
index a65d79a83c6dc17b3a00b6ed9aa187d19a4c5967..01adafa773ffecd6848d49e59aa2fa34bac710b1 100644 (file)
@@ -35,7 +35,7 @@ struct silicon_metadata {
        uint16_t        vendor_id;
        uint16_t        minor_ver;
        uint16_t        major_ver;
-};
+} __attribute__((packed));
 
 #define SILICON_MAGIC          0x2F000000
 
index 74f53bfb616bd0fdd8f1ea567c49f335b90e569f..e83ca6d9cf4234d8158055ad777bcdf2dddc5978 100644 (file)
@@ -26,7 +26,7 @@ struct sqsh_super_block {
        uint32_t        directory_table_start_2;
        uint16_t        s_major;
        uint16_t        s_minor;
-};
+} __attribute__((packed));
 
 static int probe_squashfs(blkid_probe pr, const struct blkid_idmag *mag)
 {
index c289488a18c29c17ec3291235991afd165abb679..14f74aca1e1d788d5e7aa9a6a08750c215a8e732 100644 (file)
@@ -28,7 +28,7 @@ struct swap_header_v1_2 {
        unsigned char   volume[16];
        uint32_t        padding[117];
        uint32_t        badpages[1];
-};
+} __attribute__((packed));
 
 #define PAGESIZE_MIN   0xff6   /* 4086 (arm, i386, ...) */
 #define PAGESIZE_MAX   0xfff6  /* 65526 (ia64) */
index 933163a27619df2eb33267acf2c6ff2c1cdb8674..096d9e3235d6201216f2bb89dbe1a1f5343f7163 100644 (file)
@@ -39,7 +39,7 @@ struct xenix_super_block {
        uint8_t         s_fill[371];
        uint32_t        s_magic;
        uint32_t        s_type;
-};
+} __attribute__((packed));
 
 
 #define SYSV_NICINOD                   100
index 5f4046d6d952d32544257fefd25d6f683c7e694a..42f7aa12b0d1853abb436f2aee93d338c75763cb 100644 (file)
@@ -28,28 +28,32 @@ struct volume_descriptor {
                uint16_t        crc;
                uint16_t        crc_len;
                uint32_t        location;
-       } tag;
+       } __attribute__((packed)) tag;
+
        union {
                struct anchor_descriptor {
                        uint32_t        length;
                        uint32_t        location;
-               } anchor;
+               } __attribute__((packed)) anchor;
+
                struct primary_descriptor {
                        uint32_t        seq_num;
                        uint32_t        desc_num;
                        struct dstring {
                                uint8_t clen;
                                uint8_t c[31];
-                       } ident;
-               } primary;
-       } type;
-};
+                       } __attribute__((packed)) ident;
+               } __attribute__((packed)) primary;
+
+       } __attribute__((packed)) type;
+
+} __attribute__((packed));
 
 struct volume_structure_descriptor {
        uint8_t         type;
        uint8_t         id[5];
        uint8_t         version;
-};
+} __attribute__((packed));
 
 #define UDF_VSD_OFFSET                 0x8000
 
index fe9870d84997aeb8e6ac191c6f26092bff737913..27f3533c4e83ee19e3c11f72b9671dca77b2ad59 100644 (file)
@@ -117,7 +117,7 @@ struct ufs_super_block {
                        uint64_t        fs_csaddr;
                        int64_t         fs_pendingblocks;
                        int32_t         fs_pendinginodes;
-               } fs_u2;
+               } __attribute__((packed)) fs_u2;
        }  fs_u11;
        union {
                struct {
@@ -153,17 +153,22 @@ struct ufs_super_block {
        int32_t         fs_rotbloff;
        uint32_t        fs_magic;
        uint8_t         fs_space[1];
-};
+} __attribute__((packed));
 
 #define UFS_MAGIC                      0x00011954
 #define UFS2_MAGIC                     0x19540119
 #define UFS_MAGIC_FEA                  0x00195612
 #define UFS_MAGIC_LFN                  0x00095014
+#define UFS_MAGIC_SEC                  0x00612195
+#define UFS_MAGIC_4GB                  0x05231994
 
 static int probe_ufs(blkid_probe pr, const struct blkid_idmag *mag)
 {
        int offsets[] = { 0, 8, 64, 256 };
-       int mags[] = { UFS2_MAGIC, UFS_MAGIC, UFS_MAGIC_FEA, UFS_MAGIC_LFN };
+       int mags[] = {
+               UFS2_MAGIC, UFS_MAGIC, UFS_MAGIC_FEA, UFS_MAGIC_LFN,
+               UFS_MAGIC_SEC, UFS_MAGIC_4GB
+       };
        int i;
        uint32_t magic;
        struct ufs_super_block *ufs;
index a83175c0b472eef7b46d477e4771ac759475eebc..99f287091aeea21481c6077b255cff6c880199c6 100644 (file)
@@ -47,7 +47,7 @@ struct vfat_super_block {
 /* 52*/        unsigned char   vs_magic[8];
 /* 5a*/        unsigned char   vs_dummy2[164];
 /*1fe*/        unsigned char   vs_pmagic[2];
-};
+} __attribute__((packed));
 
 /* Yucky misaligned values */
 struct msdos_super_block {
@@ -71,7 +71,7 @@ struct msdos_super_block {
 /* 36*/        unsigned char   ms_magic[8];
 /* 3d*/        unsigned char   ms_dummy2[192];
 /*1fe*/        unsigned char   ms_pmagic[2];
-};
+} __attribute__((packed));
 
 struct vfat_dir_entry {
        uint8_t         name[11];
@@ -85,7 +85,7 @@ struct vfat_dir_entry {
        uint16_t        date_write;
        uint16_t        cluster_low;
        uint32_t        size;
-};
+} __attribute__((packed));
 
 struct fat32_fsinfo {
        uint8_t signature1[4];
@@ -94,7 +94,7 @@ struct fat32_fsinfo {
        uint32_t free_clusters;
        uint32_t next_cluster;
        uint32_t reserved2[4];
-};
+} __attribute__((packed));
 
 /* maximum number of clusters */
 #define FAT12_MAX 0xFF4
index 22022fdd521263ced0c47e4e8b17547b0dd47364..d4237799b85acf49aa66927ca0f5dfdb06552908 100644 (file)
@@ -27,10 +27,10 @@ struct via_metadata {
                uint32_t        capacity_low;
                uint32_t        capacity_high;
                uint32_t        serial_checksum;
-       } array;
+       } __attribute__((packed)) array;
        uint32_t        serial_checksum[8];
        uint8_t         checksum;
-};
+} __attribute__((packed));
 
 #define VIA_SIGNATURE          0xAA55
 
index fa7914e29338fd87553817f0313692e6b0ac5b63..c53dc39ddd79dce9e55f16709df34f6eabe82d57 100644 (file)
@@ -32,7 +32,7 @@ struct xfs_super_block {
        uint64_t        xs_icount;
        uint64_t        xs_ifree;
        uint64_t        xs_fdblocks;
-};
+} __attribute__((packed));
 
 static int probe_xfs(blkid_probe pr, const struct blkid_idmag *mag)
 {
index 7d39034f6961bd5bf238bc7a67a30eeca8b49e78..11b1b000a17c27c2a0bcf63fb2c45d0204c535a3 100644 (file)
@@ -24,7 +24,7 @@ struct zfs_uberblock {
        uint64_t        ub_guid_sum;    /* sum of all vdev guids        */
        uint64_t        ub_timestamp;   /* UTC time of last sync        */
        /*blkptr_t      ub_rootbp;*/    /* MOS objset_phys_t            */
-};
+} __attribute__((packed));
 
 static int probe_zfs(blkid_probe pr, const struct blkid_idmag *mag)
 {