#include #include #include #include #include #include #include #include static void emptyIT() { return; } static void hddIT() { return; } int main(int argc, char *argv[]) { unsigned int i; /* init hardware */ if(initHardware("hardware.ini") == 0) { fprintf(stderr, "Error in hardware initialization\n"); exit(EXIT_FAILURE); } /* Interreupt handlers */ for(i=0; i<16; i++) IRQVECTOR[i] = emptyIT; IRQVECTOR[HDA_IRQ] = hddIT; /* Allows all IT */ _mask(1); struct superblock_desc_t sblock; /* Charger le superblock */ if ( load_super(0, &sblock) == SBLOCK_FAILURE ) { if ( sblock.magic_key != SUPERBLOCK_MAGIC ) { printf("Pas de partition sur le disque !\n"); return EXIT_FAILURE; } } /* tentative d'allocation de tous les blocs */ printf("Tentative d'allocation de tous les blocs\n"); uint32_t b[sblock.free_space]; int count=0, expected=sblock.free_space; do { b[count] = new_block(0); if ( b[count] == 0 ) break; printf("."); fflush(stdout); count++; } while ( count < sblock.free_space ); printf("\n"); printf("%d bloc(s) alloué(s), %d attendu(s).\n", count, expected); if ( count != expected ) return EXIT_FAILURE; /* Tentative de libération de tous les blocs */ printf("Tentative de libération des %d blocs\n", count); for(i=0;i