X-Git-Url: https://git.llucax.com/z.facultad/75.06/emufs.git/blobdiff_plain/e7e2badf7ebc4b6aeaf03366ad6fe6b919713d54..e0b2f02fb7880eb26e4fc28e85253dc56b6c6aab:/emufs/emufs.c?ds=sidebyside diff --git a/emufs/emufs.c b/emufs/emufs.c index b62702b..6edd665 100644 --- a/emufs/emufs.c +++ b/emufs/emufs.c @@ -24,7 +24,7 @@ * Leandro Lucarella *---------------------------------------------------------------------------- * - * $Id: command.cpp 220 2003-11-19 23:10:40Z luca $ + * $Id$ * */ @@ -40,12 +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_ID ".idx" -#define EXT_TIPO3_DATA ".dat" -#define EXT_TIPO3_DISP ".fsc" -#define EXT_TIPO3_IDS ".did" char *str_dup(const char *s); @@ -80,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 */ @@ -95,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); @@ -126,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"); @@ -173,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); @@ -195,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); }