This abstraction layer serves no purpose. Just use
__attribute__((packed)) directly.
12 files changed:
/* Prefetch into L1 cache for write. */
#define prefetchw(addr) __builtin_prefetch((addr), 1)
/* 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))
/* Declare that pointers to the annotated type may alias other pointers. */
#define _may_alias_attribute __attribute__((may_alias))
* if the WIM has no integrity table.
*
* Note the integrity_table_reshdr here is 4-byte aligned even though it
* 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) */
struct wim_reshdr_disk integrity_table_reshdr;
/* +0x94: Unused bytes. */
u8 unused[60];
/* +0xd0 (208) */
+} __attribute__((packed));
/*
* Arbitrarily limit the maximum number of images to 65535, to prevent huge
/*
* Arbitrarily limit the maximum number of images to 65535, to prevent huge
* On-disk format of a reparse point buffer. See:
* https://msdn.microsoft.com/en-us/library/dd541671.aspx
*
* 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;
*/
struct reparse_buffer_disk {
le32 rptag;
/* Uncompressed size of the resource, in bytes. */
le64 uncompressed_size;
/* Uncompressed size of the resource, in bytes. */
le64 uncompressed_size;
+} __attribute__((packed));
/* In-memory version of a WIM resource header (`struct wim_reshdr_disk'). */
struct wim_reshdr {
/* In-memory version of a WIM resource header (`struct wim_reshdr_disk'). */
struct wim_reshdr {
/* This header is directly followed by a table of compressed sizes of
* the chunks (4 bytes per entry). */
/* This header is directly followed by a table of compressed sizes of
* the chunks (4 bytes per entry). */
+} __attribute__((packed));
static inline unsigned int
get_chunk_entry_size(u64 res_size, bool is_alt)
static inline unsigned int
get_chunk_entry_size(u64 res_size, bool is_alt)
u8 hash[SHA1_HASH_SIZE]; /* +16 */
le32 flags; /* +36 */
/* +40 */
u8 hash[SHA1_HASH_SIZE]; /* +16 */
le32 flags; /* +36 */
/* +40 */
+} __attribute__((packed));
/* Header that precedes each chunk of a compressed resource in a pipable WIM.
*/
struct pwm_chunk_hdr {
le32 compressed_size;
/* Header that precedes each chunk of a compressed resource in a pipable WIM.
*/
struct pwm_chunk_hdr {
le32 compressed_size;
+} __attribute__((packed));
#endif /* _WIMLIB_RESOURCE_H */
#endif /* _WIMLIB_RESOURCE_H */
/* Offset of Discretionary Access Control List (DACL) in security
* descriptor, or 0 if no DACL is present */
le32 dacl_offset;
/* 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
#define wimlib_SE_OWNER_DEFAULTED 0x0001
#define wimlib_SE_GROUP_DEFAULTED 0x0002
u8 identifier_authority[6];
le32 sub_authority[];
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 {
/* Header of a Windows NT access control list */
typedef struct {
-} _packed_attribute wimlib_ACL;
+} __attribute__((packed)) wimlib_ACL;
#define wimlib_ACCESS_ALLOWED_ACE_TYPE 0
#define wimlib_ACCESS_DENIED_ACE_TYPE 1
#define wimlib_ACCESS_ALLOWED_ACE_TYPE 0
#define wimlib_ACCESS_DENIED_ACE_TYPE 1
/* Size of the access control entry, including this header */
le16 size;
/* 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;
/* 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;
/* 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;
/* 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 */
#endif /* _WIMLIB_SECURITY_DESCRIPTOR_H */
/* Byte offset of the file's unnamed data stream in the WIM. */
le64 unnamed_data_stream_offset_in_wim;
/* Byte offset of the file's unnamed data stream in the WIM. */
le64 unnamed_data_stream_offset_in_wim;
+} __attribute__((packed));
/* WIM-specific information about a WIM data source */
struct WimOverlay_dat_entry_1 {
/* WIM-specific information about a WIM data source */
struct WimOverlay_dat_entry_1 {
/* GUID of the WIM file (copied from the WIM header, offset +0x18). */
u8 guid[16];
/* GUID of the WIM file (copied from the WIM header, offset +0x18). */
u8 guid[16];
+} __attribute__((packed));
/*
* Format of file: "\System Volume Information\WimOverlay.dat"
/*
* Format of file: "\System Volume Information\WimOverlay.dat"
le64 next_data_source_id;
struct WimOverlay_dat_entry_1 entry_1s[];
le64 next_data_source_id;
struct WimOverlay_dat_entry_1 entry_1s[];
+} __attribute__((packed));
/* Location information about a WIM data source */
struct WimOverlay_dat_entry_2 {
/* Location information about a WIM data source */
struct WimOverlay_dat_entry_2 {
/* Null-terminated path to WIM file. Begins with \ but does
* *not* include drive letter! */
utf16lechar wim_file_name[];
/* 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)
static _unused_attribute void
wof_check_structs(void)
/* u8 value[0]; */
/* no padding at end! */
/* u8 value[0]; */
/* no padding at end! */
+} __attribute__((packed));
static inline size_t
xattr_entry_size(const struct wim_xattr_entry *entry)
static inline size_t
xattr_entry_size(const struct wim_xattr_entry *entry)
/* 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];
/* 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];
+} __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
/* Given a nonempty run of consecutive blob descriptors with the SOLID flag set,
* count how many specify resources (as opposed to blobs within those
le32 reparse_tag;
le16 rp_reserved;
le16 rp_flags;
le32 reparse_tag;
le16 rp_reserved;
le16 rp_flags;
- } _packed_attribute reparse;
+ } __attribute__((packed)) reparse;
struct {
le64 hard_link_group_id;
struct {
le64 hard_link_group_id;
- } _packed_attribute nonreparse;
+ } __attribute__((packed)) nonreparse;
};
/* Number of extra stream entries that directly follow this dentry
};
/* Number of extra stream entries that directly follow this dentry
* for more information. */
/* u8 tagged_items[] __attribute__((aligned(8))); */
* for more information. */
/* u8 tagged_items[] __attribute__((aligned(8))); */
+} __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.
/* 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.
* the null terminator. There is a null terminator character if
* @name_nbytes != 0; i.e., if this stream is named. */
utf16lechar name[];
* the null terminator. There is a null terminator character if
* @name_nbytes != 0; i.e., if this stream is named. */
utf16lechar name[];
+} __attribute__((packed));
static void
do_dentry_set_name(struct wim_dentry *dentry, utf16lechar *name,
static void
do_dentry_set_name(struct wim_dentry *dentry, utf16lechar *name,
u32 num_entries;
u32 chunk_size;
u8 sha1sums[][20];
u32 num_entries;
u32 chunk_size;
u8 sha1sums[][20];
+} __attribute__((packed));
static int
calculate_chunk_sha1(struct filedes *in_fd, size_t this_chunk_size,
static int
calculate_chunk_sha1(struct filedes *in_fd, size_t this_chunk_size,
le32 total_hbin_size; /* Total size of all hbins */
le32 f3[1013];
u8 hbin_area[0]; /* Start of hbin area */
le32 total_hbin_size; /* Total size of all hbins */
le32 f3[1013];
u8 hbin_area[0]; /* Start of hbin area */
+} __attribute__((packed));
/* Magic characters which identify the cell type */
le16 magic;
/* Magic characters which identify the cell type */
le16 magic;
+} __attribute__((packed));
/* NK cell - represents a registry key */
struct nk {
/* NK cell - represents a registry key */
struct nk {
le16 name_size;
le16 unknown_0x4E;
char name[0];
le16 name_size;
le16 unknown_0x4E;
char name[0];
+} __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
/* 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
struct cell base;
le16 num_offsets;
le32 elements[0];
struct cell base;
le16 num_offsets;
le32 elements[0];
+} __attribute__((packed));
/* Value list cell - contains a list of value references */
struct value_list {
le32 size;
le32 vk_offsets[0];
/* Value list cell - contains a list of value references */
struct value_list {
le32 size;
le32 vk_offsets[0];
+} __attribute__((packed));
/* VK cell - contains a value's data, or a reference to it */
struct vk {
/* VK cell - contains a value's data, or a reference to it */
struct vk {
le32 total_length;
le32 num_entries;
le64 sizes[];
le32 total_length;
le32 num_entries;
le64 sizes[];
+} __attribute__((packed));
struct wim_security_data *
new_wim_security_data(void)
struct wim_security_data *
new_wim_security_data(void)