#include #include #include #include #include "mbr.h" #include "volumes.h" void format_volume(unsigned int partition) { /* TODO */ } void dump_volume(struct vol_desc_t *vol) { printf("Magic key : %x\n", vol->magic_key); printf("Num Cylindres : %u\n", vol->num_cyl); printf("Num Secteurs : %u\n", vol->num_sec); printf("Size (en secteurs) : %u\n", vol->size); switch( vol->vol_type ) { case VOLT_BASE: printf("Type : Base\n"); break; case VOLT_ANNEX: printf("Type : Annex\n"); break; case VOLT_OTHER: printf("Type : Other\n"); break; default: printf("Unrecognized volume type !\n"); } } uint16_t cylinder_of_block(unsigned int vol, uint32_t bloc) { struct mbr_desc_t mbr; load_mbr(&mbr); struct dskinfo_t info = dskinfo(); struct vol_desc_t v = mbr.volume[vol]; return v.num_cyl + ((bloc + v.num_sec) / info.nb_sec); } uint16_t sector_of_block(unsigned int vol, uint32_t block) { struct mbr_desc_t mbr; load_mbr(&mbr); struct dskinfo_t info = dskinfo(); struct vol_desc_t v = mbr.volume[vol]; return (block + v.num_sec) % info.nb_sec; }