X-Git-Url: https://git.llucax.com/z.facultad/75.06/emufs.git/blobdiff_plain/e7e2badf7ebc4b6aeaf03366ad6fe6b919713d54..502a6f92fd7acf3c942a92b41bf0ed788a128515:/emufs/idx.h diff --git a/emufs/idx.h b/emufs/idx.h index 28aadc4..cd2c3e3 100644 --- a/emufs/idx.h +++ b/emufs/idx.h @@ -1,7 +1,81 @@ -#ifndef _IDX_H -#define _IDX_H +/* vim: set noexpandtab tabstop=4 shiftwidth=4: + *---------------------------------------------------------------------------- + * emufs + *---------------------------------------------------------------------------- + * This file is part of emufs. + * + * emufs is free software; you can redistribute it and/or modify it under the + * terms of the GNU General Public License as published by the Free Software + * Foundation; either version 2 of the License, or (at your option) any later + * version. + * + * emufs is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more + * details. + * + * You should have received a copy of the GNU General Public License along + * with emufs; if not, write to the Free Software Foundation, Inc., 59 Temple + * Place, Suite 330, Boston, MA 02111-1307 USA + *---------------------------------------------------------------------------- + * Creado: jue abr 8 18:11:46 ART 2004 + * Autores: Nicolás Dimov + * Leandro Lucarella + *---------------------------------------------------------------------------- + * + * $Id$ + * + */ + +/** \file + * + * Manejo de archivos de índice de registros. + * + * Interfaz del manejo de archivos de índice de registros. + * + */ + +#ifndef _EMUFS_IDX_H +#define _EMUFS_IDX_H + +#include +#include #include "emufs.h" -int emufs_idx_buscar_mayor_id(EMUFS *); +#define EMUFS_IDX_EXT ".idx" + +typedef struct emufs_idx_t { + EMUFS_REG_ID id_reg; + EMUFS_BLOCK_ID location; +} EMUFS_IDX; + +FILE* emufs_idx_abrir(EMUFS*, const char*); + +int emufs_idx_crear(EMUFS*); + +EMUFS_REG_ID emufs_idx_buscar_mayor_id_libre(EMUFS*, int*); + +EMUFS_BLOCK_ID emufs_idx_buscar_registro(EMUFS*, EMUFS_REG_ID); + +int emufs_idx_agregar(EMUFS*, EMUFS_BLOCK_ID, EMUFS_REG_ID); + +int emufs_idx_borrar(EMUFS*, EMUFS_REG_ID); + +/** Retorna un array con los Ids validos del archivo IDX + * + * EL ARRAY DEBE SER LIBERADO! + * \param emu EMUFS + * \param cant Puntero donde guardar la cantidad de items + */ +EMUFS_REG_ID *emufs_idx_get(EMUFS *emu, EMUFS_REG_ID *cant); + +EMUFS_REG_ID emufs_idx_get_new_id(EMUFS*, int*); + +int emufs_idx_existe_id(EMUFS *emu, int ID); + +int emufs_idx_actualizar(EMUFS *emu, int ID, EMUFS_BLOCK_ID bloque); + +/** Obtiene el tamaño del archivo de índice. */ +long emufs_idx_get_file_size(EMUFS*, int*); -#endif /* _IDX_H */ +#endif /* _EMUFS_IDX_H */