summaryrefslogtreecommitdiffstats
path: root/src/bfs.c
diff options
context:
space:
mode:
authorChristophe Grenier <grenier@cgsecurity.org>2016-01-23 09:41:45 +0100
committerChristophe Grenier <grenier@cgsecurity.org>2016-01-23 09:41:45 +0100
commit8450d14b20a248a10ed8504d6c325a2919cbd129 (patch)
tree9f0c1aae0b9482c3f8acd649656d37c6f8c8491d /src/bfs.c
parent95b47888960c0afe846ebe39f1a196e9d8e41cae (diff)
New prototype for test_BeFS()
Diffstat (limited to 'src/bfs.c')
-rw-r--r--src/bfs.c31
1 files changed, 15 insertions, 16 deletions
diff --git a/src/bfs.c b/src/bfs.c
index b9fa52c..1854ee8 100644
--- a/src/bfs.c
+++ b/src/bfs.c
@@ -34,8 +34,8 @@
#include "fnctdsk.h"
#include "log.h"
-static int set_BeFS_info(const struct disk_super_block *beos_block, partition_t *partition);
-static int test_BeFS(disk_t *disk_car, const struct disk_super_block*beos_block,partition_t *partition, const int dump_ind);
+static void set_BeFS_info(const struct disk_super_block *beos_block, partition_t *partition);
+static int test_BeFS(disk_t *disk_car, const struct disk_super_block*beos_block, const partition_t *partition, const int dump_ind);
int check_BeFS(disk_t *disk_car,partition_t *partition)
{
@@ -66,28 +66,27 @@ int recover_BeFS(disk_t *disk_car, const struct disk_super_block *beos_block, pa
return 0;
}
-static int test_BeFS(disk_t *disk_car, const struct disk_super_block*beos_block,partition_t *partition, const int dump_ind)
+static int test_BeFS(disk_t *disk_car, const struct disk_super_block*beos_block, const partition_t *partition, const int dump_ind)
{
- if(beos_block->magic1==le32(SUPER_BLOCK_MAGIC1) &&
- beos_block->magic2==le32(SUPER_BLOCK_MAGIC2) &&
- beos_block->magic3==le32(SUPER_BLOCK_MAGIC3))
- {
- partition->upart_type=UP_BEOS;
- if(dump_ind!=0)
- {
- log_info("\nBeFS magic value at %u/%u/%u\n", offset2cylinder(disk_car,partition->part_offset),offset2head(disk_car,partition->part_offset),offset2sector(disk_car,partition->part_offset));
- dump_log(beos_block,DEFAULT_SECTOR_SIZE);
- }
+ if(beos_block->magic1!=le32(SUPER_BLOCK_MAGIC1) &&
+ beos_block->magic2!=le32(SUPER_BLOCK_MAGIC2) &&
+ beos_block->magic3!=le32(SUPER_BLOCK_MAGIC3))
+ return 1;
+ if(partition==NULL)
return 0;
+ if(dump_ind!=0)
+ {
+ log_info("\nBeFS magic value at %u/%u/%u\n", offset2cylinder(disk_car,partition->part_offset),offset2head(disk_car,partition->part_offset),offset2sector(disk_car,partition->part_offset));
+ dump_log(beos_block,DEFAULT_SECTOR_SIZE);
}
- return 1;
+ return 0;
}
-static int set_BeFS_info(const struct disk_super_block *beos_block, partition_t *partition)
+static void set_BeFS_info(const struct disk_super_block *beos_block, partition_t *partition)
{
+ partition->upart_type=UP_BEOS;
partition->blocksize= 1 << le32(beos_block->block_shift);
partition->info[0]='\0';
snprintf(partition->info, sizeof(partition->info), "BeFS blocksize=%u", partition->blocksize);
set_part_name(partition,beos_block->name,B_OS_NAME_LENGTH);
- return 0;
}