From: Jaegeuk Kim <jaegeuk@kernel.org>
To: linux-f2fs-devel@lists.sourceforge.net
Cc: Jaegeuk Kim <jaegeuk@kernel.org>, Hyojun Kim <hyojun@google.com>
Subject: [PATCH 1/2] f2fs-tools: change to use #pragma pack(push, 1)
Date: Wed, 14 Mar 2018 09:08:38 +0900 [thread overview]
Message-ID: <20180314000839.33075-1-jaegeuk@kernel.org> (raw)
From: Hyojun Kim <hyojun@google.com>
It was reported that #pragma pack(1) could create unwanted
influences. pack(push, 1) and pack(pop) are used instead.
Signed-off-by: Hyojun Kim <hyojun@google.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
---
include/f2fs_fs.h | 80 ++-----------------------------------------------------
include/quota.h | 11 ++------
2 files changed, 4 insertions(+), 87 deletions(-)
diff --git a/include/f2fs_fs.h b/include/f2fs_fs.h
index 3121e0e..c460050 100644
--- a/include/f2fs_fs.h
+++ b/include/f2fs_fs.h
@@ -569,17 +569,12 @@ enum {
/*
* For superblock
*/
-#ifdef ANDROID_WINDOWS_HOST
-#pragma pack(1)
-#endif
+#pragma pack(push, 1)
struct f2fs_device {
__u8 path[MAX_PATH_LEN];
__le32 total_segments;
} __attribute__((packed));
-#ifdef ANDROID_WINDOWS_HOST
-#pragma pack(1)
-#endif
struct f2fs_super_block {
__le32 magic; /* Magic Number */
__le16 major_ver; /* Major Version */
@@ -639,9 +634,6 @@ struct f2fs_super_block {
#define CP_ORPHAN_PRESENT_FLAG 0x00000002
#define CP_UMOUNT_FLAG 0x00000001
-#ifdef ANDROID_WINDOWS_HOST
-#pragma pack(1)
-#endif
struct f2fs_checkpoint {
__le64 checkpoint_ver; /* checkpoint block version number */
__le64 user_block_count; /* # of user blocks */
@@ -683,9 +675,6 @@ struct f2fs_checkpoint {
*/
#define F2FS_ORPHANS_PER_BLOCK 1020
-#ifdef ANDROID_WINDOWS_HOST
-#pragma pack(1)
-#endif
struct f2fs_orphan_block {
__le32 ino[F2FS_ORPHANS_PER_BLOCK]; /* inode numbers */
__le32 reserved; /* reserved */
@@ -698,9 +687,6 @@ struct f2fs_orphan_block {
/*
* For NODE structure
*/
-#ifdef ANDROID_WINDOWS_HOST
-#pragma pack(1)
-#endif
struct f2fs_extent {
__le32 fofs; /* start file offset of the extent */
__le32 blk_addr; /* start block address of the extent */
@@ -767,9 +753,6 @@ struct f2fs_extent {
#define file_is_encrypt(fi) ((fi)->i_advise & FADVISE_ENCRYPT_BIT)
#define file_enc_name(fi) ((fi)->i_advise & FADVISE_ENC_NAME_BIT)
-#ifdef ANDROID_WINDOWS_HOST
-#pragma pack(1)
-#endif
struct f2fs_inode {
__le16 i_mode; /* file mode */
__u8 i_advise; /* file hints */
@@ -813,16 +796,10 @@ struct f2fs_inode {
} __attribute__((packed));
-#ifdef ANDROID_WINDOWS_HOST
-#pragma pack(1)
-#endif
struct direct_node {
__le32 addr[ADDRS_PER_BLOCK]; /* array of data block address */
} __attribute__((packed));
-#ifdef ANDROID_WINDOWS_HOST
-#pragma pack(1)
-#endif
struct indirect_node {
__le32 nid[NIDS_PER_BLOCK]; /* array of data block address */
} __attribute__((packed));
@@ -836,9 +813,6 @@ enum {
#define XATTR_NODE_OFFSET ((((unsigned int)-1) << OFFSET_BIT_SHIFT) \
>> OFFSET_BIT_SHIFT)
-#ifdef ANDROID_WINDOWS_HOST
-#pragma pack(1)
-#endif
struct node_footer {
__le32 nid; /* node id */
__le32 ino; /* inode nunmber */
@@ -847,9 +821,6 @@ struct node_footer {
__le32 next_blkaddr; /* next node page block address */
} __attribute__((packed));
-#ifdef ANDROID_WINDOWS_HOST
-#pragma pack(1)
-#endif
struct f2fs_node {
/* can be one of three types: inode, direct, and indirect types */
union {
@@ -868,18 +839,12 @@ struct f2fs_node {
#define DEFAULT_NAT_ENTRY_RATIO 20
-#ifdef ANDROID_WINDOWS_HOST
-#pragma pack(1)
-#endif
struct f2fs_nat_entry {
__u8 version; /* latest version of cached nat entry */
__le32 ino; /* inode number */
__le32 block_addr; /* block address */
} __attribute__((packed));
-#ifdef ANDROID_WINDOWS_HOST
-#pragma pack(1)
-#endif
struct f2fs_nat_block {
struct f2fs_nat_entry entries[NAT_ENTRY_PER_BLOCK];
} __attribute__((packed));
@@ -916,18 +881,12 @@ struct f2fs_nat_block {
((le16_to_cpu((raw_sit)->vblocks) & ~SIT_VBLOCKS_MASK) \
>> SIT_VBLOCKS_SHIFT)
-#ifdef ANDROID_WINDOWS_HOST
-#pragma pack(1)
-#endif
struct f2fs_sit_entry {
__le16 vblocks; /* reference above */
__u8 valid_map[SIT_VBLOCK_MAP_SIZE]; /* bitmap for valid blocks */
__le64 mtime; /* segment age for cleaning */
} __attribute__((packed));
-#ifdef ANDROID_WINDOWS_HOST
-#pragma pack(1)
-#endif
struct f2fs_sit_block {
struct f2fs_sit_entry entries[SIT_ENTRY_PER_BLOCK];
} __attribute__((packed));
@@ -953,16 +912,10 @@ struct f2fs_sit_block {
#define SUM_ENTRIES_SIZE (SUMMARY_SIZE * ENTRIES_IN_SUM)
/* a summary entry for a 4KB-sized block in a segment */
-#ifdef ANDROID_WINDOWS_HOST
-#pragma pack(1)
-#endif
struct f2fs_summary {
__le32 nid; /* parent node id */
union {
__u8 reserved[3];
-#ifdef ANDROID_WINDOWS_HOST
-#pragma pack(1)
-#endif
struct {
__u8 version; /* node version number */
__le16 ofs_in_node; /* block index in parent node */
@@ -974,9 +927,6 @@ struct f2fs_summary {
#define SUM_TYPE_NODE (1)
#define SUM_TYPE_DATA (0)
-#ifdef ANDROID_WINDOWS_HOST
-#pragma pack(1)
-#endif
struct summary_footer {
unsigned char entry_type; /* SUM_TYPE_XXX */
__le32 check_sum; /* summary checksum */
@@ -1008,49 +958,31 @@ enum {
SIT_JOURNAL
};
-#ifdef ANDROID_WINDOWS_HOST
-#pragma pack(1)
-#endif
struct nat_journal_entry {
__le32 nid;
struct f2fs_nat_entry ne;
} __attribute__((packed));
-#ifdef ANDROID_WINDOWS_HOST
-#pragma pack(1)
-#endif
struct nat_journal {
struct nat_journal_entry entries[NAT_JOURNAL_ENTRIES];
__u8 reserved[NAT_JOURNAL_RESERVED];
} __attribute__((packed));
-#ifdef ANDROID_WINDOWS_HOST
-#pragma pack(1)
-#endif
struct sit_journal_entry {
__le32 segno;
struct f2fs_sit_entry se;
} __attribute__((packed));
-#ifdef ANDROID_WINDOWS_HOST
-#pragma pack(1)
-#endif
struct sit_journal {
struct sit_journal_entry entries[SIT_JOURNAL_ENTRIES];
__u8 reserved[SIT_JOURNAL_RESERVED];
} __attribute__((packed));
-#ifdef ANDROID_WINDOWS_HOST
-#pragma pack(1)
-#endif
struct f2fs_extra_info {
__le64 kbytes_written;
__u8 reserved[EXTRA_INFO_RESERVED];
} __attribute__((packed));
-#ifdef ANDROID_WINDOWS_HOST
-#pragma pack(1)
-#endif
struct f2fs_journal {
union {
__le16 n_nats;
@@ -1065,9 +997,6 @@ struct f2fs_journal {
} __attribute__((packed));
/* 4KB-sized summary block structure */
-#ifdef ANDROID_WINDOWS_HOST
-#pragma pack(1)
-#endif
struct f2fs_summary_block {
struct f2fs_summary entries[ENTRIES_IN_SUM];
struct f2fs_journal journal;
@@ -1107,9 +1036,6 @@ typedef __le32 f2fs_hash_t;
NR_DENTRY_IN_BLOCK + SIZE_OF_DENTRY_BITMAP))
/* One directory entry slot representing F2FS_SLOT_LEN-sized file name */
-#ifdef ANDROID_WINDOWS_HOST
-#pragma pack(1)
-#endif
struct f2fs_dir_entry {
__le32 hash_code; /* hash code of file name */
__le32 ino; /* inode number */
@@ -1118,9 +1044,6 @@ struct f2fs_dir_entry {
} __attribute__((packed));
/* 4KB-sized directory entry block */
-#ifdef ANDROID_WINDOWS_HOST
-#pragma pack(1)
-#endif
struct f2fs_dentry_block {
/* validity bitmap for directory entries in each block */
__u8 dentry_bitmap[SIZE_OF_DENTRY_BITMAP];
@@ -1128,6 +1051,7 @@ struct f2fs_dentry_block {
struct f2fs_dir_entry dentry[NR_DENTRY_IN_BLOCK];
__u8 filename[NR_DENTRY_IN_BLOCK][F2FS_SLOT_LEN];
} __attribute__((packed));
+#pragma pack(pop)
/* for inline stuff */
#define DEF_INLINE_RESERVED_SIZE 1
diff --git a/include/quota.h b/include/quota.h
index cfb9861..f578621 100644
--- a/include/quota.h
+++ b/include/quota.h
@@ -44,18 +44,13 @@ enum quota_type {
#define QT_TREEOFF 1 /* Offset of tree in file in blocks */
-#ifdef ANDROID_WINDOWS_HOST
-#pragma pack(1)
-#endif
+#pragma pack(push, 1)
struct v2_disk_dqheader {
u_int32_t dqh_magic; /* Magic number identifying file */
u_int32_t dqh_version; /* File version */
} __attribute__ ((packed));
/* Header with type and version specific information */
-#ifdef ANDROID_WINDOWS_HOST
-#pragma pack(1)
-#endif
struct v2_disk_dqinfo {
u_int32_t dqi_bgrace; /* Time before block soft limit becomes hard limit */
u_int32_t dqi_igrace; /* Time before inode soft limit becomes hard limit */
@@ -65,9 +60,6 @@ struct v2_disk_dqinfo {
u_int32_t dqi_free_entry; /* Number of block with at least one free entry */
} __attribute__ ((packed));
-#ifdef ANDROID_WINDOWS_HOST
-#pragma pack(1)
-#endif
struct v2r1_disk_dqblk {
__le32 dqb_id; /* id this quota applies to */
__le32 dqb_pad;
@@ -82,5 +74,6 @@ struct v2r1_disk_dqblk {
__le64 dqb_btime; /* time limit for excessive disk use */
__le64 dqb_itime; /* time limit for excessive inode use */
} __attribute__ ((packed));
+#pragma pack(pop)
#endif
--
2.15.0.531.g2ccb3012c9-goog
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
next reply other threads:[~2018-03-14 0:08 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-14 0:08 Jaegeuk Kim [this message]
2018-03-14 0:08 ` [PATCH 2/2] tools: sg_write_buffer: add sg_write_buffer for FFU Jaegeuk Kim
2018-03-14 2:10 ` Junling Zheng
2018-03-14 4:27 ` [PATCH 2/2 v2] " Jaegeuk Kim
2018-03-16 8:29 ` [PATCH 2/2] " Chao Yu
2018-03-17 4:59 ` Jaegeuk Kim
2018-03-19 2:40 ` Chao Yu
2018-03-16 8:26 ` [PATCH 1/2] f2fs-tools: change to use #pragma pack(push, 1) Chao Yu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180314000839.33075-1-jaegeuk@kernel.org \
--to=jaegeuk@kernel.org \
--cc=hyojun@google.com \
--cc=linux-f2fs-devel@lists.sourceforge.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).