+ switch (tipo) {
+ case T1:
+ break;
+ case T2:
+ break;
+ case T3:
+ tmp->tipo = tipo;
+ fread(&tmp->tam_bloque, sizeof(int), 1, fp);
+ tmp->leer_bloque = leer_bloque;
+ tmp->leer_registro = leer_registro;
+ tmp->grabar_registro = grabar_registro;
+ tmp->borrar_registro = NULL;
+ tmp->nombre = str_dup(filename);
+ }
+
+ fclose(fp);
+ return tmp;
+}
+
+int emufs_destruir(EMUFS *e)
+{
+ if (e == NULL) return 1;
+ free(e->nombre);
+ free(e);
+ return 0;
+}
+
+int ver_archivo_FS(EMUFS *emu)
+{
+ FILE *f_block_free;
+ BLOCK_FREE_T reg;
+ char name_f_block_free[255];
+
+ strcpy(name_f_block_free,emu->nombre);
+ strcat(name_f_block_free,".fsc");
+
+ if ( (f_block_free = fopen(name_f_block_free,"r"))==NULL ){
+ printf("no pude abrir el archivo %s\n",name_f_block_free);
+ return -1;
+ }
+ fread(®,sizeof(reg),1,f_block_free);
+ while ( !feof(f_block_free) ){
+ printf(" Bloque = %d Espacio libre = %d\n",reg.block, reg.free_space);
+ fread(®,sizeof(reg),1,f_block_free);
+ }
+
+ fclose(f_block_free);
+
+ /* Imprimo la lista de bloques/registros */
+ strcpy(name_f_block_free,emu->nombre);
+ strcat(name_f_block_free,".id3");
+ {
+ BLOCK_REG_T r;
+ f_block_free = fopen(name_f_block_free, "r");
+ fread(&r, sizeof(BLOCK_REG_T), 1, f_block_free);
+ while (!feof(f_block_free)) {
+ printf("ID %d en bloque %d\n", r.id_reg, r.block);
+ fread(&r, sizeof(BLOCK_REG_T), 1, f_block_free);
+ }
+ fclose(f_block_free);
+ }
+
+
+ return 0;
+}