/* Create a fresh FAT filesystem on a block device (floppy = FAT12 superfloppy, * IDE = MBR + single FAT16/32 partition). */ #ifndef FATFORMAT_H #define FATFORMAT_H #include "blkdev.h" /* Format device d. Returns 0 on success, -1 on error. `limit_sectors` * (0 = the whole device) caps the partition size; useful for testing or for * reserving part of a large disk for another filesystem. */ int fat_format(blk_dev_t *d); int fat_format_limited(blk_dev_t *d, unsigned int limit_sectors); /* Format one partition region without touching the MBR. `label` is an * 11-byte FAT volume label (NULL keeps it blank); `type_out` receives the * chosen FAT type (12/16/32) so the caller can build the MBR entry. */ int fat_format_partition(blk_dev_t *d, unsigned int part_lba, unsigned int sectors, const char *label, unsigned int *type_out); /* Decimal helper for the format messages (terminal + netlog mirror). */ void format_putdec(unsigned int v); /* Set while a destructive format owns the disks. Filesystem syscalls wait * for it instead of touching a half-written FAT; the owner is exempt. */ extern volatile int format_busy; extern volatile unsigned int format_owner_pid; #endif