提交 3627924a 编写于 作者: A Artem Bityutskiy

UBI: use __packed instead of __attribute__((packed))

There was an attempt to standartize various "__attribute__" and
other macros in order to have potentially portable and more
consistent code, see commit 82ddcb04.

Note, that commit refers Rober Love's blog post, but the URL
is broken, the valid URL is:
http://blog.rlove.org/2005/10/with-little-help-from-your-compiler.html

Moreover, nowadays checkpatch.pl warns about using
__attribute__((packed)):

"WARNING: __packed is preferred over __attribute__((packed))"

It is not a big deal for UBI to use __packed, so let's do it.
Signed-off-by: NArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
上级 e8e088de
...@@ -164,7 +164,7 @@ struct ubi_ec_hdr { ...@@ -164,7 +164,7 @@ struct ubi_ec_hdr {
__be32 image_seq; __be32 image_seq;
__u8 padding2[32]; __u8 padding2[32];
__be32 hdr_crc; __be32 hdr_crc;
} __attribute__ ((packed)); } __packed;
/** /**
* struct ubi_vid_hdr - on-flash UBI volume identifier header. * struct ubi_vid_hdr - on-flash UBI volume identifier header.
...@@ -292,7 +292,7 @@ struct ubi_vid_hdr { ...@@ -292,7 +292,7 @@ struct ubi_vid_hdr {
__be64 sqnum; __be64 sqnum;
__u8 padding3[12]; __u8 padding3[12];
__be32 hdr_crc; __be32 hdr_crc;
} __attribute__ ((packed)); } __packed;
/* Internal UBI volumes count */ /* Internal UBI volumes count */
#define UBI_INT_VOL_COUNT 1 #define UBI_INT_VOL_COUNT 1
...@@ -373,6 +373,6 @@ struct ubi_vtbl_record { ...@@ -373,6 +373,6 @@ struct ubi_vtbl_record {
__u8 flags; __u8 flags;
__u8 padding[23]; __u8 padding[23];
__be32 crc; __be32 crc;
} __attribute__ ((packed)); } __packed;
#endif /* !__UBI_MEDIA_H__ */ #endif /* !__UBI_MEDIA_H__ */
...@@ -310,7 +310,7 @@ struct ubi_mkvol_req { ...@@ -310,7 +310,7 @@ struct ubi_mkvol_req {
__s16 name_len; __s16 name_len;
__s8 padding2[4]; __s8 padding2[4];
char name[UBI_MAX_VOLUME_NAME + 1]; char name[UBI_MAX_VOLUME_NAME + 1];
} __attribute__ ((packed)); } __packed;
/** /**
* struct ubi_rsvol_req - a data structure used in volume re-size requests. * struct ubi_rsvol_req - a data structure used in volume re-size requests.
...@@ -326,7 +326,7 @@ struct ubi_mkvol_req { ...@@ -326,7 +326,7 @@ struct ubi_mkvol_req {
struct ubi_rsvol_req { struct ubi_rsvol_req {
__s64 bytes; __s64 bytes;
__s32 vol_id; __s32 vol_id;
} __attribute__ ((packed)); } __packed;
/** /**
* struct ubi_rnvol_req - volumes re-name request. * struct ubi_rnvol_req - volumes re-name request.
...@@ -368,7 +368,7 @@ struct ubi_rnvol_req { ...@@ -368,7 +368,7 @@ struct ubi_rnvol_req {
__s8 padding2[2]; __s8 padding2[2];
char name[UBI_MAX_VOLUME_NAME + 1]; char name[UBI_MAX_VOLUME_NAME + 1];
} ents[UBI_MAX_RNVOL]; } ents[UBI_MAX_RNVOL];
} __attribute__ ((packed)); } __packed;
/** /**
* struct ubi_leb_change_req - a data structure used in atomic LEB change * struct ubi_leb_change_req - a data structure used in atomic LEB change
...@@ -383,7 +383,7 @@ struct ubi_leb_change_req { ...@@ -383,7 +383,7 @@ struct ubi_leb_change_req {
__s32 bytes; __s32 bytes;
__s8 dtype; __s8 dtype;
__s8 padding[7]; __s8 padding[7];
} __attribute__ ((packed)); } __packed;
/** /**
* struct ubi_map_req - a data structure used in map LEB requests. * struct ubi_map_req - a data structure used in map LEB requests.
...@@ -395,7 +395,7 @@ struct ubi_map_req { ...@@ -395,7 +395,7 @@ struct ubi_map_req {
__s32 lnum; __s32 lnum;
__s8 dtype; __s8 dtype;
__s8 padding[3]; __s8 padding[3];
} __attribute__ ((packed)); } __packed;
/** /**
...@@ -409,6 +409,6 @@ struct ubi_set_vol_prop_req { ...@@ -409,6 +409,6 @@ struct ubi_set_vol_prop_req {
__u8 property; __u8 property;
__u8 padding[7]; __u8 padding[7];
__u64 value; __u64 value;
} __attribute__ ((packed)); } __packed;
#endif /* __UBI_USER_H__ */ #endif /* __UBI_USER_H__ */
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册