* Se pasan cosas de los .c a los .h que son de dominio publico ya sea usadas
para debug u otros motivos.
#include <string.h>
#include <unistd.h>
#include <string.h>
#include <unistd.h>
-#define EMUFS_DID_EXT ".did"
-
int emufs_did_get_last(EMUFS *emu)
{
FILE * f_did;
int emufs_did_get_last(EMUFS *emu)
{
FILE * f_did;
+#define EMUFS_DID_EXT ".did"
+
int emufs_did_get_last(EMUFS *);
int emufs_did_agregar(EMUFS *, int);
int emufs_did_get_last(EMUFS *);
int emufs_did_agregar(EMUFS *, int);
#include "emufs.h"
#include "tipo3.h"
#include "emufs.h"
#include "tipo3.h"
+#include "did.h"
+#include "fsc.h"
+#include "idx.h"
/* Defino las extenciones que usan cada tipo de archivo */
/* Defino las extenciones que usan cada tipo de archivo */
-#define EXT_TIPO3_DATA ".dat"
char *str_dup(const char *s);
char *str_dup(const char *s);
tmp->nombre = str_dup(filename);
strcpy(name, filename);
tmp->nombre = str_dup(filename);
strcpy(name, filename);
- strcat(name, EXT_TIPO3_DATA);
fp = fopen(name, "w");
if (fp == NULL) {
/* ERROR */
fp = fopen(name, "w");
if (fp == NULL) {
/* ERROR */
fclose(fp);
strcpy(name, filename);
fclose(fp);
strcpy(name, filename);
- strcat(name, EXT_TIPO3_ID);
+ strcat(name, EMUFS_IDX_EXT);
fp = fopen(name, "w");
fclose(fp);
strcpy(name, filename);
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);
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);
fp = fopen(name, "w");
fclose(fp);
FILE *fp;
strcpy(name, filename);
FILE *fp;
strcpy(name, filename);
- strcat(name, EXT_TIPO3_DATA);
/* Trato de determinar el tipo de archivo */
fp = fopen(name, "r");
/* Trato de determinar el tipo de archivo */
fp = fopen(name, "r");
int ver_archivo_FS(EMUFS *emu)
{
FILE *f_block_free;
int ver_archivo_FS(EMUFS *emu)
{
FILE *f_block_free;
char name_f_block_free[255];
strcpy(name_f_block_free,emu->nombre);
char name_f_block_free[255];
strcpy(name_f_block_free,emu->nombre);
strcpy(name_f_block_free,emu->nombre);
strcat(name_f_block_free,".idx");
{
strcpy(name_f_block_free,emu->nombre);
strcat(name_f_block_free,".idx");
{
f_block_free = fopen(name_f_block_free, "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);
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);
}
}
fclose(f_block_free);
}
#include <string.h>
#include <unistd.h>
#include <string.h>
#include <unistd.h>
-#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;
int emufs_fsc_agregar(EMUFS *emu, int num_bloque, int fs)
{
FILE *f_fsc;
+#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);
int emufs_fsc_agregar(EMUFS *, int, int);
int emufs_fsc_actualizar(EMUFS *, int, int);
-#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;
int emufs_idx_buscar_mayor_id(EMUFS *emu)
{
int id, max = -1;
#include <string.h>
#include "emufs.h"
#include <string.h>
#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);
int emufs_idx_buscar_mayor_id(EMUFS *);
int emufs_idx_buscar_registro(EMUFS *, int);