New prototype for test_BSD()

This commit is contained in:
Christophe Grenier 2016-01-23 09:39:29 +01:00
parent eb48734418
commit 95b4788896

View file

@ -33,7 +33,7 @@
#include "bsd.h"
#include "intrf.h"
#include "log.h"
static int test_BSD(disk_t *disk_car, const struct disklabel*bsd_header,partition_t *partition,const int verbose, const int dump_ind, const unsigned int max_partitions);
static int test_BSD(disk_t *disk_car, const struct disklabel*bsd_header, const partition_t *partition, const int verbose, const int dump_ind, const unsigned int max_partitions);
int check_BSD(disk_t *disk_car,partition_t *partition,const int verbose, const unsigned int max_partitions)
{
@ -54,14 +54,13 @@ int check_BSD(disk_t *disk_car,partition_t *partition,const int verbose, const u
return 0;
}
static int test_BSD(disk_t *disk_car, const struct disklabel*bsd_header,partition_t *partition,const int verbose, const int dump_ind, const unsigned int max_partitions)
{
if((le32(bsd_header->d_magic) == DISKMAGIC)&&
(le32(bsd_header->d_magic2)==DISKMAGIC))
static int test_BSD(disk_t *disk_car, const struct disklabel*bsd_header, const partition_t *partition,const int verbose, const int dump_ind, const unsigned int max_partitions)
{
unsigned int i;
const uint16_t* cp;
uint16_t crc;
if(le32(bsd_header->d_magic) != DISKMAGIC || le32(bsd_header->d_magic2)!=DISKMAGIC)
return 0;
if(verbose)
log_info("\nBSD offset %lu, nbr_part %u, CHS=(%u,%u,%u) ",
(long unsigned)(partition->part_offset/disk_car->sector_size),
@ -119,18 +118,12 @@ static int test_BSD(disk_t *disk_car, const struct disklabel*bsd_header,partitio
}
if(crc)
return 1;
if(max_partitions==BSD_MAXPARTITIONS)
partition->upart_type=UP_FREEBSD;
else
partition->upart_type=UP_OPENBSD;
if(dump_ind!=0)
{
dump_log(bsd_header,DEFAULT_SECTOR_SIZE);
}
return 0;
}
return 1;
}
int recover_BSD(disk_t *disk_car, const struct disklabel*bsd_header,partition_t *partition,const int verbose, const int dump_ind)
{
@ -138,6 +131,7 @@ int recover_BSD(disk_t *disk_car, const struct disklabel*bsd_header,partition_t
int i_max_p_offset=-1;
if(test_BSD(disk_car,bsd_header,partition,verbose,dump_ind,BSD_MAXPARTITIONS)==0)
{
partition->upart_type=UP_FREEBSD;
for(i=0;i<BSD_MAXPARTITIONS;i++)
{
if(bsd_header->d_partitions[i].p_fstype>0)
@ -158,6 +152,7 @@ int recover_BSD(disk_t *disk_car, const struct disklabel*bsd_header,partition_t
}
if(test_BSD(disk_car,bsd_header,partition,verbose,dump_ind,OPENBSD_MAXPARTITIONS)==0)
{
partition->upart_type=UP_OPENBSD;
for(i=0;i<OPENBSD_MAXPARTITIONS;i++)
{
if(bsd_header->d_partitions[i].p_fstype>0)