diff options
Diffstat (limited to 'src/H5G.c')
-rw-r--r-- | src/H5G.c | 167 |
1 files changed, 1 insertions, 166 deletions
@@ -817,141 +817,6 @@ H5G_term_interface(void) /*------------------------------------------------------------------------- - * Function: H5G_mkroot - * - * Purpose: Creates a root group in an empty file and opens it. If a - * root group is already open then this function immediately - * returns. If ENT is non-null then it's the symbol table - * entry for an existing group which will be opened as the root - * group. Otherwise a new root group is created and then - * opened. - * - * Return: Non-negative on success/Negative on failure - * - * Programmer: Robb Matzke - * matzke@llnl.gov - * Aug 11 1997 - * - *------------------------------------------------------------------------- - */ -herr_t -H5G_mkroot(H5F_t *f, hid_t dxpl_id, H5G_loc_t *loc) -{ - H5O_loc_t new_root_oloc; /* New root object location */ - H5G_name_t new_root_path; /* New root path */ - H5G_loc_t new_root_loc; /* New root location information */ - H5G_loc_t root_loc; /* Root location information */ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_NOAPI(H5G_mkroot, FAIL) - - /* check args */ - HDassert(f); - - /* Check if the root group is already initialized */ - if(f->shared->root_grp) - HGOTO_DONE(SUCCEED) - - /* Create information needed for group nodes */ - if(H5G_node_init(f) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create group node info") - - /* - * If there is no root object then create one. The root group always starts - * with a hard link count of one since it's pointed to by the superblock. - */ - if(loc == NULL) { - H5P_genplist_t *fc_plist; /* File creation property list */ - H5O_ginfo_t ginfo; /* Group info parameters */ - H5O_linfo_t linfo; /* Link info parameters */ - - /* Get the file creation property list */ - /* (Which is a sub-class of the group creation property class) */ - if(NULL == (fc_plist = (H5P_genplist_t *)H5I_object(f->shared->fcpl_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list") - - /* Get the group info property */ - if(H5P_get(fc_plist, H5G_CRT_GROUP_INFO_NAME, &ginfo) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get group info") - - /* Get the link info property */ - if(H5P_get(fc_plist, H5G_CRT_LINK_INFO_NAME, &linfo) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get link info") - - /* Set up group location for root group */ - new_root_loc.oloc = &new_root_oloc; - new_root_loc.path = &new_root_path; - H5G_loc_reset(&new_root_loc); - loc = &new_root_loc; - - /* Create root group */ - if(H5G_obj_create(f, dxpl_id, &ginfo, &linfo, f->shared->fcpl_id, loc->oloc/*out*/) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create group entry") - if(1 != H5O_link(loc->oloc, 1, dxpl_id)) - HGOTO_ERROR(H5E_SYM, H5E_LINKCOUNT, FAIL, "internal error (wrong link count)") - } /* end if */ - else { - /* - * Open the root object as a group. - */ - if(H5O_open(loc->oloc) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open root group") - -#ifndef H5_STRICT_FORMAT_CHECKS - /* If symbol table information is cached, check if we should replace the - * symbol table message with the cached symbol table information */ - if((H5F_INTENT(f) & H5F_ACC_RDWR) && f->shared->root_ent - && (f->shared->root_ent->type == H5G_CACHED_STAB)) { - H5O_stab_t cached_stab; - - /* Retrieve the cached symbol table information */ - cached_stab.btree_addr = f->shared->root_ent->cache.stab.btree_addr; - cached_stab.heap_addr = f->shared->root_ent->cache.stab.heap_addr; - - /* Check if the symbol table message is valid, and replace with the - * cached symbol table if necessary */ - if(H5G_stab_valid(loc->oloc, dxpl_id, &cached_stab) < 0) - HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to verify symbol table") - } /* end if */ -#endif /* H5_STRICT_FORMAT_CHECKS */ - } /* end else */ - - /* Create the path names for the root group's entry */ - H5G_name_init(loc->path, "/"); - - /* - * Create the group pointer. Also decrement the open object count so we - * don't count the root group as an open object. The root group will - * never be closed. - */ - if(NULL == (f->shared->root_grp = H5FL_CALLOC(H5G_t))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") - if(NULL == (f->shared->root_grp->shared = H5FL_CALLOC(H5G_shared_t))) { - (void)H5FL_FREE(H5G_t, f->shared->root_grp); - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") - } /* end if */ - - /* Shallow copy (take ownership) of the group object info */ - root_loc.oloc = &(f->shared->root_grp->oloc); - root_loc.path = &(f->shared->root_grp->path); - if(H5G_loc_copy(&root_loc, loc, H5_COPY_SHALLOW) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTCOPY, FAIL, "can't copy group object location") - - f->shared->root_grp->shared->fo_count = 1; - /* The only other open object should be the superblock extension, if it - * exists. Don't count either the superblock extension or the root group - * in the number of open objects in the file. - */ - HDassert((1 == f->nopen_objs) || - (2 == f->nopen_objs && HADDR_UNDEF != f->shared->extension_addr)); - f->nopen_objs--; - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5G_mkroot() */ - - -/*------------------------------------------------------------------------- * Function: H5G_create * * Purpose: Creates a new empty group with the specified name. The name @@ -1351,36 +1216,6 @@ done: /*------------------------------------------------------------------------- - * Function: H5G_rootof - * - * Purpose: Return a pointer to the root group of the file. If the file - * is part of a virtual file then the root group of the virtual - * file is returned. - * - * Return: Success: Ptr to the root group of the file. Do not - * free the pointer -- it points directly into - * the file struct. - * - * Failure: NULL - * - * Programmer: Robb Matzke - * Tuesday, October 13, 1998 - * - *------------------------------------------------------------------------- - */ -H5G_t * -H5G_rootof(H5F_t *f) -{ - FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5G_rootof) - - while(f->parent) - f = f->parent; - - FUNC_LEAVE_NOAPI(f->shared->root_grp) -} /* end H5G_rootof() */ - - -/*------------------------------------------------------------------------- * Function: H5G_oloc * * Purpose: Returns a pointer to the object location for a group. @@ -1975,7 +1810,7 @@ H5G_visit(hid_t loc_id, const char *group_name, H5_index_t idx_type, udata.curr_path_len = 0; /* Create skip list to store visited object information */ - if((udata.visited = H5SL_create(H5SL_TYPE_OBJ, 0.5, (size_t)16)) == NULL) + if((udata.visited = H5SL_create(H5SL_TYPE_OBJ)) == NULL) HGOTO_ERROR(H5E_SYM, H5E_CANTCREATE, FAIL, "can't create skip list for visited objects") /* Get the group's reference count and type */ |