/*-------------------------------------------------------------------------- NAME H5G_user_path_test PURPOSE Retrieve the user path for an ID USAGE herr_t H5G_user_path_test(obj_id, user_path, user_path_len) hid_t obj_id; IN: ID to check char *user_path; OUT: Pointer to buffer for User path size_t *user_path_len; OUT: Size of user path unsigned *obj_hidden; OUT: Whether object is hidden RETURNS Non-negative on success, negative on failure DESCRIPTION Retrieves the user path for an ID. A zero for the length is returned in the case of no user path. GLOBAL VARIABLES COMMENTS, BUGS, ASSUMPTIONS DO NOT USE THIS FUNCTION FOR ANYTHING EXCEPT TESTING EXAMPLES REVISION LOG --------------------------------------------------------------------------*/ herr_t H5G_user_path_test(hid_t obj_id, char *user_path, size_t *user_path_len, unsigned *obj_hidden) { void *obj_ptr; /* Pointer to object for ID */ H5G_entry_t *obj_ent; /* Pointer to symbol table entry for obj */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(H5G_user_path_test, FAIL) /* Sanity check */ HDassert(user_path_len); HDassert(obj_hidden); /* Get pointer to object for ID */ if(NULL == (obj_ptr = H5I_object(obj_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "can't get object for ID") /* Get the symbol table entry */ switch(H5I_get_type(obj_id)) { case H5I_GROUP: obj_ent = H5G_entof((H5G_t *)obj_ptr); break; case H5I_DATASET: obj_ent = H5D_entof((H5D_t *)obj_ptr); break; case H5I_DATATYPE: /* Avoid non-named datatypes */ if(!H5T_is_named((H5T_t *)obj_ptr)) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a named datatype") obj_ent = H5T_entof((H5T_t *)obj_ptr); break; default: HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "unknown data object type") } /* end switch */ HDassert(obj_ent); /* Retrieve a copy of the user path and put it into the buffer */ if(obj_ent->user_path_r) { size_t len = H5RS_len(obj_ent->user_path_r); /* Set the user path, if given */ if(user_path) HDstrcpy(user_path, H5RS_get_str(obj_ent->user_path_r)); /* Set the length of the path */ *user_path_len = len; /* Set the user path hidden flag */ *obj_hidden = obj_ent->obj_hidden; } /* end if */ else { *user_path_len = 0; *obj_hidden = 0; } /* end else */ done: FUNC_LEAVE_NOAPI(ret_value) } /* H5G_user_path_test() */
static herr_t H5I_debug(H5I_type_t grp) { H5I_id_group_t *grp_ptr; H5I_id_info_t *cur; H5G_entry_t *ent = NULL; int is, js; unsigned int iu; herr_t ret_value; /* Return value */ FUNC_ENTER_NOAPI(H5I_debug, FAIL); fprintf(stderr, "Dumping group %d\n", (int)grp); grp_ptr = H5I_id_group_list_g[grp]; /* Header */ fprintf(stderr, " count = %u\n", grp_ptr->count); fprintf(stderr, " reserved = %u\n", grp_ptr->reserved); fprintf(stderr, " wrapped = %u\n", grp_ptr->wrapped); fprintf(stderr, " hash_size = %lu\n", (unsigned long)grp_ptr->hash_size); fprintf(stderr, " ids = %u\n", grp_ptr->ids); fprintf(stderr, " nextid = %u\n", grp_ptr->nextid); /* Cache */ fprintf(stderr, " Cache:\n"); for (is=0; is<ID_CACHE_SIZE; is++) { if (H5I_cache_g[is] && H5I_GROUP(H5I_cache_g[is]->id)==grp) { fprintf(stderr, " Entry-%d, ID=%lu\n", is, (unsigned long)(H5I_cache_g[is]->id)); } } /* List */ fprintf(stderr, " List:\n"); for (iu=0; iu<grp_ptr->hash_size; iu++) { for (js=0, cur=grp_ptr->id_list[iu]; cur; cur=cur->next, js++) { fprintf(stderr, " #%u.%d\n", iu, js); fprintf(stderr, " id = %lu\n", (unsigned long)(cur->id)); fprintf(stderr, " count = %u\n", cur->count); fprintf(stderr, " obj = 0x%08lx\n", (unsigned long)(cur->obj_ptr)); /* Get the symbol table entry, so we get get the name */ switch(grp) { case H5I_GROUP: ent = H5G_entof((H5G_t*)cur->obj_ptr); break; case H5I_DATASET: ent = H5D_entof((H5D_t*)cur->obj_ptr); break; case H5I_DATATYPE: ent = H5T_entof((H5T_t*)cur->obj_ptr); break; default: continue; /* Other types of IDs are not stored in files */ } /* end switch*/ if(ent) { if(ent->name) fprintf(stderr, " name = %s\n",ent->name); if(ent->old_name) fprintf(stderr, " old_name = %s\n",ent->old_name); } /* end if */ } /* end for */ } /* end for */ done: FUNC_LEAVE_NOAPI(SUCCEED); }