#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 mbr_desc_t mbr, mbr2; mbr.magic_key = MBR_MAGIC; strcpy(mbr.name, "blub"); mbr.vol_count = 2; mbr.volume[0].magic_key = VOLUME_MAGIC; mbr.volume[0].num_cyl = 1; mbr.volume[0].num_sec = 1; mbr.volume[0].size = 3; mbr.volume[0].vol_type = VOLT_BASE; mbr.volume[1].magic_key = VOLUME_MAGIC; mbr.volume[1].num_cyl = 2; mbr.volume[1].num_sec = 2; mbr.volume[1].size = 10; mbr.volume[1].vol_type = VOLT_BASE; if ( save_mbr(&mbr) == MBR_SUCCESS ) printf("Ecriture MBR ok\n"); else printf("Impossible d'écrire le MBR\n"); if ( load_mbr(&mbr2) == MBR_SUCCESS ) printf("Lecture MBR ok\n"); else printf("Impossible de lire le MBR\n"); dump_mbr(&mbr); if ( memcmp(&mbr, &mbr2, sizeof(struct mbr_desc_t)) != 0 ) { printf("Erreur de comparaison!\n"); return EXIT_FAILURE; } return EXIT_SUCCESS; }