#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, sblock2; if ( load_super(0, &sblock) == SBLOCK_FAILURE ) { if ( sblock.magic_key != SUPERBLOCK_MAGIC ) { printf("Pas de partition sur le disque !\n"); return EXIT_FAILURE; } else printf("Superbloc créé!\n"); } else printf("Superbloc chargé!\n"); printf("Modification...\n"); sblock.serial = 0x7357; save_super(0, &sblock); printf("Superbloc sauvé\n"); if ( load_super(0, &sblock2) == SBLOCK_SUCCESS ) printf("Superbloc rechargé!\n"); else { printf("Probleme au rechargement!\n"); return EXIT_FAILURE; } if ( memcmp(&sblock, &sblock2, sizeof(struct superblock_desc_t)) == 0 ) printf("Comparaison OK!\n"); else { printf("Erreur, superblocs différents\n"); return EXIT_FAILURE; } return EXIT_SUCCESS; }