#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); if ( argc < 3 ) { printf("Utilisation : %s VOLUME CHEMIN\n", argv[0]); return EXIT_FAILURE; } unsigned int volume = atoi(argv[1]); if ( mount(volume) < 0 ) { printf("Erreur de montage du volume!\n"); return EXIT_FAILURE; } struct file_desc_t fd; if ( open_file(&fd, argv[2]) < 0 ) { printf("Ce chemin n'existe pas.\n"); umount(); return EXIT_FAILURE; } if ( fd.type != FILET_DIR ) { printf("Ce chemin n'est pas un répertoire.\n"); close_file(&fd); umount(); return EXIT_FAILURE; } struct entry_t ent; printf("Listing du répertoire : %s\n", argv[2]); while ( read_file(&fd, &ent, sizeof(struct entry_t)) > 0 ) { if ( ent.ent_inumber != 0 ) printf("- %s (inode %u)\n", ent.ent_basename, ent.ent_inumber); } close_file(&fd); umount(); return EXIT_SUCCESS; }