linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Gao Xiang <gaoxiang25@huawei.com>
To: Chao Yu <yuchao0@huawei.com>,
	Dan Carpenter <dan.carpenter@oracle.com>,
	Christoph Hellwig <hch@infradead.org>,
	Joe Perches <joe@perches.com>,
	"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
	<devel@driverdev.osuosl.org>
Cc: LKML <linux-kernel@vger.kernel.org>,
	<linux-erofs@lists.ozlabs.org>, "Chao Yu" <chao@kernel.org>,
	Miao Xie <miaoxie@huawei.com>, <weidu.du@huawei.com>,
	Fang Wei <fangwei1@huawei.com>, Gao Xiang <gaoxiang25@huawei.com>
Subject: [PATCH v2 3/7] erofs: use a better form for complicated on-disk fields
Date: Fri, 30 Aug 2019 11:00:36 +0800	[thread overview]
Message-ID: <20190830030040.10599-3-gaoxiang25@huawei.com> (raw)
In-Reply-To: <20190830030040.10599-1-gaoxiang25@huawei.com>

As Joe Perches [1] suggested, let's use a better
form to describe complicated on-disk fields.

p.s. it has different tab alignment looking between
     the real file and patch file.
p.p.s. due to changing a different form, some lines
       have to exceed 80 characters.
[1] https://lore.kernel.org/r/67d6efbbc9ac6db23215660cb970b7ef29dc0c1d.camel@perches.com/
Reported-by: Joe Perches <joe@perches.com>
Signed-off-by: Gao Xiang <gaoxiang25@huawei.com>
---
new patch.

 fs/erofs/erofs_fs.h | 100 ++++++++++++++++++++++----------------------
 1 file changed, 50 insertions(+), 50 deletions(-)

diff --git a/fs/erofs/erofs_fs.h b/fs/erofs/erofs_fs.h
index 41e53b49a11b..76edc595cc4a 100644
--- a/fs/erofs/erofs_fs.h
+++ b/fs/erofs/erofs_fs.h
@@ -17,27 +17,27 @@
 #define EROFS_REQUIREMENT_LZ4_0PADDING	0x00000001
 #define EROFS_ALL_REQUIREMENTS		EROFS_REQUIREMENT_LZ4_0PADDING
 
