Commit 99691b46 authored by Gao Xiang's avatar Gao Xiang Committed by Greg Kroah-Hartman

staging: erofs: rearrange vle clustertype definitions

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: default avatarGao Xiang <gaoxiang25@huawei.com>
Reviewed-by: default avatarChao Yu <yuchao0@huawei.com>
Signed-off-by: default avatarChao Yu <yuchao0@huawei.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent ab47dd2b
...@@ -202,6 +202,14 @@ struct erofs_extent_header { ...@@ -202,6 +202,14 @@ struct erofs_extent_header {
* di_u.delta[1] = distance to its corresponding tail cluster * di_u.delta[1] = distance to its corresponding tail cluster
* (di_advise could be 0, 1 or 2) * (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_BITS 2
#define Z_EROFS_VLE_DI_CLUSTER_TYPE_BIT 0 #define Z_EROFS_VLE_DI_CLUSTER_TYPE_BIT 0
...@@ -260,6 +268,9 @@ static inline void erofs_check_ondisk_layout_definitions(void) ...@@ -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 erofs_extent_header) != 16);
BUILD_BUG_ON(sizeof(struct z_erofs_vle_decompressed_index) != 8); BUILD_BUG_ON(sizeof(struct z_erofs_vle_decompressed_index) != 8);
BUILD_BUG_ON(sizeof(struct erofs_dirent) != 12); 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 #endif
......
...@@ -1416,14 +1416,6 @@ const struct address_space_operations z_erofs_vle_normalaccess_aops = { ...@@ -1416,14 +1416,6 @@ const struct address_space_operations z_erofs_vle_normalaccess_aops = {
#define __vle_cluster_type(advise) __vle_cluster_advise(advise, \ #define __vle_cluster_type(advise) __vle_cluster_advise(advise, \
Z_EROFS_VLE_DI_CLUSTER_TYPE_BIT, Z_EROFS_VLE_DI_CLUSTER_TYPE_BITS) 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) \ #define vle_cluster_type(di) \
__vle_cluster_type((di)->di_advise) __vle_cluster_type((di)->di_advise)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment