src/fat_adv.c: move up2power() from src/common.c
This commit is contained in:
parent
cd8d1a00d3
commit
a8b22a5eed
3 changed files with 23 additions and 24 deletions
19
src/common.c
19
src/common.c
|
@ -188,25 +188,6 @@ struct tm *localtime_r(const time_t *timep, struct tm *result)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*@
|
|
||||||
@ decreases number;
|
|
||||||
@ assigns \nothing;
|
|
||||||
@*/
|
|
||||||
static unsigned int up2power_aux(const unsigned int number)
|
|
||||||
{
|
|
||||||
if(number==0)
|
|
||||||
return 0;
|
|
||||||
else
|
|
||||||
return(1+up2power_aux(number/2));
|
|
||||||
}
|
|
||||||
|
|
||||||
unsigned int up2power(const unsigned int number)
|
|
||||||
{
|
|
||||||
if(number==0)
|
|
||||||
return 1;
|
|
||||||
return (1<<up2power_aux(number-1));
|
|
||||||
}
|
|
||||||
|
|
||||||
void set_part_name(partition_t *partition, const char *src, const unsigned int max_size)
|
void set_part_name(partition_t *partition, const char *src, const unsigned int max_size)
|
||||||
{
|
{
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
|
|
@ -525,11 +525,6 @@ struct my_data_struct
|
||||||
@*/
|
@*/
|
||||||
void *MALLOC(size_t size);
|
void *MALLOC(size_t size);
|
||||||
|
|
||||||
/*@
|
|
||||||
@ assigns \nothing;
|
|
||||||
@*/
|
|
||||||
unsigned int up2power(const unsigned int number);
|
|
||||||
|
|
||||||
/*@
|
/*@
|
||||||
@ requires \valid(partition);
|
@ requires \valid(partition);
|
||||||
@ requires valid_partition(partition);
|
@ requires valid_partition(partition);
|
||||||
|
|
|
@ -1260,6 +1260,29 @@ static void create_fat_boot_sector(disk_t *disk_car, partition_t *partition, con
|
||||||
free(newboot);
|
free(newboot);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*@
|
||||||
|
@ decreases number;
|
||||||
|
@ assigns \nothing;
|
||||||
|
@*/
|
||||||
|
static unsigned int up2power_aux(const unsigned int number)
|
||||||
|
{
|
||||||
|
if(number==0)
|
||||||
|
return 0;
|
||||||
|
else
|
||||||
|
return(1+up2power_aux(number/2));
|
||||||
|
}
|
||||||
|
|
||||||
|
/*@
|
||||||
|
@ assigns \nothing;
|
||||||
|
@*/
|
||||||
|
static unsigned int up2power(const unsigned int number)
|
||||||
|
{
|
||||||
|
if(number==0)
|
||||||
|
return 1;
|
||||||
|
return (1<<up2power_aux(number-1));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static int calcul_sectors_per_cluster(const upart_type_t upart_type, const unsigned long int data_size, const unsigned int fat_length, const unsigned int sector_size)
|
static int calcul_sectors_per_cluster(const upart_type_t upart_type, const unsigned long int data_size, const unsigned int fat_length, const unsigned int sector_size)
|
||||||
{
|
{
|
||||||
/* log_info("calcul_sectors_per_cluster data_size=%lu, fat_length=%u, sector_size=%u\n",data_size,fat_length,sector_size); */
|
/* log_info("calcul_sectors_per_cluster data_size=%lu, fat_length=%u, sector_size=%u\n",data_size,fat_length,sector_size); */
|
||||||
|
|
Loading…
Reference in a new issue