]> git.llucax.com Git - z.facultad/75.06/emufs.git/blobdiff - emufs/fsc.c
* Se agregan compactar facturas y notas (notas no estoy seguro de tener
[z.facultad/75.06/emufs.git] / emufs / fsc.c
index 044ef3352d57e7a6a044da9a4a27165bf24b68a1..4c5008abfdec7a95e2671af7c2d2af5f845b4691 100644 (file)
@@ -412,3 +412,33 @@ EMUFS_FREE emufs_fsc_get_media_fs(EMUFS *emu)
        fclose(f_fsc);
        return total_fs/gap_count;
 }
+
+int emufs_fsc_get_cant_bloques_vacios(EMUFS *emu)
+{
+       FILE *f_fsc;
+       EMUFS_FSC reg;
+       char name_f_fsc[255];
+       int cant=0;
+       
+       strcpy(name_f_fsc,emu->nombre);
+       strcat(name_f_fsc, EMUFS_FSC_EXT);
+
+       if ( (f_fsc = fopen(name_f_fsc,"r"))==NULL ) return -1;
+       while ( !feof(f_fsc) ){
+               fread(&reg, sizeof(EMUFS_FSC), 1, f_fsc);
+               if ( reg.freespace == emu->tam_bloque )
+                       cant++;
+       }
+               
+       fclose(f_fsc);
+       return cant;
+}
+
+int emufs_fsc_truncate(EMUFS* efs, EMUFS_BLOCK_ID blocks)
+{
+       char name_f_fsc[255];
+
+       strcpy(name_f_fsc, efs->nombre);
+       strcat(name_f_fsc, EMUFS_FSC_EXT);
+       return truncate(name_f_fsc, blocks * sizeof(EMUFS_FSC));
+}