Replace __packed with __attribute__((__packed__)) in uapi headers
Linux uapi headers use __packed as an abbreviation for
__attribute__((__packed__)). In the upstream kernel headers this
is defined in linux/compiler_attributes.h, but it is not defined
in the uapi headers. Bionic defines it in sys/cdefs.h, which will
almost always provide the needed definition, but there are uapi
headers that use __packed and do not include any system headers
that would include sys/cdefs.h. Musl's sys/cdefs.h does not
define __packed, which leads to linker errors when __packed is
treated as a variable name.
Replace __packed with __attribute__((__packed__)) when importing
uapi headers to break the dependency on sys/cdefs.h.
Test: m USE_HOST_MUSL=true on oriole-userdebug in internal master
Change-Id: I45f80f4e5aec868b80ce8eb9d757a3e08ae3e1a9
diff --git a/libc/kernel/uapi/mtd/ubi-user.h b/libc/kernel/uapi/mtd/ubi-user.h
index 866fbd2..a1143bc 100644
--- a/libc/kernel/uapi/mtd/ubi-user.h
+++ b/libc/kernel/uapi/mtd/ubi-user.h
@@ -71,11 +71,11 @@
__s16 name_len;
__s8 padding2[4];
char name[UBI_MAX_VOLUME_NAME + 1];
-} __packed;
+} __attribute__((__packed__));
struct ubi_rsvol_req {
__s64 bytes;
__s32 vol_id;
-} __packed;
+} __attribute__((__packed__));
struct ubi_rnvol_req {
__s32 count;
__s8 padding1[12];
@@ -85,24 +85,24 @@
__s8 padding2[2];
char name[UBI_MAX_VOLUME_NAME + 1];
} ents[UBI_MAX_RNVOL];
-} __packed;
+} __attribute__((__packed__));
struct ubi_leb_change_req {
__s32 lnum;
__s32 bytes;
__s8 dtype;
__s8 padding[7];
-} __packed;
+} __attribute__((__packed__));
struct ubi_map_req {
__s32 lnum;
__s8 dtype;
__s8 padding[3];
-} __packed;
+} __attribute__((__packed__));
struct ubi_set_vol_prop_req {
__u8 property;
__u8 padding[7];
__u64 value;
-} __packed;
+} __attribute__((__packed__));
struct ubi_blkcreate_req {
__s8 padding[128];
-} __packed;
+} __attribute__((__packed__));
#endif