-struct erofs_super_block {
-/*  0 */__le32 magic;           /* in the little endian */
-/*  4 */__le32 checksum;        /* crc32c(super_block) */
-/*  8 */__le32 features;        /* (aka. feature_compat) */
-/* 12 */__u8 blkszbits;         /* support block_size == PAGE_SIZE only */
-/* 13 */__u8 reserved;
-
-/* 14 */__le16 root_nid;
-/* 16 */__le64 inos;            /* total valid ino # (== f_files - f_favail) */
-
-/* 24 */__le64 build_time;      /* inode v1 time derivation */
-/* 32 */__le32 build_time_nsec;
-/* 36 */__le32 blocks;          /* used for statfs */
-/* 40 */__le32 meta_blkaddr;
-/* 44 */__le32 xattr_blkaddr;
-/* 48 */__u8 uuid[16];          /* 128-bit uuid for volume */
-/* 64 */__u8 volume_name[16];   /* volume name */
-/* 80 */__le32 requirements;    /* (aka. feature_incompat) */
-
-/* 84 */__u8 reserved2[44];
-} __packed;                     /* 128 bytes */
+struct erofs_super_block {	/* off description */
+	__le32 magic;		/*  0  file system magic number */
+	__le32 checksum;	/*  4  crc32c(super_block) */
+	__le32 features;	/*  8  (aka. feature_compat) */
+	__u8 blkszbits;		/* 12  support PAGE_SIZE only currently */
+	__u8 reserved;		/* 13  */
+
+	__le16 root_nid;	/* 14  nid of root directory */
+	__le64 inos;		/* 16  total valid ino # (== f_files - f_favail) */
+
+	__le64 build_time;	/* 24  inode v1 time derivation */
+	__le32 build_time_nsec;	/* 32  inode v1 time derivation in nano scale */
+	__le32 blocks;		/* 36  used for statfs */
+	__le32 meta_blkaddr;	/* 40  start block address of metadata area */
+	__le32 xattr_blkaddr;	/* 44  start block address of shared xattr area */
+	__u8 uuid[16];		/* 48  128-bit uuid for volume */
+	__u8 volume_name[16];	/* 64  volume name */
+	__le32 requirements;	/* 80  (aka. feature_incompat) */
+
+	__u8 reserved2[44];	/* 84 */
+} __packed;			/* 128 bytes */
 
 /*
  * erofs inode data mapping:
@@ -73,16 +73,16 @@ static inline bool erofs_inode_is_data_compressed(unsigned int datamode)
 #define EROFS_I_VERSION_BIT             0
 #define EROFS_I_DATA_MAPPING_BIT        1
 
-struct erofs_inode_v1 {
-/*  0 */__le16 i_advise;
+struct erofs_inode_v1 {		/* off description */
+	__le16 i_advise;	/*  0  file hints */
 
 /* 1 header + n-1 * 4 bytes inline xattr to keep continuity */
-/*  2 */__le16 i_xattr_icount;
-/*  4 */__le16 i_mode;
-/*  6 */__le16 i_nlink;
-/*  8 */__le32 i_size;
-/* 12 */__le32 i_reserved;
-/* 16 */union {
+	__le16 i_xattr_icount;	/*  2  encoding for xattr ibody size */
+	__le16 i_mode;		/*  4 */
+	__le16 i_nlink;		/*  6 */
+	__le32 i_size;		/*  8 */
+	__le32 i_reserved;	/* 12 */
+	union {			/* 16 */
 		/* file total compressed blocks for data mapping 1 */
 		__le32 compressed_blocks;
 		__le32 raw_blkaddr;
@@ -90,26 +90,26 @@ struct erofs_inode_v1 {
 		/* for device files, used to indicate old/new device # */
 		__le32 rdev;
 	} i_u __packed;
-/* 20 */__le32 i_ino;           /* only used for 32-bit stat compatibility */
-/* 24 */__le16 i_uid;
-/* 26 */__le16 i_gid;
-/* 28 */__le32 i_reserved2;
-} __packed;
+	__le32 i_ino;		/* 20 only used for 32-bit stat compatibility */
+	__le16 i_uid;		/* 24 */
+	__le16 i_gid;		/* 26 */
+	__le32 i_reserved2;	/* 28 */
+} __packed;			/* 32 bytes */
 
 /* 32 bytes on-disk inode */
 #define EROFS_INODE_LAYOUT_V1   0
 /* 64 bytes on-disk inode */
 #define EROFS_INODE_LAYOUT_V2   1
 
-struct erofs_inode_v2 {
-/*  0 */__le16 i_advise;
+struct erofs_inode_v2 {		/* off description */
+	__le16 i_advise;	/*  0  file hints */
 
 /* 1 header + n-1 * 4 bytes inline xattr to keep continuity */
-/*  2 */__le16 i_xattr_icount;
-/*  4 */__le16 i_mode;
-/*  6 */__le16 i_reserved;
-/*  8 */__le64 i_size;
-/* 16 */union {
+	__le16 i_xattr_icount;	/*  2  encoding for xattr ibody size */
+	__le16 i_mode;		/*  4 */
+	__le16 i_reserved;	/*  6 */
+	__le64 i_size;		/*  8 */
+	union {			/* 16 */
 		/* file total compressed blocks for data mapping 1 */
 		__le32 compressed_blocks;
 		__le32 raw_blkaddr;
@@ -119,15 +119,15 @@ struct erofs_inode_v2 {
 	} i_u __packed;
 
 	/* only used for 32-bit stat compatibility */
-/* 20 */__le32 i_ino;
-
-/* 24 */__le32 i_uid;
-/* 28 */__le32 i_gid;
-/* 32 */__le64 i_ctime;
-/* 40 */__le32 i_ctime_nsec;
-/* 44 */__le32 i_nlink;
-/* 48 */__u8   i_reserved2[16];
-} __packed;                     /* 64 bytes */
+	__le32 i_ino;		/* 20 only used for 32-bit stat compatibility */
+
+	__le32 i_uid;		/* 24 */
+	__le32 i_gid;		/* 28 */
+	__le64 i_ctime;		/* 32 */
+	__le32 i_ctime_nsec;	/* 40 */
+	__le32 i_nlink;		/* 44 */
+	__u8   i_reserved2[16];	/* 48 */
+} __packed;			/* 64 bytes */
 
 #define EROFS_MAX_SHARED_XATTRS         (128)
 /* h_shared_count between 129 ... 255 are special # */
-- 
2.17.1


  parent reply	other threads:[~2019-08-30  3:01 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-30  3:00 [PATCH v2 1/7] erofs: on-disk format should have explicitly assigned numbers Gao Xiang
2019-08-30  3:00 ` [PATCH v2 2/7] erofs: some marcos are much more readable as a function Gao Xiang
2019-08-30  3:16   ` Joe Perches
2019-08-30  3:20     ` Gao Xiang
2019-08-30  3:36       ` [PATCH v3 1/7] erofs: on-disk format should have explicitly assigned numbers Gao Xiang
2019-08-30  3:36         ` [PATCH v3 2/7] erofs: some macros are much more readable as a function Gao Xiang
2019-08-30  3:38           ` [PATCH v4 " Gao Xiang
2019-08-30  6:11           ` [PATCH v3 " Chao Yu
2019-08-30  3:36         ` [PATCH v3 3/7] erofs: use a better form for complicated on-disk fields Gao Xiang
2019-08-30  3:36         ` [PATCH v3 4/7] erofs: kill __packed for on-disk structures Gao Xiang
2019-08-30  6:16           ` Chao Yu
2019-08-30  3:36         ` [PATCH v3 5/7] erofs: kill erofs_{init,exit}_inode_cache Gao Xiang
2019-08-30  6:17           ` Chao Yu
2019-08-30  3:36         ` [PATCH v3 6/7] erofs: remove all likely/unlikely annotations Gao Xiang
2019-08-30  6:25           ` Chao Yu
2019-08-30  6:31             ` Gao Xiang
2019-08-30  6:43               ` Chao Yu
2019-08-30 11:55             ` Dan Carpenter
2019-08-30 11:30           ` Dan Carpenter
2019-08-30 12:06             ` Gao Xiang
2019-08-30 15:46           ` Christoph Hellwig
2019-08-30 16:04             ` Gao Xiang
2019-08-31 10:57               ` Dan Carpenter
2019-08-30  3:36         ` [PATCH v3 7/7] erofs: redundant assignment in __erofs_get_meta_page() Gao Xiang
2019-08-30  6:25           ` Chao Yu
2019-08-30 16:28           ` Christoph Hellwig
2019-08-30 16:48             ` Gao Xiang
2019-08-30 15:25         ` [PATCH v3 1/7] erofs: on-disk format should have explicitly assigned numbers Gao Xiang
2019-08-30 15:45     ` [PATCH v2 2/7] erofs: some marcos are much more readable as a function Christoph Hellwig
2019-08-30 15:52       ` Gao Xiang
2019-08-30 15:56         ` Gao Xiang
2019-08-30  3:00 ` Gao Xiang [this message]
2019-08-30  3:29   ` [PATCH v2 3/7] erofs: use a better form for complicated on-disk fields Chao Yu
2019-08-30  3:00 ` [PATCH v2 4/7] erofs: kill __packed for on-disk structures Gao Xiang
2019-08-30  3:00 ` [PATCH v2 5/7] erofs: kill erofs_{init,exit}_inode_cache Gao Xiang
2019-08-30  3:00 ` [PATCH v2 6/7] erofs: remove all likely/unlikely annotations Gao Xiang
2019-08-30  3:00 ` [PATCH v2 7/7] erofs: reduntant assignment in __erofs_get_meta_page() Gao Xiang
2019-08-30  3:28 ` [PATCH v2 1/7] erofs: on-disk format should have explicitly assigned numbers 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=20190830030040.10599-3-gaoxiang25@huawei.com \
    --to=gaoxiang25@huawei.com \
    --cc=chao@kernel.org \
    --cc=dan.carpenter@oracle.com \
    --cc=devel@driverdev.osuosl.org \
    --cc=fangwei1@huawei.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=hch@infradead.org \
    --cc=joe@perches.com \
    --cc=linux-erofs@lists.ozlabs.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=miaoxie@huawei.com \
    --cc=weidu.du@huawei.com \
    --cc=yuchao0@huawei.com \
    /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).