summaryrefslogtreecommitdiffstats
path: root/src/btrfs.c
diff options
context:
space:
mode:
authorChristophe Grenier <grenier@cgsecurity.org>2016-01-23 09:42:39 +0100
committerChristophe Grenier <grenier@cgsecurity.org>2016-01-23 09:42:39 +0100
commit373a7ce36d46ca14cfa982fba66531cb1660c646 (patch)
treef70986a73e1d123b438bde47177d0b2d09b41904 /src/btrfs.c
parent8450d14b20a248a10ed8504d6c325a2919cbd129 (diff)
New prototype for test_btrfs()
Diffstat (limited to 'src/btrfs.c')
-rw-r--r--src/btrfs.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/src/btrfs.c b/src/btrfs.c
index 79b6117..062b52e 100644
--- a/src/btrfs.c
+++ b/src/btrfs.c
@@ -37,10 +37,11 @@
#include "log.h"
#include "guid_cpy.h"
-static int test_btrfs(const struct btrfs_super_block *sb, partition_t *partition);
+static int test_btrfs(const struct btrfs_super_block *sb);
-static int set_btrfs_info(const struct btrfs_super_block *sb, partition_t *partition)
+static void set_btrfs_info(const struct btrfs_super_block *sb, partition_t *partition)
{
+ partition->upart_type=UP_BTRFS;
partition->blocksize=le32(sb->dev_item.sector_size);
set_part_name(partition, sb->label, sizeof(sb->label));
snprintf(partition->info, sizeof(partition->info), "btrfs blocksize=%u", partition->blocksize);
@@ -49,7 +50,6 @@ static int set_btrfs_info(const struct btrfs_super_block *sb, partition_t *parti
strcat(partition->info," Backup superblock");
}
/* last mounted => date */
- return 0;
}
int check_btrfs(disk_t *disk_car,partition_t *partition)
@@ -60,7 +60,7 @@ int check_btrfs(disk_t *disk_car,partition_t *partition)
free(buffer);
return 1;
}
- if(test_btrfs((struct btrfs_super_block*)buffer, partition)!=0)
+ if(test_btrfs((struct btrfs_super_block*)buffer)!=0)
{
free(buffer);
return 1;
@@ -76,7 +76,7 @@ Group 0 begin at s_first_data_block
*/
int recover_btrfs(disk_t *disk, const struct btrfs_super_block *sb, partition_t *partition, const int verbose, const int dump_ind)
{
- if(test_btrfs(sb, partition)!=0)
+ if(test_btrfs(sb)!=0)
return 1;
if(dump_ind!=0)
{
@@ -112,12 +112,11 @@ int recover_btrfs(disk_t *disk, const struct btrfs_super_block *sb, partition_t
return 0;
}
-static int test_btrfs(const struct btrfs_super_block *sb, partition_t *partition)
+static int test_btrfs(const struct btrfs_super_block *sb)
{
if(memcmp(&sb->magic, BTRFS_MAGIC, 8)!=0)
return 1;
if(le32(sb->dev_item.sector_size)==0)
return 1;
- partition->upart_type=UP_BTRFS;
return 0;
}