X-Git-Url: https://git.llucax.com/z.facultad/75.06/emufs.git/blobdiff_plain/613cc40875512c05124f15dae55e9bb7767c1ea2..ec7edba15ba5510149162d9998bc1b7146ca249d:/emufs/b_plus.c?ds=sidebyside diff --git a/emufs/b_plus.c b/emufs/b_plus.c index a46e8b3..a30058b 100644 --- a/emufs/b_plus.c +++ b/emufs/b_plus.c @@ -1,13 +1,11 @@ /** Arbol B+ */ #include "b_plus.h" -#define INDEXSPECS INDICE + /**#*#*#*#*#**#*#*#*#*#* Private prototypes*#*#*#*#*#**#*#*#*#*#**#*#*#*/ -/* numerando los bloques */ int b_plus_grabar_nodo(INDEXSPECS *idx, NODO_B_PLUS *nodo, int num_node); -/*NODO_B_PLUS *b_plus_leer_nodo(INDEXSPECS *idx, int num_node);*/ +NODO_B_PLUS *b_plus_leer_nodo(INDEXSPECS *idx, int num_node); NODO_B_PLUS *b_plus_crearnodo(INDEXSPECS *idx); int b_plus_destruir_nodo(NODO_B_PLUS *nodo); -/*int b_plus_insertar_clave(INDEXSPECS *idx, INDEX_DAT *query);*/ int b_plus_split_child(INDEXSPECS *idx, int numparent, NODO_B_PLUS *parent, int ithchild, NODO_B_PLUS *fullnode); int b_plus_insert_nonfull(INDEXSPECS *idx, NODO_B_PLUS *nodo, int num_nodo, INDEX_DAT *query); int b_plus_insertar(INDEXSPECS *idx, INDEX_DAT *query); @@ -15,7 +13,7 @@ int b_plus_get_num_nodo(INDEXSPECS *idx); /**#*#*#*#*#**#*#*#*#*#*FIN PROTOTYPES*#*#*#*#*#**#*#*#*#*#**#*#*#*#*#*/ /** Crea un nuevo nodo y lo inicializa */ -NODO_B_PLUS *b_plus_crearnodo(INDEXSPECS *idx) { +NODO_B_PLUS *b_plus_crearnodo(INDEX *idx) { NODO_B_PLUS *nodo = (NODO_B_PLUS*)malloc(sizeof(NODO_B_PLUS)); if (nodo == NULL) return NULL; @@ -65,7 +63,7 @@ int emufs_b_plus_crear(INDEXSPECS *idx) { * return -1 - No hay clave, inserto clave de nuevo bloques * return 1 - Hubo falla de lectura de un nodo, Abortar */ -int emufs_b_plus_get_bloque(INDEXSPECS *idx, INDEX_DAT *query, int num_node) { +int emufs_b_plus_get_bloque(INDEX *idx, INDEX_DAT *query, int num_node) { NODO_B_PLUS *nodo; nodo = b_plus_leer_nodo(idx,num_node); @@ -101,7 +99,7 @@ int emufs_b_plus_get_bloque(INDEXSPECS *idx, INDEX_DAT *query, int num_node) { } } -NODO_B_PLUS *b_plus_leer_nodo(INDEXSPECS *idx, int num_node) { +NODO_B_PLUS *b_plus_leer_nodo(INDEX *idx, int num_node) { /*int i = 0;*/ FILE *fp; @@ -150,7 +148,7 @@ NODO_B_PLUS *b_plus_leer_nodo(INDEXSPECS *idx, int num_node) { } -int b_plus_grabar_nodo(INDEXSPECS *idx, NODO_B_PLUS *nodo, int num_node) +int b_plus_grabar_nodo(INDEX *idx, NODO_B_PLUS *nodo, int num_node) { FILE *fp; @@ -174,7 +172,7 @@ int b_plus_destruir_nodo(NODO_B_PLUS *nodo) return 0; } -int b_plus_split_child(INDEXSPECS *idx, int numparent, NODO_B_PLUS *parent, int ithchild, NODO_B_PLUS *fullnode) +int b_plus_split_child(INDEX *idx, int numparent, NODO_B_PLUS *parent, int ithchild, NODO_B_PLUS *fullnode) { /* locals */ int minclaves = ceil(idx->size_hijos/sizeof(int)/2)-1; @@ -228,7 +226,7 @@ int b_plus_split_child(INDEXSPECS *idx, int numparent, NODO_B_PLUS *parent, int } -int b_plus_insert_nonfull(INDEXSPECS *idx, NODO_B_PLUS *nodo, int num_nodo, INDEX_DAT *query) +int b_plus_insert_nonfull(INDEX *idx, NODO_B_PLUS *nodo, int num_nodo, INDEX_DAT *query) { int i, num_nodo_hijo; NODO_B_PLUS *hijo; @@ -265,7 +263,7 @@ int b_plus_insert_nonfull(INDEXSPECS *idx, NODO_B_PLUS *nodo, int num_nodo, INDE return 0; } -int emufs_b_plus_insertar(INDEXSPECS *idx, INDEX_DAT *query) +int emufs_b_plus_insertar(INDEX *idx, INDEX_DAT *query) { NODO_B_PLUS *raiz; @@ -289,7 +287,7 @@ int emufs_b_plus_insertar(INDEXSPECS *idx, INDEX_DAT *query) return 0; } -int b_plus_get_num_nodo(INDEXSPECS *idx) +int b_plus_get_num_nodo(INDEX *idx) { FILE *fp; int num;