diff --git a/tpfs/vol.c b/tpfs/vol.c index c177583444b88a1eb0cd42b7f515de92ce072c97..e1a8f44ce7d0ce93ecd2cb32aee5e3f6f518e673 100644 --- a/tpfs/vol.c +++ b/tpfs/vol.c @@ -71,4 +71,16 @@ void write_bloc(unsigned int vol, unsigned int nbloc, const unsigned char *buffe { int sector_cylinder[2] = get_sector_cylinder(vol, nbloc); // [sector, cylinder] write_sector(sector_cylinder[1], sector_cylinder[0], buffer); +} + +void format_vol(unsigned int vol) +{ + int nbloc; + vol_t current_vol = mbr.vols[vol]; + + for (nbloc = 0; nbloc < current_vol.nb_sectors; nbloc++) + { + int sector_cylinder[2] = get_sector_cylinder(vol, nbloc); + format_sector(sector_cylinder[1], sector_cylinder[1], FMT_SIZE, FMT_DATA); + } } \ No newline at end of file diff --git a/tpfs/vol.h b/tpfs/vol.h index 9966fc1e24d12fee30ac26916d87dade90825238..77abccbfd3a41b2154002ec714768dccac6c8d47 100644 --- a/tpfs/vol.h +++ b/tpfs/vol.h @@ -3,6 +3,8 @@ #define VOLS_MAX 8 #define MBR_MAGIC 0xCAFE // Savoir si le mbr a déjà été initialisé ou non +#define FMT_DATA 0xCAFEBABE +#define FMT_SIZE 0x1 static mbr_t mbr;