From: Chao Yu <chao@kernel.org>
To: gregkh@linuxfoundation.org, devel@driverdev.osuosl.org
Cc: linux-erofs@lists.ozlabs.org, linux-kernel@vger.kernel.org,
Gao Xiang <gaoxiang25@huawei.com>, Chao Yu <yuchao0@huawei.com>
Subject: [PATCH 5/9] staging: erofs: rearrange vle clustertype definitions
Date: Tue, 21 Aug 2018 22:49:33 +0800 [thread overview]
Message-ID: <20180821144937.20555-6-chao@kernel.org> (raw)
In-Reply-To: <20180821144937.20555-1-chao@kernel.org>
From: Gao Xiang <gaoxiang25@huawei.com>
This patch moves vle clustertype definitions to erofs_fs.h
since they are part of on-disk format.
It also adds compile time check for Z_EROFS_VLE_DI_CLUSTER_TYPE_BITS
Signed-off-by: Gao Xiang <gaoxiang25@huawei.com>
Reviewed-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Chao Yu <yuchao0@huawei.com>
---
drivers/staging/erofs/erofs_fs.h | 11 +++++++++++
drivers/staging/erofs/unzip_vle.c | 8 --------
2 files changed, 11 insertions(+), 8 deletions(-)
diff --git a/drivers/staging/erofs/erofs_fs.h b/drivers/staging/erofs/erofs_fs.h
index 2f8e2bf70941..d4bffa2852b3 100644
--- a/drivers/staging/erofs/erofs_fs.h
+++ b/drivers/staging/erofs/erofs_fs.h
@@ -202,6 +202,14 @@ struct erofs_extent_header {
* di_u.delta[1] = distance to its corresponding tail cluster
* (di_advise could be 0, 1 or 2)
*/
+enum {
+ Z_EROFS_VLE_CLUSTER_TYPE_PLAIN,
+ Z_EROFS_VLE_CLUSTER_TYPE_HEAD,
+ Z_EROFS_VLE_CLUSTER_TYPE_NONHEAD,
+ Z_EROFS_VLE_CLUSTER_TYPE_RESERVED,
+ Z_EROFS_VLE_CLUSTER_TYPE_MAX
+};
+
#define Z_EROFS_VLE_DI_CLUSTER_TYPE_BITS 2
#define Z_EROFS_VLE_DI_CLUSTER_TYPE_BIT 0
@@ -260,6 +268,9 @@ static inline void erofs_check_ondisk_layout_definitions(void)
BUILD_BUG_ON(sizeof(struct erofs_extent_header) != 16);
BUILD_BUG_ON(sizeof(struct z_erofs_vle_decompressed_index) != 8);
BUILD_BUG_ON(sizeof(struct erofs_dirent) != 12);
+
+ BUILD_BUG_ON(BIT(Z_EROFS_VLE_DI_CLUSTER_TYPE_BITS) <
+ Z_EROFS_VLE_CLUSTER_TYPE_MAX - 1);
}
#endif
diff --git a/drivers/staging/erofs/unzip_vle.c b/drivers/staging/erofs/unzip_vle.c
index 5032b3b05de1..f597f079d579 100644
--- a/drivers/staging/erofs/unzip_vle.c
+++ b/drivers/staging/erofs/unzip_vle.c
@@ -1416,14 +1416,6 @@ const struct address_space_operations z_erofs_vle_normalaccess_aops = {
#define __vle_cluster_type(advise) __vle_cluster_advise(advise, \
Z_EROFS_VLE_DI_CLUSTER_TYPE_BIT, Z_EROFS_VLE_DI_CLUSTER_TYPE_BITS)
-enum {
- Z_EROFS_VLE_CLUSTER_TYPE_PLAIN,
- Z_EROFS_VLE_CLUSTER_TYPE_HEAD,
- Z_EROFS_VLE_CLUSTER_TYPE_NONHEAD,
- Z_EROFS_VLE_CLUSTER_TYPE_RESERVED,
- Z_EROFS_VLE_CLUSTER_TYPE_MAX
-};
-
#define vle_cluster_type(di) \
__vle_cluster_type((di)->di_advise)
--
2.18.0
next prev parent reply other threads:[~2018-08-21 14:50 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-08-21 14:49 [PATCH v2 0/9] staging: erofs: fix some issues and clean up codes Chao Yu
2018-08-21 14:49 ` [PATCH 1/9] staging: erofs: introduce erofs_grab_bio Chao Yu
2018-08-21 14:49 ` [PATCH 2/9] staging: erofs: separate erofs_get_meta_page Chao Yu
2018-08-21 14:49 ` [PATCH 3/9] staging: erofs: add error handling for xattr submodule Chao Yu
2018-08-21 14:49 ` [PATCH 4/9] staging: erofs: cleanup z_erofs_vle_work_{lookup, register} Chao Yu
2018-08-21 14:49 ` Chao Yu [this message]
2018-08-21 14:49 ` [PATCH 6/9] staging: erofs: fix vle_decompressed_index_clusterofs Chao Yu
2018-08-21 14:49 ` [PATCH 7/9] staging: erofs: fix integer overflow on 32-bit platform Chao Yu
2018-08-21 14:49 ` [PATCH 8/9] staging: erofs: fix compression mapping beyond EOF Chao Yu
2018-08-21 14:49 ` [PATCH 9/9] staging: erofs: fix potential overflow in erofs_grab_bio() 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=20180821144937.20555-6-chao@kernel.org \
--to=chao@kernel.org \
--cc=devel@driverdev.osuosl.org \
--cc=gaoxiang25@huawei.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-erofs@lists.ozlabs.org \
--cc=linux-kernel@vger.kernel.org \
--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).