]> wimlib.net Git - wimlib/commitdiff
compiler.h: remove _packed_attribute
authorEric Biggers <ebiggers3@gmail.com>
Thu, 30 Mar 2023 07:00:56 +0000 (00:00 -0700)
committerEric Biggers <ebiggers3@gmail.com>
Thu, 30 Mar 2023 07:16:51 +0000 (00:16 -0700)
This abstraction layer serves no purpose.  Just use
__attribute__((packed)) directly.

12 files changed:
include/wimlib/compiler.h
include/wimlib/header.h
include/wimlib/reparse.h
include/wimlib/resource.h
include/wimlib/security_descriptor.h
include/wimlib/wof.h
include/wimlib/xattr.h
src/blob_table.c
src/dentry.c
src/integrity.c
src/registry.c
src/security.c

index 2013cd12b100c2c49e4bda5efb77647bb3222af4..612c058c560cf812461b0bdae82f50cc0a221417 100644 (file)
 /* Prefetch into L1 cache for write.  */
 #define prefetchw(addr)                __builtin_prefetch((addr), 1)
 
-/* Declare that the members of the annotated struct are tightly packed, and the
- * struct itself may be misaligned.  */
-#define _packed_attribute      __attribute__((packed))
-
 /* Declare that pointers to the annotated type may alias other pointers.  */
 #define _may_alias_attribute   __attribute__((may_alias))
 
index 7ef677369f9a039f8d44a96160dd94dca29e95e9..49ccf0b2fd5b8eee5410332fb8ee0e49b2bb1a36 100644 (file)
@@ -102,15 +102,15 @@ struct wim_header_disk {
         * if the WIM has no integrity table.
         *
         * Note the integrity_table_reshdr here is 4-byte aligned even though it
-        * would ordinarily be 8-byte aligned--- hence, the _packed_attribute on
-        * this structure is essential.  */
+        * would ordinarily be 8-byte aligned--- hence, the
+        * __attribute__((packed)) on this structure is essential.  */
        struct wim_reshdr_disk integrity_table_reshdr;
 
        /* +0x94: Unused bytes.  */
        u8 unused[60];
 
        /* +0xd0 (208)  */
-} _packed_attribute;
+} __attribute__((packed));
 
 /*
  * Arbitrarily limit the maximum number of images to 65535, to prevent huge
index fcc634249be501f99bced9b078da564c0a0151a0..99d466c50f8017c41172c99e6c05930819ac4b6a 100644 (file)
@@ -14,8 +14,8 @@ struct blob_table;
  * On-disk format of a reparse point buffer.  See:
  *     https://msdn.microsoft.com/en-us/library/dd541671.aspx
  *
- * Note: we are not using _packed_attribute for this structure, so only cast to
- * this if properly aligned!
+ * Note: we are not using __attribute__((packed)) for this structure, so only
+ * cast to this if properly aligned!
  */
 struct reparse_buffer_disk {
        le32 rptag;
index 0985c4f3cd91818bd439b2a5a60855f536430d89..8924b80716232b0e7489fd6ea8d9f7273954323f 100644 (file)
@@ -72,7 +72,7 @@ struct wim_reshdr_disk {
 
        /* Uncompressed size of the resource, in bytes.  */
        le64 uncompressed_size;
-} _packed_attribute;
+} __attribute__((packed));
 
 /* In-memory version of a WIM resource header (`struct wim_reshdr_disk').  */
 struct wim_reshdr {
@@ -158,7 +158,7 @@ struct alt_chunk_table_header_disk {
 
        /* This header is directly followed by a table of compressed sizes of
         * the chunks (4 bytes per entry).  */
-} _packed_attribute;
+} __attribute__((packed));
 
 static inline unsigned int
 get_chunk_entry_size(u64 res_size, bool is_alt)
@@ -321,12 +321,12 @@ struct pwm_blob_hdr {
        u8 hash[SHA1_HASH_SIZE];        /* +16  */
        le32 flags;                     /* +36  */
                                        /* +40  */
-} _packed_attribute;
+} __attribute__((packed));
 
 /* Header that precedes each chunk of a compressed resource in a pipable WIM.
  */
 struct pwm_chunk_hdr {
        le32 compressed_size;
-} _packed_attribute;
+} __attribute__((packed));
 
 #endif /* _WIMLIB_RESOURCE_H */
