X-Git-Url: https://git.llucax.com/z.facultad/75.06/emufs.git/blobdiff_plain/c407055e1cc6ff4c435114091c3a5430486aa659..b1be8a89626ce30127758ad5e01a5c6069516fae:/emufs/tipo2.c diff --git a/emufs/tipo2.c b/emufs/tipo2.c index e3025cb..161c01b 100644 --- a/emufs/tipo2.c +++ b/emufs/tipo2.c @@ -49,6 +49,7 @@ EMUFS_REG_ID emufs_tipo2_grabar_registro(EMUFS *emu, void *ptr, EMUFS_REG_SIZE n EMUFS_REG_ID n_IdReg; EMUFS_FREE n_FreeSpace; EMUFS_OFFSET n_WrtOffset,n_RegOffset; + unsigned long int n_FisicSize; FILE *f_data; char name_f[255]; @@ -60,7 +61,8 @@ EMUFS_REG_ID emufs_tipo2_grabar_registro(EMUFS *emu, void *ptr, EMUFS_REG_SIZE n /* Obtengo un offset en donde iniciar la escritura de mi registro */ /* de manera segura (habra espacio suficiente) */ - n_WrtOffset = emufs_fsc_buscar_lugar(emu, n_RegSize, &n_FreeSpace); + n_FisicSize = sizeof(EMUFS_REG_ID)+sizeof(EMUFS_REG_SIZE)+n_RegSize; + n_WrtOffset = emufs_fsc_buscar_lugar(emu,n_FisicSize,&n_FreeSpace); printf("tipo2.c >> Searching FSC: Offset = %lu FSpace: %lu\n", n_WrtOffset, n_FreeSpace); /* Si no encontre un gap, entonces escribo el registro al final */ @@ -72,12 +74,12 @@ EMUFS_REG_ID emufs_tipo2_grabar_registro(EMUFS *emu, void *ptr, EMUFS_REG_SIZE n n_RegOffset = ftell(f_data); /* Escribo [RegId]|[RegSize]|[RegData] */ - fwrite(&n_IdReg,sizeof(int),1,f_data); - fwrite(&n_RegSize,sizeof(int),1,f_data); + fwrite(&n_IdReg,sizeof(EMUFS_REG_ID),1,f_data); + fwrite(&n_RegSize,sizeof(EMUFS_REG_SIZE),1,f_data); fwrite(ptr,n_RegSize,1,f_data); /* Bye */ - printf("Tipo2.c >> RegNr: %lu inserted at Offset: %lu\n",n_IdReg,n_RegOffset); + printf("Tipo2.c >> RegNr: %lu with FisicSize: %lu inserted at Offset: %lu\n",n_IdReg,n_FisicSize,n_RegOffset); fclose(f_data); } else {