X-Git-Url: https://git.llucax.com/z.facultad/75.06/emufs.git/blobdiff_plain/6c5fe1e15e441c27ba01b22b91bf1e5843ae53f2..e0b2f02fb7880eb26e4fc28e85253dc56b6c6aab:/emufs/emufs.c diff --git a/emufs/emufs.c b/emufs/emufs.c index 9934374..6edd665 100644 --- a/emufs/emufs.c +++ b/emufs/emufs.c @@ -40,9 +40,11 @@ #include "emufs.h" #include "tipo3.h" +#include "did.h" +#include "fsc.h" +#include "idx.h" /* Defino las extenciones que usan cada tipo de archivo */ -#define EXT_TIPO3_DATA ".dat" char *str_dup(const char *s); @@ -77,7 +79,7 @@ EMUFS *emufs_crear(const char *filename, char tipo, unsigned int tam_bloque, uns tmp->nombre = str_dup(filename); strcpy(name, filename); - strcat(name, EXT_TIPO3_DATA); + strcat(name, ".dat"); fp = fopen(name, "w"); if (fp == NULL) { /* ERROR */ @@ -92,17 +94,17 @@ EMUFS *emufs_crear(const char *filename, char tipo, unsigned int tam_bloque, uns fclose(fp); strcpy(name, filename); - strcat(name, EXT_TIPO3_ID); + strcat(name, EMUFS_IDX_EXT); fp = fopen(name, "w"); fclose(fp); strcpy(name, filename); - strcat(name, EXT_TIPO3_DISP); + strcat(name, EMUFS_FSC_EXT); fp = fopen(name, "w"); fclose(fp); strcpy(name, filename); - strcat(name, EXT_TIPO3_IDS); + strcat(name, EMUFS_DID_EXT); fp = fopen(name, "w"); fclose(fp); @@ -123,7 +125,7 @@ EMUFS *emufs_abrir(const char *filename) FILE *fp; strcpy(name, filename); - strcat(name, EXT_TIPO3_DATA); + strcat(name, ".dat"); /* Trato de determinar el tipo de archivo */ fp = fopen(name, "r"); @@ -170,7 +172,7 @@ int emufs_destruir(EMUFS *e) int ver_archivo_FS(EMUFS *emu) { FILE *f_block_free; - BLOCK_FREE_T reg; + EMUFS_FSC reg; char name_f_block_free[255]; strcpy(name_f_block_free,emu->nombre); @@ -192,12 +194,12 @@ int ver_archivo_FS(EMUFS *emu) strcpy(name_f_block_free,emu->nombre); strcat(name_f_block_free,".idx"); { - BLOCK_REG_T r; + EMUFS_IDX r; f_block_free = fopen(name_f_block_free, "r"); - fread(&r, sizeof(BLOCK_REG_T), 1, f_block_free); + fread(&r, sizeof(EMUFS_IDX), 1, f_block_free); while (!feof(f_block_free)) { printf("ID %ld en bloque %d\n", r.id_reg, r.block); - fread(&r, sizeof(BLOCK_REG_T), 1, f_block_free); + fread(&r, sizeof(EMUFS_IDX), 1, f_block_free); } fclose(f_block_free); }