index e7fd62c7095b4e8e2a3f8993c822dd189067f7cc..f5c5a34c5bdf0cefe1504a271e96aeb092dfd018 100644 (file)
@@ -58,7 +58,7 @@ typedef struct {
        /* Offset of Discretionary Access Control List (DACL) in security
         * descriptor, or 0 if no DACL is present  */
        le32 dacl_offset;
-} _packed_attribute wimlib_SECURITY_DESCRIPTOR_RELATIVE;
+} __attribute__((packed)) wimlib_SECURITY_DESCRIPTOR_RELATIVE;
 
 #define wimlib_SE_OWNER_DEFAULTED              0x0001
 #define wimlib_SE_GROUP_DEFAULTED              0x0002
@@ -85,7 +85,7 @@ typedef struct {
        u8  identifier_authority[6];
 
        le32 sub_authority[];
-} _packed_attribute wimlib_SID;
+} __attribute__((packed)) wimlib_SID;
 
 /* Header of a Windows NT access control list  */
 typedef struct {
@@ -104,7 +104,7 @@ typedef struct {
 
        /* padding  */
        le16 sbz2;
-} _packed_attribute wimlib_ACL;
+} __attribute__((packed)) wimlib_ACL;
 
 #define wimlib_ACCESS_ALLOWED_ACE_TYPE         0
 #define wimlib_ACCESS_DENIED_ACE_TYPE          1
@@ -120,27 +120,27 @@ typedef struct {
 
        /* Size of the access control entry, including this header  */
        le16 size;
-} _packed_attribute wimlib_ACE_HEADER;
+} __attribute__((packed)) wimlib_ACE_HEADER;
 
 /* Windows NT access control entry to grant rights to a user or group  */
 typedef struct {
        wimlib_ACE_HEADER hdr;
        le32 mask;
        wimlib_SID sid;
-} _packed_attribute wimlib_ACCESS_ALLOWED_ACE;
+} __attribute__((packed)) wimlib_ACCESS_ALLOWED_ACE;
 
 /* Windows NT access control entry to deny rights to a user or group  */
 typedef struct {
        wimlib_ACE_HEADER hdr;
        le32 mask;
        wimlib_SID sid;
-} _packed_attribute wimlib_ACCESS_DENIED_ACE;
+} __attribute__((packed)) wimlib_ACCESS_DENIED_ACE;
 
 /* Windows NT access control entry to audit access to the object  */
 typedef struct {
        wimlib_ACE_HEADER hdr;
        le32 mask;
        wimlib_SID sid;
-} _packed_attribute wimlib_SYSTEM_AUDIT_ACE;
+} __attribute__((packed)) wimlib_SYSTEM_AUDIT_ACE;
 
 #endif /* _WIMLIB_SECURITY_DESCRIPTOR_H */
index 292b7168a56e83852d98a253d0efd980950da804..b19319dda2cffeb930087d143f5b7adb1b8210ab 100644 (file)
@@ -248,7 +248,7 @@ struct wim_provider_rpdata {
 
        /* Byte offset of the file's unnamed data stream in the WIM.  */
        le64 unnamed_data_stream_offset_in_wim;
-} _packed_attribute;
+} __attribute__((packed));
 
 /* WIM-specific information about a WIM data source  */
 struct WimOverlay_dat_entry_1 {
@@ -277,7 +277,7 @@ struct WimOverlay_dat_entry_1 {
 
        /* GUID of the WIM file (copied from the WIM header, offset +0x18).  */
        u8 guid[16];
-} _packed_attribute;
+} __attribute__((packed));
 
 /*
  * Format of file: "\System Volume Information\WimOverlay.dat"
@@ -308,7 +308,7 @@ struct WimOverlay_dat_header {
        le64 next_data_source_id;
 
        struct WimOverlay_dat_entry_1 entry_1s[];
-} _packed_attribute;
+} __attribute__((packed));
 
 /* Location information about a WIM data source  */
 struct WimOverlay_dat_entry_2 {
@@ -414,8 +414,8 @@ struct WimOverlay_dat_entry_2 {
                /* Null-terminated path to WIM file.  Begins with \ but does
                 * *not* include drive letter!  */
                utf16lechar wim_file_name[];
-       } _packed_attribute;
-} _packed_attribute;
+       } __attribute__((packed));
+} __attribute__((packed));
 
 static _unused_attribute void
 wof_check_structs(void)
index 13fb21b8bf526327f1090b925e1401fc0cb5cdf6..074fed9d1fe0df04e7d368f09a477dffa501cdea 100644 (file)
@@ -40,7 +40,7 @@ struct wim_xattr_entry {
        /* u8 value[0]; */
 
        /* no padding at end! */
-} _packed_attribute;
+} __attribute__((packed));
 
 static inline size_t
 xattr_entry_size(const struct wim_xattr_entry *entry)
