X-Git-Url: https://git.llucax.com/z.facultad/75.06/emufs.git/blobdiff_plain/008189ea62c4d3800769f00a304f95cc454102b3..c52c97783d6e747849a0f3dbef223c18fcff99a8:/emufs/emufs.c?ds=sidebyside diff --git a/emufs/emufs.c b/emufs/emufs.c index e789fa7..c80da2e 100644 --- a/emufs/emufs.c +++ b/emufs/emufs.c @@ -425,7 +425,6 @@ int emufs_agregar_indice(EMUFS *emu, char *nombre, INDICE_FUNCION funcion, INDIC /* y que no exista un indice primario */ PERR("Agregando indice"); tmp = emu->indices; - PERR("IGUALE"); while (tmp) { if (strcmp(tmp->nombre, nombre)==0) { error = 1; @@ -551,9 +550,11 @@ EMUFS_BLOCK_ID emufs_create_new_block(EMUFS *emu) memset(dummy, 0, emu->tam_bloque); fwrite(dummy, emu->tam_bloque, 1, fp); switch(emu->tipo){ - case T1: num = (ftell(fp)-sizeof(EMUFS_Tipo)-sizeof(EMUFS_BLOCK_SIZE))/emu->tam_bloque; + case T4: num = (ftell(fp)-sizeof(EMUFS_Tipo)-sizeof(EMUFS_BLOCK_SIZE))/emu->tam_bloque; break; - case T3: num = (ftell(fp)-sizeof(EMUFS_Tipo)-sizeof(EMUFS_BLOCK_SIZE)-sizeof(EMUFS_REG_SIZE))/emu->tam_bloque; + case T5: num = (ftell(fp)-sizeof(EMUFS_Tipo)-sizeof(EMUFS_BLOCK_SIZE)-sizeof(EMUFS_REG_SIZE))/emu->tam_bloque; + break; + default: num = 0; } fclose(fp); free(dummy); @@ -579,11 +580,13 @@ EMUFS_BLOCK_ID emufs_get_new_block_number(EMUFS *emu) return -1; } switch(emu->tipo){ - case T1: num = (ftell(fp)-sizeof(EMUFS_Tipo)-sizeof(EMUFS_BLOCK_SIZE))/emu->tam_bloque; + case T4: num = (ftell(fp)-sizeof(EMUFS_Tipo)-sizeof(EMUFS_BLOCK_SIZE))/emu->tam_bloque; if (ftell(fp) == sizeof(EMUFS_Tipo)+sizeof(EMUFS_BLOCK_SIZE)) num = 0; break; - case T3: num = (ftell(fp)-sizeof(EMUFS_Tipo)-sizeof(EMUFS_BLOCK_SIZE)-sizeof(EMUFS_REG_SIZE))/emu->tam_bloque; + case T5: num = (ftell(fp)-sizeof(EMUFS_Tipo)-sizeof(EMUFS_BLOCK_SIZE)-sizeof(EMUFS_REG_SIZE))/emu->tam_bloque; if (ftell(fp) == sizeof(EMUFS_Tipo)+sizeof(EMUFS_BLOCK_SIZE)+sizeof(EMUFS_REG_SIZE)) num = 0; + break; + default: num = 0; } fclose(fp); return num;