From: Ricardo Markiewicz Date: Fri, 9 Apr 2004 19:42:02 +0000 (+0000) Subject: * Se arregla el codigo para que compile. X-Git-Tag: svn_import_r684~597 X-Git-Url: https://git.llucax.com/z.facultad/75.06/emufs.git/commitdiff_plain/a7a781b6b1a260c882ad779a9ecdaa517d1a6846?ds=inline * Se arregla el codigo para que compile. * Se pasan cosas de los .c a los .h que son de dominio publico ya sea usadas para debug u otros motivos. --- diff --git a/emufs/did.c b/emufs/did.c index f193025..90a200b 100644 --- a/emufs/did.c +++ b/emufs/did.c @@ -39,8 +39,6 @@ #include #include -#define EMUFS_DID_EXT ".did" - int emufs_did_get_last(EMUFS *emu) { FILE * f_did; diff --git a/emufs/did.h b/emufs/did.h index 94770dd..b50d630 100644 --- a/emufs/did.h +++ b/emufs/did.h @@ -40,6 +40,8 @@ #include "emufs.h" +#define EMUFS_DID_EXT ".did" + int emufs_did_get_last(EMUFS *); int emufs_did_agregar(EMUFS *, int); 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); } diff --git a/emufs/fsc.c b/emufs/fsc.c index c0c026f..0a5ba22 100644 --- a/emufs/fsc.c +++ b/emufs/fsc.c @@ -38,13 +38,6 @@ #include #include -#define EMUFS_FSC_EXT ".fsc" - -typedef struct emufs_fsc_t { - int block; - int free_space; -} EMUFS_FSC; - int emufs_fsc_agregar(EMUFS *emu, int num_bloque, int fs) { FILE *f_fsc; diff --git a/emufs/fsc.h b/emufs/fsc.h index 0216094..0a2df0d 100644 --- a/emufs/fsc.h +++ b/emufs/fsc.h @@ -39,6 +39,13 @@ #include "emufs.h" +#define EMUFS_FSC_EXT ".fsc" + +typedef struct emufs_fsc_t { + int block; + int free_space; +} EMUFS_FSC; + int emufs_fsc_agregar(EMUFS *, int, int); int emufs_fsc_actualizar(EMUFS *, int, int); diff --git a/emufs/idx.c b/emufs/idx.c index 093c2ac..9979070 100644 --- a/emufs/idx.c +++ b/emufs/idx.c @@ -36,13 +36,6 @@ #include "idx.h" -#define EMUFS_IDX_EXT ".idx" - -typedef struct emufs_idx_t { - int block; - long int id_reg; -} EMUFS_IDX; - int emufs_idx_buscar_mayor_id(EMUFS *emu) { int id, max = -1; diff --git a/emufs/idx.h b/emufs/idx.h index 2ccef85..ca509c7 100644 --- a/emufs/idx.h +++ b/emufs/idx.h @@ -40,6 +40,13 @@ #include #include "emufs.h" +#define EMUFS_IDX_EXT ".idx" + +typedef struct emufs_idx_t { + int block; + long int id_reg; +} EMUFS_IDX; + int emufs_idx_buscar_mayor_id(EMUFS *); int emufs_idx_buscar_registro(EMUFS *, int);