Lines Matching refs:tot_sectors

60 			      unsigned long *tot_sectors, int keepBoot)  in init_geometry_boot()  argument
70 assert(*tot_sectors != 0); in init_geometry_boot()
73 if (*tot_sectors <= UINT16_MAX){ in init_geometry_boot()
74 set_word(boot->boot.psect, (uint16_t) *tot_sectors); in init_geometry_boot()
76 } else if(*tot_sectors <= UINT32_MAX){ in init_geometry_boot()
78 set_dword(boot->boot.bigsect, (uint32_t) *tot_sectors); in init_geometry_boot()
80 fprintf(stderr, "Too many sectors %ld\n", *tot_sectors); in init_geometry_boot()
163 unsigned long tot_sectors, int fat32) in comp_fat_bits() argument
173 if(tot_sectors > MAX_DISK_SIZE(12, FAT12-1)) in comp_fat_bits()
175 if(fat32 || tot_sectors > MAX_DISK_SIZE(16, FAT16-1)) in comp_fat_bits()
199 if(tot_sectors < min_fat16_size) in comp_fat_bits()
202 tot_sectors >= 2* min_fat16_size) in comp_fat_bits()
230 static void calc_fat_bits2(Fs_t *Fs, unsigned long tot_sectors, int fat_bits, in calc_fat_bits2() argument
240 rem_sect = tot_sectors - Fs->dir_len - Fs->fat_start; in calc_fat_bits2()
334 static void xdf_calc_fat_size(Fs_t *Fs, unsigned long tot_sectors, in xdf_calc_fat_size() argument
339 rem_sect = tot_sectors - Fs->dir_len - Fs->fat_start - 2 * Fs->fat_len; in xdf_calc_fat_size()
362 static void calc_fat_size(Fs_t *Fs, unsigned long tot_sectors) in calc_fat_size() argument
374 fprintf(stderr, "tot_sectors=%lu\n", tot_sectors); in calc_fat_size()
377 real_rem_sect = rem_sect = tot_sectors - Fs->dir_len - Fs->fat_start; in calc_fat_size()
524 static void calc_cluster_size(struct Fs_t *Fs, unsigned long tot_sectors, in calc_cluster_size() argument
561 Fs->cluster_size = tot_sectors > 32*1024*1024*2 ? 64 : in calc_cluster_size()
562 tot_sectors > 16*1024*1024*2 ? 32 : in calc_cluster_size()
563 tot_sectors > 8*1024*1024*2 ? 16 : in calc_cluster_size()
564 tot_sectors > 260*1024*2 ? 8 : 1; in calc_cluster_size()
571 if(tot_sectors <= Fs->fat_start + Fs->num_fat + Fs->dir_len) { in calc_cluster_size()
578 rem_sect = tot_sectors - Fs->dir_len - Fs->fat_start; in calc_cluster_size()
610 static void calc_fs_parameters(struct device *dev, unsigned long tot_sectors, in calc_fs_parameters() argument
628 if(DWORD(nhs) || tot_sectors % (dev->sectors * dev->heads)) in calc_fs_parameters()
638 Fs->cluster_size = (tot_sectors > 2000 ) ? 1:2; in calc_fs_parameters()
648 Fs->dir_len = (tot_sectors > 2000) ? 32 : 7; in calc_fs_parameters()
651 calc_cluster_size(Fs, tot_sectors, dev->fat_bits); in calc_fs_parameters()
654 xdf_calc_fat_size(Fs, tot_sectors, dev->fat_bits); in calc_fs_parameters()
658 calc_fat_bits2(Fs, tot_sectors, dev->fat_bits, in calc_fs_parameters()
661 calc_fat_size(Fs, tot_sectors); in calc_fs_parameters()
670 static void calc_fs_parameters_32(unsigned long tot_sectors, in calc_fs_parameters_32() argument
680 calc_cluster_size(Fs, tot_sectors, 32); in calc_fs_parameters_32()
682 num_clus = tot_sectors / Fs->cluster_size; in calc_fs_parameters_32()
690 calc_fat_size(Fs, tot_sectors); in calc_fs_parameters_32()
787 static int get_lba_geom(Stream_t *Direct, unsigned long tot_sectors, struct device *dev, char *errm… in get_lba_geom() argument
797 if (!tot_sectors) { in get_lba_geom()
826 tot_sectors = size >> ((dev->ssize & 0x7f) - 2); in get_lba_geom()
828 tot_sectors = size << (2 - (dev->ssize & 0x7f)); in get_lba_geom()
830 tot_sectors = stbuf.st_size >> ((dev->ssize & 0x7f) + 7); in get_lba_geom()
844 tot_sectors = size >> ((dev->ssize & 0x7f) + 7); in get_lba_geom()
850 if (tot_sectors < 16*63*1024) in get_lba_geom()
852 else if (tot_sectors < 32*63*1024) in get_lba_geom()
854 else if (tot_sectors < 64*63*1024) in get_lba_geom()
856 else if (tot_sectors < 128*63*1024) in get_lba_geom()
862 tracks = (tot_sectors + dev->hidden % sect_per_track) / sect_per_track; in get_lba_geom()
903 unsigned long tot_sectors=0; in mformat() local
1000 tot_sectors = atoui(optarg); in mformat()
1156 if(argtracks && tot_sectors) { in mformat()
1242 if ((!used_dev.tracks && !tot_sectors) || in mformat()
1244 if (get_lba_geom(Fs.Direct, tot_sectors, &used_dev, in mformat()
1318 if(tot_sectors == 0) { in mformat()
1320 tot_sectors = used_dev.tracks*sect_per_track - used_dev.hidden%sect_per_track; in mformat()
1322 if (tot_sectors > 0xFFFFFFFF) { in mformat()
1331 sectorsToBytes((Stream_t*)&Fs, tot_sectors-1), in mformat()
1369 used_dev.fat_bits = comp_fat_bits(&Fs,used_dev.fat_bits, tot_sectors, fat32); in mformat()
1407 calc_fs_parameters_32(tot_sectors, &Fs, &boot); in mformat()
1439 calc_fs_parameters(&used_dev, tot_sectors, &Fs, &boot); in mformat()
1477 &tot_sectors, keepBoot); in mformat()