Skip to content

Commit

Permalink
UBIFS: use __packed instead of __attribute__((packed))
Browse files Browse the repository at this point in the history
There was an attempt to standartize various "__attribute__" and
other macros in order to have potentially portable and more
consistent code, see commit 82ddcb0.

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 UBIFS to use __packed, so let's do it.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
  • Loading branch information
Artem Bityutskiy authored and Artem Bityutskiy committed May 13, 2011
1 parent c436157 commit cc64f77
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions fs/ubifs/ubifs-media.h
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,7 @@ struct ubifs_ch {
__u8 node_type;
__u8 group_type;
__u8 padding[2];
} __attribute__ ((packed));
} __packed;

/**
* union ubifs_dev_desc - device node descriptor.
Expand All @@ -448,7 +448,7 @@ struct ubifs_ch {
union ubifs_dev_desc {
__le32 new;
__le64 huge;
} __attribute__ ((packed));
} __packed;

/**
* struct ubifs_ino_node - inode node.
Expand Down Expand Up @@ -509,7 +509,7 @@ struct ubifs_ino_node {
__le16 compr_type;
__u8 padding2[26]; /* Watch 'zero_ino_node_unused()' if changing! */
__u8 data[];
} __attribute__ ((packed));
} __packed;

/**
* struct ubifs_dent_node - directory entry node.
Expand All @@ -534,7 +534,7 @@ struct ubifs_dent_node {
__le16 nlen;
__u8 padding2[4]; /* Watch 'zero_dent_node_unused()' if changing! */
__u8 name[];
} __attribute__ ((packed));
} __packed;

/**
* struct ubifs_data_node - data node.
Expand All @@ -555,7 +555,7 @@ struct ubifs_data_node {
__le16 compr_type;
__u8 padding[2]; /* Watch 'zero_data_node_unused()' if changing! */
__u8 data[];
} __attribute__ ((packed));
} __packed;

/**
* struct ubifs_trun_node - truncation node.
Expand All @@ -575,7 +575,7 @@ struct ubifs_trun_node {
__u8 padding[12]; /* Watch 'zero_trun_node_unused()' if changing! */
__le64 old_size;
__le64 new_size;
} __attribute__ ((packed));
} __packed;

/**
* struct ubifs_pad_node - padding node.
Expand All @@ -586,7 +586,7 @@ struct ubifs_trun_node {
struct ubifs_pad_node {
struct ubifs_ch ch;
__le32 pad_len;
} __attribute__ ((packed));
} __packed;

/**
* struct ubifs_sb_node - superblock node.
Expand Down Expand Up @@ -644,7 +644,7 @@ struct ubifs_sb_node {
__u8 uuid[16];
__le32 ro_compat_version;
__u8 padding2[3968];
} __attribute__ ((packed));
} __packed;

/**
* struct ubifs_mst_node - master node.
Expand Down Expand Up @@ -711,7 +711,7 @@ struct ubifs_mst_node {
__le32 idx_lebs;
__le32 leb_cnt;
__u8 padding[344];
} __attribute__ ((packed));
} __packed;

/**
* struct ubifs_ref_node - logical eraseblock reference node.
Expand All @@ -727,7 +727,7 @@ struct ubifs_ref_node {
__le32 offs;
__le32 jhead;
__u8 padding[28];
} __attribute__ ((packed));
} __packed;

/**
* struct ubifs_branch - key/reference/length branch
Expand All @@ -741,7 +741,7 @@ struct ubifs_branch {
__le32 offs;
__le32 len;
__u8 key[];
} __attribute__ ((packed));
} __packed;

/**
* struct ubifs_idx_node - indexing node.
Expand All @@ -755,7 +755,7 @@ struct ubifs_idx_node {
__le16 child_cnt;
__le16 level;
__u8 branches[];
} __attribute__ ((packed));
} __packed;

/**
* struct ubifs_cs_node - commit start node.
Expand All @@ -765,7 +765,7 @@ struct ubifs_idx_node {
struct ubifs_cs_node {
struct ubifs_ch ch;
__le64 cmt_no;
} __attribute__ ((packed));
} __packed;

/**
* struct ubifs_orph_node - orphan node.
Expand All @@ -777,6 +777,6 @@ struct ubifs_orph_node {
struct ubifs_ch ch;
__le64 cmt_no;
__le64 inos[];
} __attribute__ ((packed));
} __packed;

#endif /* __UBIFS_MEDIA_H__ */

0 comments on commit cc64f77

Please sign in to comment.