diff options
author | Etienne Brateau <etienne.brateau@gmail.com> | 2022-01-23 05:17:05 +0100 |
---|---|---|
committer | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2022-01-23 11:05:43 +0100 |
commit | 013bd5ad3fb25deabde0dfdddb2a4619db08dafc (patch) | |
tree | 0b28ac4c68a8af5400f5247687d9a8517001dc09 /ext2fs | |
parent | 2cb1b1a80d6d1934989c693d7a3a4d3f8e12935a (diff) | |
download | hurd-013bd5ad3fb25deabde0dfdddb2a4619db08dafc.tar.gz hurd-013bd5ad3fb25deabde0dfdddb2a4619db08dafc.tar.bz2 hurd-013bd5ad3fb25deabde0dfdddb2a4619db08dafc.zip |
ext2fs: use macro to check flags
* hyper.c: use macros to check flags
Message-Id: <20220123041715.19402-7-etienne.brateau@gmail.com>
Diffstat (limited to 'ext2fs')
-rw-r--r-- | ext2fs/hyper.c | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/ext2fs/hyper.c b/ext2fs/hyper.c index e77c0266..0bcf0c72 100644 --- a/ext2fs/hyper.c +++ b/ext2fs/hyper.c @@ -60,6 +60,7 @@ get_hypermetadata (void) { error_t err; size_t read = 0; + u_int32_t features; if (sblock != NULL) munmap (sblock, SBLOCK_SIZE); @@ -112,22 +113,23 @@ get_hypermetadata (void) inodes_per_block = block_size / EXT2_INODE_SIZE (sblock); frag_size = EXT2_MIN_FRAG_SIZE << sblock->s_log_frag_size; - if (frag_size) - frags_per_block = block_size / frag_size; - else + if (frag_size == 0) ext2_panic ("frag size is zero!"); + frags_per_block = block_size / frag_size; if (sblock->s_rev_level > EXT2_GOOD_OLD_REV) { - if (sblock->s_feature_incompat & ~EXT2_FEATURE_INCOMPAT_SUPP) - ext2_panic ("could not mount because of unsupported optional features" - " (0x%x)", - sblock->s_feature_incompat & ~EXT2_FEATURE_INCOMPAT_SUPP); - if (sblock->s_feature_ro_compat & ~EXT2_FEATURE_RO_COMPAT_SUPP) + features = EXT2_HAS_INCOMPAT_FEATURE(sblock, EXT2_FEATURE_INCOMPAT_UNSUPPORTED); + if (features) + ext2_panic ("could not mount because of unsupported optional features " + "(0x%x)", + features); + features = EXT2_HAS_RO_COMPAT_FEATURE(sblock, EXT2_FEATURE_RO_COMPAT_UNSUPPORTED); + if (features) { - ext2_warning ("mounted readonly because of" - " unsupported optional features (0x%x)", - sblock->s_feature_ro_compat & ~EXT2_FEATURE_RO_COMPAT_SUPP); + ext2_warning ("mounted readonly because of " + "unsupported optional features (0x%x)", + features); diskfs_readonly = 1; } if (sblock->s_inode_size != EXT2_GOOD_OLD_INODE_SIZE) |