summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristophe Grenier <grenier@cgsecurity.org>2016-01-23 10:03:20 +0100
committerChristophe Grenier <grenier@cgsecurity.org>2016-01-23 10:03:20 +0100
commite8a607cd05de0b9ccd600c2abdff6bf16ecd1dd0 (patch)
tree7bc2a885132013d4a69ec0e746120723d783da0c
parent92c628c50c49a96f0b2193092412d4df60d02eeb (diff)
New prototype for test_EXT2()
-rw-r--r--src/ext2.c16
-rw-r--r--src/ext2_common.c13
-rw-r--r--src/ext2_common.h2
3 files changed, 15 insertions, 16 deletions
diff --git a/src/ext2.c b/src/ext2.c
index c2b2c8c..79ce2d9 100644
--- a/src/ext2.c
+++ b/src/ext2.c
@@ -38,7 +38,7 @@
#include "log.h"
#include "guid_cpy.h"
-static int set_EXT2_info(const struct ext2_super_block *sb, partition_t *partition, const int verbose);
+static void set_EXT2_info(const struct ext2_super_block *sb, partition_t *partition, const int verbose);
int check_EXT2(disk_t *disk_car,partition_t *partition,const int verbose)
{
@@ -58,8 +58,19 @@ int check_EXT2(disk_t *disk_car,partition_t *partition,const int verbose)
return 0;
}
-static int set_EXT2_info(const struct ext2_super_block *sb, partition_t *partition, const int verbose)
+static void set_EXT2_info(const struct ext2_super_block *sb, partition_t *partition, const int verbose)
{
+ if(EXT2_HAS_RO_COMPAT_FEATURE(sb,EXT4_FEATURE_RO_COMPAT_HUGE_FILE)!=0 ||
+ EXT2_HAS_RO_COMPAT_FEATURE(sb,EXT4_FEATURE_RO_COMPAT_GDT_CSUM)!=0 ||
+ EXT2_HAS_RO_COMPAT_FEATURE(sb,EXT4_FEATURE_RO_COMPAT_DIR_NLINK)!=0 ||
+ EXT2_HAS_RO_COMPAT_FEATURE(sb,EXT4_FEATURE_RO_COMPAT_EXTRA_ISIZE)!=0 ||
+ EXT2_HAS_INCOMPAT_FEATURE(sb,EXT4_FEATURE_INCOMPAT_64BIT)!=0 ||
+ EXT2_HAS_INCOMPAT_FEATURE(sb,EXT4_FEATURE_INCOMPAT_MMP)!=0)
+ partition->upart_type=UP_EXT4;
+ else if(EXT2_HAS_COMPAT_FEATURE(sb,EXT3_FEATURE_COMPAT_HAS_JOURNAL)!=0)
+ partition->upart_type=UP_EXT3;
+ else
+ partition->upart_type=UP_EXT2;
partition->blocksize=EXT2_MIN_BLOCK_SIZE<<le32(sb->s_log_block_size);
set_part_name(partition,sb->s_volume_name,16);
/* sb->s_last_mounted seems to be unemployed in kernel 2.2.16 */
@@ -91,7 +102,6 @@ static int set_EXT2_info(const struct ext2_super_block *sb, partition_t *partiti
}
}
/* last mounted => date */
- return 0;
}
/*
diff --git a/src/ext2_common.c b/src/ext2_common.c
index 98f9514..3eaf14e 100644
--- a/src/ext2_common.c
+++ b/src/ext2_common.c
@@ -49,7 +49,7 @@ uint64_t td_ext2fs_free_blocks_count(const struct ext2_super_block *super)
(uint64_t) le32(super->s_free_blocks_hi) << 32 : 0);
}
-int test_EXT2(const struct ext2_super_block *sb, partition_t *partition)
+int test_EXT2(const struct ext2_super_block *sb, const partition_t *partition)
{
/* There is a little offset ... */
if(le16(sb->s_magic)!=EXT2_SUPER_MAGIC)
@@ -88,16 +88,5 @@ int test_EXT2(const struct ext2_super_block *sb, partition_t *partition)
partition->part_size < td_ext2fs_blocks_count(sb) *
(EXT2_MIN_BLOCK_SIZE<<le32(sb->s_log_block_size)))
return 8;
- if(EXT2_HAS_RO_COMPAT_FEATURE(sb,EXT4_FEATURE_RO_COMPAT_HUGE_FILE)!=0 ||
- EXT2_HAS_RO_COMPAT_FEATURE(sb,EXT4_FEATURE_RO_COMPAT_GDT_CSUM)!=0 ||
- EXT2_HAS_RO_COMPAT_FEATURE(sb,EXT4_FEATURE_RO_COMPAT_DIR_NLINK)!=0 ||
- EXT2_HAS_RO_COMPAT_FEATURE(sb,EXT4_FEATURE_RO_COMPAT_EXTRA_ISIZE)!=0 ||
- EXT2_HAS_INCOMPAT_FEATURE(sb,EXT4_FEATURE_INCOMPAT_64BIT)!=0 ||
- EXT2_HAS_INCOMPAT_FEATURE(sb,EXT4_FEATURE_INCOMPAT_MMP)!=0)
- partition->upart_type=UP_EXT4;
- else if(EXT2_HAS_COMPAT_FEATURE(sb,EXT3_FEATURE_COMPAT_HAS_JOURNAL)!=0)
- partition->upart_type=UP_EXT3;
- else
- partition->upart_type=UP_EXT2;
return 0;
}
diff --git a/src/ext2_common.h b/src/ext2_common.h
index 4958621..a5091ae 100644
--- a/src/ext2_common.h
+++ b/src/ext2_common.h
@@ -25,7 +25,7 @@ extern "C" {
uint64_t td_ext2fs_blocks_count(const struct ext2_super_block *super);
uint64_t td_ext2fs_free_blocks_count(const struct ext2_super_block *super);
-int test_EXT2(const struct ext2_super_block *sb, partition_t *partition);
+int test_EXT2(const struct ext2_super_block *sb, const partition_t *partition);
#ifdef __cplusplus
} /* closing brace for extern "C" */