summaryrefslogtreecommitdiffstats
path: root/src/xfs.c
diff options
context:
space:
mode:
authorChristophe Grenier <grenier@cgsecurity.org>2010-04-27 08:25:39 +0200
committerChristophe Grenier <grenier@cgsecurity.org>2010-04-27 08:25:39 +0200
commit5af560198b4ed8380f25c615cd98c1aa6c33e664 (patch)
tree15b7a1a8073bfb83abfabf1d140e964bd172e14a /src/xfs.c
parent0d8e7f149415ae0422f8a92b4036436b92ff67c2 (diff)
xfs, code cleanup
Diffstat (limited to 'src/xfs.c')
-rw-r--r--src/xfs.c41
1 files changed, 19 insertions, 22 deletions
diff --git a/src/xfs.c b/src/xfs.c
index 5b73d48..086eff1 100644
--- a/src/xfs.c
+++ b/src/xfs.c
@@ -61,30 +61,27 @@ int check_xfs(disk_t *disk_car,partition_t *partition,const int verbose)
static int test_xfs(const disk_t *disk_car, const struct xfs_sb *sb, partition_t *partition, const int verbose)
{
- if (sb->sb_magicnum==be32(XFS_SB_MAGIC))
+ if (sb->sb_magicnum!=be32(XFS_SB_MAGIC))
+ return 1;
+ switch(be16(sb->sb_versionnum) & XFS_SB_VERSION_NUMBITS)
{
- switch(be16(sb->sb_versionnum) & XFS_SB_VERSION_NUMBITS)
- {
- case XFS_SB_VERSION_1:
- partition->upart_type = UP_XFS;
- break;
- case XFS_SB_VERSION_2:
- partition->upart_type = UP_XFS2;
- break;
- case XFS_SB_VERSION_3:
- partition->upart_type = UP_XFS3;
- break;
- case XFS_SB_VERSION_4:
- partition->upart_type = UP_XFS4;
- break;
- default:
- log_error("Unknown XFS version %x\n",be16(sb->sb_versionnum)& XFS_SB_VERSION_NUMBITS);
- partition->upart_type = UP_XFS4;
- break;
- }
+ case XFS_SB_VERSION_1:
+ partition->upart_type = UP_XFS;
+ break;
+ case XFS_SB_VERSION_2:
+ partition->upart_type = UP_XFS2;
+ break;
+ case XFS_SB_VERSION_3:
+ partition->upart_type = UP_XFS3;
+ break;
+ case XFS_SB_VERSION_4:
+ partition->upart_type = UP_XFS4;
+ break;
+ default:
+ log_error("Unknown XFS version %x\n",be16(sb->sb_versionnum)& XFS_SB_VERSION_NUMBITS);
+ partition->upart_type = UP_XFS4;
+ break;
}
- else
- return 1;
if(verbose>0)
log_info("\nXFS Marker at %u/%u/%u\n", offset2cylinder(disk_car,partition->part_offset),offset2head(disk_car,partition->part_offset),offset2sector(disk_car,partition->part_offset));
return 0;