If you want to mointer the format progress,
just modify write_table function in mkdosfs.c :
static void
write_tables (void)
{
int x;
int fat_length;
fat_length = (size_fat == 32) ?
CF_LE_L(bs.fat32.fat32_length) : CF_LE_W(bs.fat_length);
seekto( 0, "start of device" );
/* tell the number of printed hash marks */
char buf[20];
snprintf(buf, 19, "%d\n", reserved_sectors + nr_fats + 3);
buf[19] = '\0';
write(STDERR_FILENO, buf, strlen(buf));
/* clear all reserved sectors */
write(STDERR_FILENO, "S", 1);
for( x = 0; x < reserved_sectors; ++x ){
writebuf( blank_sector, sector_size, "reserved sector" );
write(STDERR_FILENO, "=", 1);
}
/* seek back to sector 0 and write the boot sector */
seekto( 0, "boot sector" );
writebuf( (char *) &bs, sizeof (struct msdos_boot_sector), "boot sector" );
write(STDERR_FILENO, "=", 1);
/* on FAT32, write the info sector and backup boot sector */
if (size_fat == 32)
{
seekto( CF_LE_W(bs.fat32.info_sector)*sector_size, "info sector" );
writebuf( info_sector, 512, "info sector" );
if (backup_boot != 0)
{
seekto( backup_boot*sector_size, "backup boot sector" );
writebuf( (char *) &bs, sizeof (struct msdos_boot_sector),
"backup boot sector" );
}
}
write(STDERR_FILENO, "=", 1);
/* seek to start of FATS and write them all */
seekto( reserved_sectors*sector_size, "first FAT" );
for (x = 1; x <= nr_fats; x++){
writebuf( fat, fat_length * sector_size, "FAT" );
write(STDERR_FILENO, "=", 1);
}
/* Write the root directory directly after the last FAT. This is the root
* dir area on FAT12/16, and the first cluster on FAT32. */
writebuf( (char *) root_dir, size_root_dir, "root directory" );
write(STDERR_FILENO, "=", 1);
write(STDERR_FILENO, "E", 1);
if (blank_sector) free( blank_sector );
if (info_sector) free( info_sector );
free (root_dir); /* Free up the root directory space from setup_tables */
free (fat); /* Free up the fat table space reserved during setup_tables */
}
風花水月六十石
15 年前
沒有留言:
張貼留言