/* load super bloc of the $CURRENT_VOLUME set current_volume accordingly */ static void load_current_volume () { char* current_volume_str; int status; current_volume_str = getenv("CURRENT_VOLUME"); ffatal(current_volume_str != NULL, "no definition of $CURRENT_VOLUME"); errno = 0; current_volume = strtol(current_volume_str, NULL, 10); ffatal(!errno, "bad value of $CURRENT_VOLUME %s", current_volume_str); status = load_super(current_volume); ffatal(!status, "unable to load super of vol %d", current_volume); }
int delete_ifile(unsigned int inumber) { int status; status = delete_inode(inumber); ffatal(status == RETURN_SUCCESS, "unable to delete inode"); return RETURN_SUCCESS; }
unsigned int create_ifile(enum file_type_e type) { unsigned int inumber; inumber = create_inode(type); ffatal(inumber, "unable to create inode"); return inumber; }
static void cfile(unsigned int sinumber) { file_desc_t sfd, dfd; unsigned int dinumber; int status; int c; dinumber = create_ifile(FT_STD); ffatal(dinumber, "erreur creation fichier"); printf("%d\n", dinumber); status = open_ifile(&dfd, dinumber); ffatal(!status, "erreur ouverture fichier %d", dinumber); status = open_ifile(&sfd, sinumber); ffatal(!status, "erreur ouverture fichier %d", sinumber); while((c=readc_ifile(&sfd)) != READ_EOF) writec_ifile(&dfd, c); close_ifile(&dfd); close_ifile(&sfd); }
/* ------------------------------ Initialization and finalization fucntions ------------------------------------------------------------*/ void mount() { char *hw_config; int status, i; /* Hardware initialization */ hw_config = get_hw_config(); status = init_hardware(hw_config); ffatal(status, "error in hardware initialization with %s\n", hw_config); /* Interrupt handlers */ for(i=0; i<16; i++) IRQVECTOR[i] = emptyIT; /* Allows all IT */ _mask(1); /* Load MBR and current volume */ load_mbr(); load_current_volume(); }