]> git.llucax.com Git - z.facultad/75.06/emufs.git/blobdiff - emufs/fsc.c
* Modificacion parcial (porque no graba) de Facturas.
[z.facultad/75.06/emufs.git] / emufs / fsc.c
index 164050ec0603b192a698146a4395e1e80eed2b4e..a3aad0e6cf0058b31343e3040dabc74518ff0d06 100644 (file)
@@ -342,3 +342,51 @@ EMUFS_FREE emufs_fsc_get_total_fs(EMUFS *emu)
        fclose(f_fsc);
        return total;
 }
+
+int emufs_fsc_get_max_min_fs(EMUFS *emu, EMUFS_FREE *min, EMUFS_FREE *max)
+{
+       FILE *f_fsc;
+       EMUFS_FSC reg;
+       char name_f_fsc[255];
+       
+       strcpy(name_f_fsc,emu->nombre);
+       strcat(name_f_fsc, EMUFS_FSC_EXT);
+
+       *min = ULONG_MAX;
+       *max = 0;
+       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 < *min )
+                       *min = reg.freespace;
+               if ( reg.freespace > *max )
+                       *max = reg.freespace;
+       }
+
+       fclose(f_fsc);
+       return 0;
+}
+
+EMUFS_FREE emufs_fsc_get_media_fs(EMUFS *emu)
+{
+       FILE *f_fsc;
+       EMUFS_FSC reg;
+       char name_f_fsc[255];
+       EMUFS_FREE total_fs = 0;
+       EMUFS_REG_ID gap_count = 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);
+               total_fs += reg.freespace;
+               ++gap_count;
+       }
+
+       fclose(f_fsc);
+       return total_fs/gap_count;
+}