index d562e2c6cf6ff363abe21e8e70c47a32adbca0ca..294f95030d31b94b75d6cd82b4745a8f484c5617 100644 (file)
@@ -585,7 +585,7 @@ struct blob_descriptor_disk {
        /* SHA-1 message digest of the uncompressed data of this blob, or all
         * zeroes if this blob is of zero length.  */
        u8 hash[SHA1_HASH_SIZE];
-} _packed_attribute;
+} __attribute__((packed));
 
 /* Given a nonempty run of consecutive blob descriptors with the SOLID flag set,
  * count how many specify resources (as opposed to blobs within those
index 3e09993c9ae88b715333e2d65e4b2f7ee9264b46..bf81d9a8880180a12aa2c1fe5b2249a2989a1216 100644 (file)
@@ -155,10 +155,10 @@ struct wim_dentry_on_disk {
                        le32 reparse_tag;
                        le16 rp_reserved;
                        le16 rp_flags;
-               } _packed_attribute reparse;
+               } __attribute__((packed)) reparse;
                struct {
                        le64 hard_link_group_id;
-               } _packed_attribute nonreparse;
+               } __attribute__((packed)) nonreparse;
        };
 
        /* Number of extra stream entries that directly follow this dentry
@@ -196,7 +196,7 @@ struct wim_dentry_on_disk {
         * for more information.  */
        /* u8 tagged_items[] __attribute__((aligned(8))); */
 
-} _packed_attribute;
+} __attribute__((packed));
        /* If num_extra_streams != 0, then there are that many extra stream
         * entries following the dentry, starting on the next 8-byte aligned
         * boundary.  They are not counted in the 'length' field of the dentry.
@@ -226,7 +226,7 @@ struct wim_extra_stream_entry_on_disk {
         * the null terminator.  There is a null terminator character if
         * @name_nbytes != 0; i.e., if this stream is named.  */
        utf16lechar name[];
-} _packed_attribute;
+} __attribute__((packed));
 
 static void
 do_dentry_set_name(struct wim_dentry *dentry, utf16lechar *name,
index e0d4447c17e18b18dd15b8bee3e5f18baa24d9df..ce07acc6b7e6673f2a87ea2c5e2cf271d22d1ff9 100644 (file)
@@ -52,7 +52,7 @@ struct integrity_table {
        u32 num_entries;
        u32 chunk_size;
        u8  sha1sums[][20];
-} _packed_attribute;
+} __attribute__((packed));
 
 static int
 calculate_chunk_sha1(struct filedes *in_fd, size_t this_chunk_size,
index 0f753e8c7de0b6bd58bc225f8c7eb5f7a420e88d..bdf4dc8ff3e338501f21f28822a6c3e8046e122e 100644 (file)
@@ -46,7 +46,7 @@ struct regf {
        le32 total_hbin_size;           /* Total size of all hbins  */
        le32 f3[1013];
        u8 hbin_area[0];                /* Start of hbin area  */
-} _packed_attribute;
+} __attribute__((packed));
 
 
 /* Cell header  */
@@ -56,7 +56,7 @@ struct cell {
 
        /* Magic characters which identify the cell type  */
        le16 magic;
-} _packed_attribute;
+} __attribute__((packed));
 
 /* NK cell - represents a registry key  */
 struct nk {
@@ -84,7 +84,7 @@ struct nk {
        le16 name_size;
        le16 unknown_0x4E;
        char name[0];
-} _packed_attribute;
+} __attribute__((packed));
 
 /* Subkey list cell.  There are four types.  LF, LH, and LI cells reference
  * subkey NK cells directly, while RI cells reference other subkey lists.  All
@@ -99,13 +99,13 @@ struct subkey_list {
        struct cell base;
        le16 num_offsets;
        le32 elements[0];
-} _packed_attribute;
+} __attribute__((packed));
 
 /* Value list cell - contains a list of value references  */
 struct value_list {
        le32 size;
        le32 vk_offsets[0];
-} _packed_attribute;
+} __attribute__((packed));
 
 /* VK cell - contains a value's data, or a reference to it  */
 struct vk {
index f674fa9a9f34968b794b4280597652b0b64d33f1..c447e501da73aa3e4580d37fbd6941a4f9fe680c 100644 (file)
@@ -37,7 +37,7 @@ struct wim_security_data_disk {
        le32 total_length;
        le32 num_entries;
        le64 sizes[];
-} _packed_attribute;
+} __attribute__((packed));
 
 struct wim_security_data *
 new_wim_security_data(void)