diff options
author | Allen Byrne <byrn@hdfgroup.org> | 2012-08-03 20:11:36 (GMT) |
---|---|---|
committer | Allen Byrne <byrn@hdfgroup.org> | 2012-08-03 20:11:36 (GMT) |
commit | 28943c415b7e6ad11a412e7a88d500622886bffe (patch) | |
tree | 6b112cad4a3c050694ed7bdf78b4664815d32b57 /tools/lib | |
parent | c9cd62c1b55f96a45f3180e7ac73712340f479a1 (diff) | |
download | hdf5-28943c415b7e6ad11a412e7a88d500622886bffe.zip hdf5-28943c415b7e6ad11a412e7a88d500622886bffe.tar.gz hdf5-28943c415b7e6ad11a412e7a88d500622886bffe.tar.bz2 |
[svn-r22625] HDFFV-8111: h5diff compare file to itself - removed path shortcut
Diffstat (limited to 'tools/lib')
-rw-r--r-- | tools/lib/CMakeLists.txt | 1 | ||||
-rw-r--r-- | tools/lib/h5diff.c | 314 | ||||
-rw-r--r-- | tools/lib/h5diff.h | 26 | ||||
-rw-r--r-- | tools/lib/h5diff_array.c | 45 | ||||
-rw-r--r-- | tools/lib/h5diff_dset.c | 13 | ||||
-rw-r--r-- | tools/lib/h5tools.c | 251 | ||||
-rw-r--r-- | tools/lib/h5tools_utils.c | 2 | ||||
-rw-r--r-- | tools/lib/h5tools_utils.h | 2 | ||||
-rw-r--r-- | tools/lib/h5trav.c | 25 | ||||
-rw-r--r-- | tools/lib/h5trav.h | 2 |
10 files changed, 217 insertions, 464 deletions
diff --git a/tools/lib/CMakeLists.txt b/tools/lib/CMakeLists.txt index 6d48d5f..21420ce 100644 --- a/tools/lib/CMakeLists.txt +++ b/tools/lib/CMakeLists.txt @@ -40,6 +40,7 @@ H5_SET_LIB_OPTIONS ( HDF5_TOOLS_LIB_NAME_RELEASE HDF5_TOOLS_LIB_NAME_DEBUG ) +#SET_TARGET_PROPERTIES (hdf5_tools PROPERTIES COMPILE_DEFINITIONS H5DIFF_DEBUG) SET_TARGET_PROPERTIES (hdf5_tools PROPERTIES FOLDER libraries/tools) ############################################################################## diff --git a/tools/lib/h5diff.c b/tools/lib/h5diff.c index 0c1f3d3..2fa8917 100644 --- a/tools/lib/h5diff.c +++ b/tools/lib/h5diff.c @@ -21,23 +21,6 @@ #include "h5diff.h" #include "ph5diff.h" -/* - * Debug printf macros. The prefix allows output filtering by test scripts. - */ -#ifdef H5DIFF_DEBUG -#define h5diffdebug(x) HDfprintf(stderr, "h5diff debug: " x) -#define h5diffdebug2(x1, x2) HDfprintf(stderr, "h5diff debug: " x1, x2) -#define h5diffdebug3(x1, x2, x3) HDfprintf(stderr, "h5diff debug: " x1, x2, x3) -#define h5diffdebug4(x1, x2, x3, x4) HDfprintf(stderr, "h5diff debug: " x1, x2, x3, x4) -#define h5diffdebug5(x1, x2, x3, x4, x5) HDfprintf(stderr, "h5diff debug: " x1, x2, x3, x4, x5) -#else -#define h5diffdebug(x) -#define h5diffdebug2(x1, x2) -#define h5diffdebug3(x1, x2, x3) -#define h5diffdebug4(x1, x2, x3, x4) -#define h5diffdebug5(x1, x2, x3, x4, x5) -#endif - /*------------------------------------------------------------------------- * Function: print_objname @@ -369,6 +352,7 @@ static void build_match_list (const char *objname1, trav_info_t *info1, const ch trav_table_t *table; size_t idx; + h5difftrace("build_match_list start\n"); /* init */ trav_table_init( &table ); @@ -378,6 +362,7 @@ static void build_match_list (const char *objname1, trav_info_t *info1, const ch * All the objects belong to given groups are the cadidates. * So prepare to compare paths without the group names. */ + /* if obj1 is not root */ if (HDstrcmp (objname1,"/") != 0) path1_offset = HDstrlen(objname1); @@ -390,7 +375,6 @@ static void build_match_list (const char *objname1, trav_info_t *info1, const ch */ while(curr1 < info1->nused && curr2 < info2->nused) { - path1_lp = (info1->paths[curr1].path) + path1_offset; path2_lp = (info2->paths[curr2].path) + path2_offset; type1_l = info1->paths[curr1].type; @@ -399,7 +383,8 @@ static void build_match_list (const char *objname1, trav_info_t *info1, const ch /* criteria is string compare */ cmp = HDstrcmp(path1_lp, path2_lp); - if(cmp == 0) { + if(cmp == 0) + { if(!is_exclude_path(path1_lp, type1_l, options)) { infile[0] = 1; @@ -470,29 +455,9 @@ static void build_match_list (const char *objname1, trav_info_t *info1, const ch } /* end while */ free_exclude_path_list (options); - /*------------------------------------------------------ - * print the list - */ - if(options->m_verbose) - { - parallel_print("\n"); - /* if given objects is group under root */ - if (HDstrcmp (objname1,"/") || HDstrcmp (objname2,"/")) - parallel_print("group1 group2\n"); - else - parallel_print("file1 file2\n"); - parallel_print("---------------------------------------\n"); - for(i = 0; i < table->nobjs; i++) - { - char c1, c2; - c1 = (table->objs[i].flags[0]) ? 'x' : ' '; - c2 = (table->objs[i].flags[1]) ? 'x' : ' '; - parallel_print("%5c %6c %-15s\n", c1, c2, table->objs[i].name); - } /* end for */ - parallel_print ("\n"); - } /* end if */ *table_out = table; + h5difftrace("build_match_list finish\n"); } @@ -653,6 +618,7 @@ hsize_t h5diff(const char *fname1, int l_ret2 = -1; const char * obj1fullname = NULL; const char * obj2fullname = NULL; + int both_objs_grp = 0; /* init to group type */ h5trav_type_t obj1type = H5TRAV_TYPE_GROUP; h5trav_type_t obj2type = H5TRAV_TYPE_GROUP; @@ -675,6 +641,7 @@ hsize_t h5diff(const char *fname1, /* list for common objects */ trav_table_t *match_list = NULL; + h5difftrace("h5diff start\n"); /* init filenames */ HDmemset(filenames, 0, MAX_FILENAME * 2); /* init link info struct */ @@ -723,6 +690,7 @@ hsize_t h5diff(const char *fname1, trav_info_init(fname1, file1_id, &info1_obj); trav_info_init(fname2, file2_id, &info2_obj); + h5difftrace("trav_info_init initialized\n"); /* if any object is specified */ if (objname1) { @@ -751,6 +719,7 @@ hsize_t h5diff(const char *fname1, /*---------------------------------------------------------- * check if obj1 is root, group, single object or symlink */ + h5difftrace("h5diff check if obj1 is root, group, single object or symlink\n"); if(!HDstrcmp((char *)obj1fullname, "/")) { obj1type = H5TRAV_TYPE_GROUP; @@ -778,6 +747,7 @@ hsize_t h5diff(const char *fname1, */ if(src_linfo1.type == H5L_TYPE_HARD) { + int idx = 0; /* optional data pass */ info1_obj->opts = (diff_opt_t*)options; @@ -789,6 +759,9 @@ hsize_t h5diff(const char *fname1, } obj1type = oinfo1.type; trav_info_add(info1_obj, obj1fullname, obj1type); + idx = info1_obj->nused - 1; + info1_obj->paths[idx].objno = oinfo1.addr; + info1_obj->paths[idx].fileno = oinfo1.fileno; } else if (src_linfo1.type == H5L_TYPE_SOFT) { @@ -805,6 +778,7 @@ hsize_t h5diff(const char *fname1, /*---------------------------------------------------------- * check if obj2 is root, group, single object or symlink */ + h5difftrace("h5diff check if obj2 is root, group, single object or symlink\n"); if(!HDstrcmp(obj2fullname, "/")) { obj2type = H5TRAV_TYPE_GROUP; @@ -832,6 +806,7 @@ hsize_t h5diff(const char *fname1, */ if(src_linfo2.type == H5L_TYPE_HARD) { + int idx = 0; /* optional data pass */ info2_obj->opts = (diff_opt_t*)options; @@ -843,6 +818,9 @@ hsize_t h5diff(const char *fname1, } obj2type = oinfo2.type; trav_info_add(info2_obj, obj2fullname, obj2type); + idx = info2_obj->nused - 1; + info2_obj->paths[idx].objno = oinfo2.addr; + info2_obj->paths[idx].fileno = oinfo2.fileno; } else if (src_linfo2.type == H5L_TYPE_SOFT) { @@ -859,11 +837,14 @@ hsize_t h5diff(const char *fname1, /* if no object specified */ else { + h5difftrace("h5diff no object specified\n"); /* set root group */ obj1fullname = (char*)HDcalloc(2, sizeof(char)); HDstrcat((char *)obj1fullname, "/"); + obj1type = H5TRAV_TYPE_GROUP; obj2fullname = (char*)HDcalloc(2, sizeof(char)); HDstrcat((char *)obj2fullname, "/"); + obj2type = H5TRAV_TYPE_GROUP; } @@ -883,9 +864,11 @@ hsize_t h5diff(const char *fname1, /*------------------------------- * check symbolic link (object1) */ + h5difftrace("h5diff check symbolic link (object1)\n"); /* dangling link */ if (l_ret1 == 0) { + h5difftrace("h5diff ... dangling link\n"); if (options->no_dangle_links) { /* treat dangling link is error */ @@ -913,15 +896,27 @@ hsize_t h5diff(const char *fname1, goto out; } else if(l_ret1 != 2) /* symbolic link */ + { obj1type = trg_linfo1.trg_type; + h5difftrace("h5diff ... ... trg_linfo1.trg_type == H5L_TYPE_HARD\n"); + if (info1_lp != NULL) { + int idx = info1_lp->nused - 1; + h5difftrace("h5diff ... ... ... info1_obj not null\n"); + info1_lp->paths[idx].type = trg_linfo1.trg_type; + info1_lp->paths[idx].objno = trg_linfo1.objno; + info1_lp->paths[idx].fileno = trg_linfo1.fileno; + } + h5difftrace("h5diff check symbolic link (object1) finished\n"); + } /*------------------------------- * check symbolic link (object2) */ - + h5difftrace("h5diff check symbolic link (object2)\n"); /* dangling link */ if (l_ret2 == 0) { + h5difftrace("h5diff ... dangling link\n"); if (options->no_dangle_links) { /* treat dangling link is error */ @@ -949,11 +944,21 @@ hsize_t h5diff(const char *fname1, goto out; } else if(l_ret2 != 2) /* symbolic link */ + { obj2type = trg_linfo2.trg_type; + if (info2_lp != NULL) { + int idx = info2_lp->nused - 1; + h5difftrace("h5diff ... ... ... info2_obj not null\n"); + info2_lp->paths[idx].type = trg_linfo2.trg_type; + info2_lp->paths[idx].objno = trg_linfo2.objno; + info2_lp->paths[idx].fileno = trg_linfo2.fileno; + } + h5difftrace("h5diff check symbolic link (object1) finished\n"); + } } /* end of if follow symlinks */ /* - * If verbose options is not used, don't need to traverse thorugh the list + * If verbose options is not used, don't need to traverse through the list * of objects in the group to display objects information, * So use h5tools_is_obj_same() to improve performance by skipping * comparing details of same objects. @@ -961,26 +966,26 @@ hsize_t h5diff(const char *fname1, if(!(options->m_verbose || options->m_report)) { + h5difftrace("h5diff NOT (options->m_verbose || options->m_report)\n"); /* if no danglink links */ if ( l_ret1 > 0 && l_ret2 > 0 ) - if (h5tools_is_obj_same(file1_id,obj1fullname,file2_id,obj2fullname)!=0) + if (h5tools_is_obj_same(file1_id, obj1fullname, file2_id, obj2fullname)!=0) goto out; } - - /* if both obj1 and obj2 are group */ - if (obj1type == H5TRAV_TYPE_GROUP && obj2type == H5TRAV_TYPE_GROUP) + both_objs_grp = (obj1type == H5TRAV_TYPE_GROUP && obj2type == H5TRAV_TYPE_GROUP); + if (both_objs_grp) { - - /* - * traverse group1 + h5difftrace("h5diff both_objs_grp TRUE\n"); + /* + * traverse group1 */ trav_info_init(fname1, file1_id, &info1_grp); /* optional data pass */ info1_grp->opts = (diff_opt_t*)options; - if(h5trav_visit(file1_id,obj1fullname,TRUE,TRUE, - trav_grp_objs,trav_grp_symlinks, info1_grp) < 0) + if(h5trav_visit(file1_id, obj1fullname, TRUE, TRUE, + trav_grp_objs, trav_grp_symlinks, info1_grp) < 0) { parallel_print("Error: Could not get file contents\n"); options->err_stat = 1; @@ -988,28 +993,30 @@ hsize_t h5diff(const char *fname1, } info1_lp = info1_grp; - /* - * traverse group2 + /* + * traverse group2 */ trav_info_init(fname2, file2_id, &info2_grp); /* optional data pass */ info2_grp->opts = (diff_opt_t*)options; - if(h5trav_visit(file2_id,obj2fullname,TRUE,TRUE, - trav_grp_objs,trav_grp_symlinks, info2_grp) < 0) + if(h5trav_visit(file2_id, obj2fullname, TRUE, TRUE, + trav_grp_objs, trav_grp_symlinks, info2_grp) < 0) { parallel_print("Error: Could not get file contents\n"); options->err_stat = 1; goto out; } /* end if */ info2_lp = info2_grp; - + } #ifdef H5_HAVE_PARALLEL - if(g_Parallel) + if(g_Parallel) + { + /* if both obj1 and obj2 are group */ + if (both_objs_grp) { - if((HDstrlen(fname1) > MAX_FILENAME) || - (HDstrlen(fname2) > MAX_FILENAME)) + if((HDstrlen(fname1) > MAX_FILENAME) || (HDstrlen(fname2) > MAX_FILENAME)) { HDfprintf(stderr, "The parallel diff only supports path names up to %d characters\n", MAX_FILENAME); MPI_Abort(MPI_COMM_WORLD, 0); @@ -1021,26 +1028,45 @@ hsize_t h5diff(const char *fname1, /* Alert the worker tasks that there's going to be work. */ for(i = 1; i < g_nTasks; i++) MPI_Send(filenames, (MAX_FILENAME * 2), MPI_CHAR, i, MPI_TAG_PARALLEL, MPI_COMM_WORLD); - } /* end if */ -#endif - build_match_list (obj1fullname, info1_lp, obj2fullname, info2_lp, - &match_list, options); - nfound = diff_match(file1_id, obj1fullname, info1_lp, - file2_id, obj2fullname, info2_lp, - match_list, options); - } - else - { -#ifdef H5_HAVE_PARALLEL - if(g_Parallel) + } + else + { /* Only single object diff, parallel workers won't be needed */ phdiff_dismiss_workers(); + } + } /* end if */ #endif - nfound = diff_compare(file1_id, fname1, obj1fullname, info1_lp, - file2_id, fname2, obj2fullname, info2_lp, - options); + /* process the objects */ + build_match_list (obj1fullname, info1_lp, obj2fullname, info2_lp, + &match_list, options); + if (both_objs_grp) + { + /*------------------------------------------------------ + * print the list + */ + if(options->m_verbose) + { + parallel_print("\n"); + /* if given objects is group under root */ + if (HDstrcmp (obj1fullname,"/") || HDstrcmp (obj2fullname,"/")) + parallel_print("group1 group2\n"); + else + parallel_print("file1 file2\n"); + parallel_print("---------------------------------------\n"); + for(i = 0; i < match_list->nobjs; i++) + { + char c1, c2; + c1 = (match_list->objs[i].flags[0]) ? 'x' : ' '; + c2 = (match_list->objs[i].flags[1]) ? 'x' : ' '; + parallel_print("%5c %6c %-15s\n", c1, c2, match_list->objs[i].name); + } /* end for */ + parallel_print ("\n"); + } /* end if */ } + nfound = diff_match(file1_id, obj1fullname, info1_lp, + file2_id, obj2fullname, info2_lp, + match_list, options); out: #ifdef H5_HAVE_PARALLEL @@ -1077,6 +1103,7 @@ out: H5Fclose(file1_id); H5Fclose(file2_id); } H5E_END_TRY; + h5difftrace("h5diff finish\n"); return nfound; } @@ -1125,6 +1152,7 @@ hsize_t diff_match(hid_t file1_id, const char *grp1, trav_info_t *info1, size_t idx2 = 0; + h5difftrace("diff_match start\n"); /* * if not root, prepare object name to be pre-appended to group path to * make full path @@ -1142,7 +1170,7 @@ hsize_t diff_match(hid_t file1_id, const char *grp1, trav_info_t *info1, *------------------------------------------------------------------------- */ - /* not valid compare nused when --exclude-path option is used */ + /* not valid compare used when --exclude-path option is used */ if (!options->exclude_path) { /* number of different objects */ @@ -1222,7 +1250,7 @@ hsize_t diff_match(hid_t file1_id, const char *grp1, trav_info_t *info1, { int workerFound = 0; - h5diffdebug("beginning of big else block\n"); + h5difftrace("Beginning of big else block\n"); /* We're in parallel mode */ /* Since the data type of diff value is hsize_t which can * be arbitary large such that there is no MPI type that @@ -1247,7 +1275,6 @@ hsize_t diff_match(hid_t file1_id, const char *grp1, trav_info_t *info1, args.argdata.type[1] = info2->paths[idx2].type; args.argdata.is_same_trgobj = table->objs[i].is_same_trgobj; - h5diffdebug2("busyTasks=%d\n", busyTasks); /* if there are any outstanding print requests, let's handle one. */ if(busyTasks > 0) { @@ -1319,7 +1346,6 @@ hsize_t diff_match(hid_t file1_id, const char *grp1, trav_info_t *info1, } /* end if */ } /* end for */ - h5diffdebug2("workerfound is %d \n", workerFound); if(!workerFound) { /* if they were all busy, we've got to wait for one free up @@ -1395,7 +1421,7 @@ hsize_t diff_match(hid_t file1_id, const char *grp1, trav_info_t *info1, HDfree (obj2_fullpath); } /* end if */ } /* end for */ - h5diffdebug("done with for loop\n"); + h5difftrace("done with for loop\n"); #ifdef H5_HAVE_PARALLEL if(g_Parallel) @@ -1482,7 +1508,7 @@ hsize_t diff_match(hid_t file1_id, const char *grp1, trav_info_t *info1, /* Print any final data waiting in our queue */ print_incoming_data(); } /* end if */ - h5diffdebug("done with if block\n"); + h5difftrace("done with if block\n"); HDfree(workerTasks); } @@ -1491,130 +1517,7 @@ hsize_t diff_match(hid_t file1_id, const char *grp1, trav_info_t *info1, /* free table */ if (table) trav_table_free(table); - - return nfound; -} - - -/*------------------------------------------------------------------------- - * Function: diff_compare - * - * Purpose: get objects from list, and check for the same type - * - * Return: Number of differences found - * - * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu - * Date: May 9, 2003 - * - * Programmer: Jonathan Kim - * - add following links feature (Feb 11,2010) - *------------------------------------------------------------------------- - */ - -hsize_t diff_compare(hid_t file1_id, - const char *file1_name, - const char *obj1_name, - trav_info_t *info1, - hid_t file2_id, - const char *file2_name, - const char *obj2_name, - trav_info_t *info2, - diff_opt_t *options) -{ - int f1 = 0; - int f2 = 0; - hsize_t nfound = 0; - ssize_t i,j; - int l_ret; - int is_dangle_link1 = 0; - int is_dangle_link2 = 0; - const char *obj1name = obj1_name; - const char *obj2name = obj2_name; - diff_args_t argdata; - - /* local variables for diff() */ - h5trav_type_t obj1type, obj2type; - - /* to get link info */ - h5tool_link_info_t linkinfo1; - h5tool_link_info_t linkinfo2; - - /* init link info struct */ - HDmemset(&linkinfo1, 0, sizeof(h5tool_link_info_t)); - HDmemset(&linkinfo2, 0, sizeof(h5tool_link_info_t)); - - i = h5trav_getindex (info1, obj1name); - j = h5trav_getindex (info2, obj2name); - - if (i == -1) - { - parallel_print ("Object <%s> could not be found in <%s>\n", obj1name, - file1_name); - f1 = 1; - } - if (j == -1) - { - parallel_print ("Object <%s> could not be found in <%s>\n", obj2name, - file2_name); - f2 = 1; - } - if (f1 || f2) - { - options->err_stat = 1; - return 0; - } - /* use the name with "/" first, as obtained by iterator function */ - obj1name = info1->paths[i].path; - obj2name = info2->paths[j].path; - - obj1type = info1->paths[i].type; - obj2type = info2->paths[j].type; - - /* Set argdata to pass other args into diff() */ - argdata.type[0] = obj1type; - argdata.type[1] = obj2type; - argdata.is_same_trgobj = 0; - - nfound = diff(file1_id, obj1name, - file2_id, obj2name, - options, &argdata); - -out: - /*------------------------------- - * handle dangling link(s) */ - /* both obj1 and obj2 are dangling links */ - if(is_dangle_link1 && is_dangle_link2) - { - if(print_objname(options, nfound)) - { - do_print_objname("dangling link", obj1name, obj2name, options); - print_found(nfound); - } - } - /* obj1 is dangling link */ - else if (is_dangle_link1) - { - if(options->m_verbose) - parallel_print("obj1 <%s> is a dangling link.\n", obj1name); - nfound++; - if(print_objname(options, nfound)) - print_found(nfound); - } - /* obj2 is dangling link */ - else if (is_dangle_link2) - { - if(options->m_verbose) - parallel_print("obj2 <%s> is a dangling link.\n", obj2name); - nfound++; - if(print_objname(options, nfound)) - print_found(nfound); - } - - /* free link info buffer */ - if (linkinfo1.trg_path) - HDfree((char *)linkinfo1.trg_path); - if (linkinfo2.trg_path) - HDfree((char *)linkinfo2.trg_path); + h5difftrace("diff_match finish\n"); return nfound; } @@ -1664,6 +1567,7 @@ hsize_t diff(hid_t file1_id, hsize_t nfound = 0; h5trav_type_t object_type; + h5difftrace("diff start\n"); /* to get link info */ h5tool_link_info_t linkinfo1; @@ -1768,6 +1672,7 @@ hsize_t diff(hid_t file1_id, */ if (argdata->is_same_trgobj) { + h5difftrace("argdata->is_same_trgobj\n"); is_hard_link = (object_type == H5TRAV_TYPE_DATASET || object_type == H5TRAV_TYPE_NAMED_DATATYPE || object_type == H5TRAV_TYPE_GROUP); @@ -2053,6 +1958,7 @@ out2: H5Tclose(grp2_id); /* enable error reporting */ } H5E_END_TRY; + h5difftrace("diff finish\n"); return nfound; } diff --git a/tools/lib/h5diff.h b/tools/lib/h5diff.h index 6985b68..f05d0de 100644 --- a/tools/lib/h5diff.h +++ b/tools/lib/h5diff.h @@ -19,6 +19,23 @@ #include "hdf5.h" #include "h5trav.h" +/* + * Debug printf macros. The prefix allows output filtering by test scripts. + */ +#ifdef H5DIFF_DEBUG +#define h5difftrace(x) HDfprintf(stderr, "h5diff debug: " x) +#define h5diffdebug2(x1, x2) HDfprintf(stderr, "h5diff debug: " x1, x2) +#define h5diffdebug3(x1, x2, x3) HDfprintf(stderr, "h5diff debug: " x1, x2, x3) +#define h5diffdebug4(x1, x2, x3, x4) HDfprintf(stderr, "h5diff debug: " x1, x2, x3, x4) +#define h5diffdebug5(x1, x2, x3, x4, x5) HDfprintf(stderr, "h5diff debug: " x1, x2, x3, x4, x5) +#else +#define h5difftrace(x) +#define h5diffdebug2(x1, x2) +#define h5diffdebug3(x1, x2, x3) +#define h5diffdebug4(x1, x2, x3, x4) +#define h5diffdebug5(x1, x2, x3, x4, x5) +#endif + #define MAX_FILENAME 1024 /*------------------------------------------------------------------------- @@ -118,15 +135,6 @@ hsize_t diff_datasetid( hid_t dset1_id, const char *obj2_name, diff_opt_t *options); -hsize_t diff_compare( hid_t file1_id, - const char *file1_name, - const char *obj1_name, - trav_info_t *info1, - hid_t file2_id, - const char *file2_name, - const char *obj2_name, - trav_info_t *info2, - diff_opt_t *options ); hsize_t diff_match( hid_t file1_id, const char *grp1, trav_info_t *info1, hid_t file2_id, const char *grp2, trav_info_t *info2, diff --git a/tools/lib/h5diff_array.c b/tools/lib/h5diff_array.c index 604a825..1e7f88b 100644 --- a/tools/lib/h5diff_array.c +++ b/tools/lib/h5diff_array.c @@ -230,6 +230,7 @@ hsize_t diff_array( void *_mem1, mcomp_t members; H5T_class_t type_class; + h5difftrace("diff_array start\n"); /* get the size. */ size = H5Tget_size( m_type ); type_class = H5Tget_class(m_type); @@ -344,6 +345,7 @@ hsize_t diff_array( void *_mem1, } /* i */ close_member_types(&members); } /* switch */ + h5difftrace("diff_array finish\n"); return nfound; } @@ -423,6 +425,7 @@ hsize_t diff_datum(void *_mem1, double per; int both_zero; + h5difftrace("diff_datum start\n"); type_size = H5Tget_size( m_type ); type_class = H5Tget_class(m_type); @@ -2537,6 +2540,7 @@ hsize_t diff_datum(void *_mem1, break; /* H5T_FLOAT class */ } /* switch */ + h5difftrace("diff_datum finish\n"); return nfound; } @@ -2822,6 +2826,7 @@ hsize_t character_compare(unsigned char *mem1, HDmemcpy(&temp1_uchar, mem1, sizeof(unsigned char)); HDmemcpy(&temp2_uchar, mem2, sizeof(unsigned char)); + h5difftrace("character_compare start\n"); if (temp1_uchar != temp2_uchar) { @@ -2836,6 +2841,7 @@ hsize_t character_compare(unsigned char *mem1, } nfound++; } + h5difftrace("character_compare finish\n"); return nfound; } @@ -2872,6 +2878,7 @@ hsize_t character_compare_opt(unsigned char *mem1, HDmemcpy(&temp1_uchar, mem1, sizeof(unsigned char)); HDmemcpy(&temp2_uchar, mem2, sizeof(unsigned char)); + h5difftrace("character_compare_opt start\n"); /* -d and !-p */ if (options->d && !options->p) @@ -2927,6 +2934,7 @@ hsize_t character_compare_opt(unsigned char *mem1, } nfound++; } + h5difftrace("character_compare_opt finish\n"); return nfound; @@ -2965,6 +2973,7 @@ hsize_t diff_float(unsigned char *mem1, int isnan1=0; int isnan2=0; + h5difftrace("diff_float start\n"); /*------------------------------------------------------------------------- * -d and !-p @@ -3202,6 +3211,7 @@ hsize_t diff_float(unsigned char *mem1, } + h5difftrace("diff_float finish\n"); return nfound; } @@ -3239,6 +3249,7 @@ hsize_t diff_double(unsigned char *mem1, int isnan1=0; int isnan2=0; + h5difftrace("diff_double start\n"); /*------------------------------------------------------------------------- * -d and !-p *------------------------------------------------------------------------- @@ -3479,6 +3490,7 @@ hsize_t diff_double(unsigned char *mem1, } + h5difftrace("diff_double finish\n"); return nfound; } @@ -3521,6 +3533,7 @@ hsize_t diff_ldouble(unsigned char *mem1, int isnan1=0; int isnan2=0; + h5difftrace("diff_ldouble start\n"); /*------------------------------------------------------------------------- * -d and !-p @@ -3762,6 +3775,7 @@ hsize_t diff_ldouble(unsigned char *mem1, } + h5difftrace("diff_ldouble finish\n"); return nfound; } @@ -3802,6 +3816,7 @@ hsize_t diff_schar(unsigned char *mem1, double per; int both_zero; + h5difftrace("diff_schar start\n"); /* -d and !-p */ if (options->d && !options->p) @@ -3943,6 +3958,7 @@ hsize_t diff_schar(unsigned char *mem1, } /* nelmts */ } + h5difftrace("diff_schar finish\n"); return nfound; } @@ -3979,6 +3995,7 @@ hsize_t diff_uchar(unsigned char *mem1, double per; int both_zero; + h5difftrace("diff_uchar start\n"); /* -d and !-p */ if (options->d && !options->p) @@ -4121,6 +4138,7 @@ hsize_t diff_uchar(unsigned char *mem1, } /* nelmts */ } + h5difftrace("diff_uchar finish\n"); return nfound; } @@ -4155,6 +4173,7 @@ hsize_t diff_short(unsigned char *mem1, double per; int both_zero; + h5difftrace("diff_short start\n"); /* -d and !-p */ if (options->d && !options->p) { @@ -4298,6 +4317,7 @@ hsize_t diff_short(unsigned char *mem1, } /* nelmts */ } + h5difftrace("diff_short finish\n"); return nfound; } @@ -4333,6 +4353,7 @@ hsize_t diff_ushort(unsigned char *mem1, double per; int both_zero; + h5difftrace("diff_ushort start\n"); /* -d and !-p */ if (options->d && !options->p) { @@ -4476,6 +4497,7 @@ hsize_t diff_ushort(unsigned char *mem1, } /* nelmts */ } + h5difftrace("diff_ushort finish\n"); return nfound; } @@ -4512,6 +4534,7 @@ hsize_t diff_int(unsigned char *mem1, double per; int both_zero; + h5difftrace("diff_int start\n"); /* -d and !-p */ if (options->d && !options->p) { @@ -4655,6 +4678,7 @@ hsize_t diff_int(unsigned char *mem1, } /* nelmts */ } + h5difftrace("diff_int finish\n"); return nfound; } @@ -4691,6 +4715,7 @@ hsize_t diff_uint(unsigned char *mem1, double per; int both_zero; + h5difftrace("diff_uint start\n"); /* -d and !-p */ if (options->d && !options->p) { @@ -4832,6 +4857,7 @@ hsize_t diff_uint(unsigned char *mem1, } /* nelmts */ } + h5difftrace("diff_uint finish\n"); return nfound; } @@ -4868,6 +4894,7 @@ hsize_t diff_long(unsigned char *mem1, double per; int both_zero; + h5difftrace("diff_long start\n"); /* -d and !-p */ if (options->d && !options->p) { @@ -5014,6 +5041,7 @@ hsize_t diff_long(unsigned char *mem1, } /* nelmts */ } + h5difftrace("diff_long finish\n"); return nfound; } @@ -5051,6 +5079,7 @@ hsize_t diff_ulong(unsigned char *mem1, double per; int both_zero; + h5difftrace("diff_ulong start\n"); /* -d and !-p */ if (options->d && !options->p) @@ -5198,6 +5227,7 @@ hsize_t diff_ulong(unsigned char *mem1, } /* nelmts */ } + h5difftrace("diff_ulong finish\n"); return nfound; } @@ -5234,6 +5264,7 @@ hsize_t diff_llong(unsigned char *mem1, double per; int both_zero; + h5difftrace("diff_llong start\n"); /* -d and !-p */ if (options->d && !options->p) { @@ -5371,6 +5402,7 @@ hsize_t diff_llong(unsigned char *mem1, } /* nelmts */ } + h5difftrace("diff_llong finish\n"); return nfound; } @@ -5408,6 +5440,7 @@ hsize_t diff_ullong(unsigned char *mem1, double per; int both_zero; + h5difftrace("diff_ullong start\n"); /* -d and !-p */ if (options->d && !options->p) { @@ -5549,6 +5582,7 @@ hsize_t diff_ullong(unsigned char *mem1, } /* nelmts */ } + h5difftrace("diff_ullong finish\n"); return nfound; } @@ -5575,6 +5609,7 @@ int ull2float(unsigned long long ull_value, float *f_value) size_t src_size; size_t dst_size; + h5difftrace("ull2float start\n"); if((dxpl_id = H5Pcreate(H5P_DATASET_XFER))<0) return -1; @@ -5592,6 +5627,7 @@ int ull2float(unsigned long long ull_value, float *f_value) if(buf) HDfree(buf); + h5difftrace("ull2float finish\n"); return 0; @@ -5601,6 +5637,7 @@ error: } H5E_END_TRY; if(buf) HDfree(buf); + h5difftrace("ull2float errored\n"); return -1; } @@ -5620,6 +5657,7 @@ error: static hbool_t equal_double(double value, double expected, diff_opt_t *options) { + h5difftrace("equal_double start\n"); if ( options->do_nans ) { @@ -5656,6 +5694,7 @@ hbool_t equal_double(double value, double expected, diff_opt_t *options) if ( ABS( (value-expected) ) < DBL_EPSILON) return TRUE; } + h5difftrace("equal_double finish\n"); return FALSE; } @@ -5673,6 +5712,7 @@ hbool_t equal_double(double value, double expected, diff_opt_t *options) static hbool_t equal_ldouble(long double value, long double expected, diff_opt_t *options) { + h5difftrace("equal_ldouble start\n"); if ( options->do_nans ) { @@ -5709,6 +5749,7 @@ hbool_t equal_ldouble(long double value, long double expected, diff_opt_t *optio if ( ABS( (value-expected) ) < DBL_EPSILON) return TRUE; } + h5difftrace("equal_ldouble finish\n"); return FALSE; } @@ -5730,6 +5771,7 @@ hbool_t equal_ldouble(long double value, long double expected, diff_opt_t *optio static hbool_t equal_float(float value, float expected, diff_opt_t *options) { + h5difftrace("equal_float start\n"); if ( options->do_nans ) { @@ -5766,6 +5808,7 @@ hbool_t equal_float(float value, float expected, diff_opt_t *options) if ( ABS( (value-expected) ) < FLT_EPSILON) return TRUE; } + h5difftrace("equal_float finish\n"); return FALSE; @@ -5795,6 +5838,7 @@ my_isnan(dtype_t type, void *val) int retval = 0; char s[256]; + h5difftrace("my_isnan start\n"); if (FLT_FLOAT==type) { float x; @@ -5893,6 +5937,7 @@ my_isnan(dtype_t type, void *val) } } #endif /*H5_VMS*/ + h5difftrace("my_isnan finish\n"); return retval; } diff --git a/tools/lib/h5diff_dset.c b/tools/lib/h5diff_dset.c index c1ed429..da58cde 100644 --- a/tools/lib/h5diff_dset.c +++ b/tools/lib/h5diff_dset.c @@ -218,6 +218,7 @@ hsize_t diff_datasetid( hid_t did1, int i; unsigned int vl_data = 0; /*contains VL datatypes */ + h5difftrace("diff_datasetid start\n"); /* Get the dataspace handle */ if ( (sid1 = H5Dget_space(did1)) < 0 ) goto error; @@ -263,6 +264,7 @@ hsize_t diff_datasetid( hid_t did1, * check for empty datasets *------------------------------------------------------------------------- */ + h5difftrace("check for empty datasets\n"); storage_size1=H5Dget_storage_size(did1); storage_size2=H5Dget_storage_size(did2); @@ -300,6 +302,7 @@ hsize_t diff_datasetid( hid_t did1, * memory type and sizes *------------------------------------------------------------------------- */ + h5difftrace("check for memory type and sizes\n"); if ((m_tid1=h5tools_get_native_type(f_tid1)) < 0) goto error; @@ -315,10 +318,12 @@ hsize_t diff_datasetid( hid_t did1, */ if (can_compare) { + h5difftrace("can_compare for sign\n"); sign1=H5Tget_sign(m_tid1); sign2=H5Tget_sign(m_tid2); if ( sign1 != sign2 ) { + h5difftrace("sign1 != sign2\n"); if ((options->m_verbose||options->m_list_not_cmp) && obj1_name && obj2_name) { parallel_print("Not comparable: <%s> has sign %s ", obj1_name, get_sign(sign1)); @@ -341,6 +346,7 @@ hsize_t diff_datasetid( hid_t did1, */ if(can_compare) /* it is possible to compare */ { + h5difftrace("can_compare attempt\n"); /*----------------------------------------------------------------- * get number of elements @@ -360,8 +366,10 @@ hsize_t diff_datasetid( hid_t did1, * "upgrade" the smaller memory size *------------------------------------------------------------------ */ + h5difftrace("upgrade the smaller memory size?\n"); if(m_size1 != m_size2) { + h5difftrace("m_size1 != m_size2\n"); if(m_size1 < m_size2) { H5Tclose(m_tid1); @@ -399,6 +407,7 @@ hsize_t diff_datasetid( hid_t did1, } /* end if */ if(buf1 != NULL && buf2 != NULL) { + h5difftrace("buf1 != NULL && buf2 != NULL\n"); if(H5Dread(did1, m_tid1, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf1) < 0) goto error; if(H5Dread(did2, m_tid2, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf2) < 0) @@ -519,6 +528,7 @@ hsize_t diff_datasetid( hid_t did1, * the if condition refers to cases when the dataset is a referenced object *------------------------------------------------------------------------- */ + h5difftrace("compare attributes?\n"); if(obj1_name) nfound += diff_attr(did1,did2,obj1_name,obj2_name,options); @@ -526,6 +536,7 @@ hsize_t diff_datasetid( hid_t did1, * close *------------------------------------------------------------------------- */ + h5difftrace("compare attributes?\n"); /* free */ if(buf1 != NULL) { @@ -553,6 +564,7 @@ hsize_t diff_datasetid( hid_t did1, H5Tclose(m_tid1); H5Tclose(m_tid2); } H5E_END_TRY; + h5difftrace("diff_datasetid finish\n"); return nfound; @@ -603,6 +615,7 @@ error: H5Tclose(m_tid2); /* enable error reporting */ } H5E_END_TRY; + h5difftrace("diff_datasetid errored\n"); return nfound; } diff --git a/tools/lib/h5tools.c b/tools/lib/h5tools.c index 495aca1..7b6098d 100644 --- a/tools/lib/h5tools.c +++ b/tools/lib/h5tools.c @@ -1072,256 +1072,6 @@ init_acc_pos(h5tools_context_t *ctx, hsize_t *dims) * Failure: FAIL *------------------------------------------------------------------------- */ - -#ifdef DEBUG_H5DUMP_BIN -int -render_bin_output(FILE *stream, hid_t container, hid_t tid, void *_mem) -{ - HERR_INIT(int, SUCCEED) - unsigned char *mem = (unsigned char*)_mem; - size_t size; /* datum size */ - float tempfloat; - double tempdouble; - unsigned long long tempullong; - long long templlong; - unsigned long tempulong; - long templong; - unsigned int tempuint; - int tempint; - unsigned short tempushort; - short tempshort; - unsigned char tempuchar; - char tempschar; -#if H5_SIZEOF_LONG_DOUBLE !=0 - long double templdouble; -#endif - static char fmt_llong[8], fmt_ullong[8]; - if (!fmt_llong[0]) { - HDsprintf(fmt_llong, "%%%sd", H5_PRINTF_LL_WIDTH); - HDsprintf(fmt_ullong, "%%%su", H5_PRINTF_LL_WIDTH); - } - - if((size = H5Tget_size(tid)) == 0) - H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_size failed"); - - if (H5Tequal(tid, H5T_NATIVE_FLOAT)) { - HDmemcpy(&tempfloat, mem, sizeof(float)); - HDfprintf(stream, "%g ", tempfloat); - } - else if (H5Tequal(tid, H5T_NATIVE_DOUBLE)) { - HDmemcpy(&tempdouble, mem, sizeof(double)); - HDfprintf(stream, "%g ", tempdouble); - } -#if H5_SIZEOF_LONG_DOUBLE !=0 - else if (H5Tequal(tid, H5T_NATIVE_LDOUBLE)) { - HDmemcpy(&templdouble, mem, sizeof(long double)); - HDfprintf(stream, "%Lf ", templdouble); - } -#endif - else if (H5T_STRING == H5Tget_class(tid)) { - unsigned int i; - H5T_str_t pad; - char *s; - - pad = H5Tget_strpad(tid); - - if (H5Tis_variable_str(tid)) { - s = *(char**) mem; - if (s != NULL) - size = HDstrlen(s); - } - else { - s = (char *) mem; - if((size = H5Tget_size(tid)) == 0) - H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_size failed"); - } - for (i = 0; i < size && (s[i] || pad != H5T_STR_NULLTERM); i++) { - HDmemcpy(&tempuchar, &s[i], sizeof(unsigned char)); - HDfprintf(stream, "%d", tempuchar); - } /* i */ - } - else if (H5Tequal(tid, H5T_NATIVE_INT)) { - HDmemcpy(&tempint, mem, sizeof(int)); - HDfprintf(stream, "%d ", tempint); - } - else if (H5Tequal(tid, H5T_NATIVE_UINT)) { - HDmemcpy(&tempuint, mem, sizeof(unsigned int)); - HDfprintf(stream, "%u ", tempuint); - } - else if (H5Tequal(tid, H5T_NATIVE_SCHAR)) { - HDmemcpy(&tempschar, mem, sizeof(char)); - HDfprintf(stream, "%d ", tempschar); - } - else if (H5Tequal(tid, H5T_NATIVE_UCHAR)) { - HDmemcpy(&tempuchar, mem, sizeof(unsigned char)); - HDfprintf(stream, "%u ", tempuchar); - } - else if (H5Tequal(tid, H5T_NATIVE_SHORT)) { - HDmemcpy(&tempshort, mem, sizeof(short)); - HDfprintf(stream, "%d ", tempshort); - } - else if (H5Tequal(tid, H5T_NATIVE_USHORT)) { - HDmemcpy(&tempushort, mem, sizeof(unsigned short)); - HDfprintf(stream, "%u ", tempushort); - } - else if (H5Tequal(tid, H5T_NATIVE_LONG)) { - HDmemcpy(&templong, mem, sizeof(long)); - HDfprintf(stream, "%ld ", templong); - } - else if (H5Tequal(tid, H5T_NATIVE_ULONG)) { - HDmemcpy(&tempulong, mem, sizeof(unsigned long)); - HDfprintf(stream, "%lu ", tempulong); - } - else if (H5Tequal(tid, H5T_NATIVE_LLONG)) { - HDmemcpy(&templlong, mem, sizeof(long long)); - HDfprintf(stream, fmt_llong, templlong); - } - else if (H5Tequal(tid, H5T_NATIVE_ULLONG)) { - HDmemcpy(&tempullong, mem, sizeof(unsigned long long)); - HDfprintf(stream, fmt_ullong, tempullong); - } - else if (H5Tequal(tid, H5T_NATIVE_HSSIZE)) { - if (sizeof(hssize_t) == sizeof(int)) { - HDmemcpy(&tempint, mem, sizeof(int)); - HDfprintf(stream, "%d ", tempint); - } - else if (sizeof(hssize_t) == sizeof(long)) { - HDmemcpy(&templong, mem, sizeof(long)); - HDfprintf(stream, "%ld ", templong); - } - else { - HDmemcpy(&templlong, mem, sizeof(long long)); - HDfprintf(stream, fmt_llong, templlong); - } - } - else if (H5Tequal(tid, H5T_NATIVE_HSIZE)) { - if (sizeof(hsize_t) == sizeof(int)) { - HDmemcpy(&tempuint, mem, sizeof(unsigned int)); - HDfprintf(stream, "%u ", tempuint); - } - else if (sizeof(hsize_t) == sizeof(long)) { - HDmemcpy(&tempulong, mem, sizeof(unsigned long)); - HDfprintf(stream, "%lu ", tempulong); - } - else { - HDmemcpy(&tempullong, mem, sizeof(unsigned long long)); - HDfprintf(stream, fmt_ullong, tempullong); - } - } - else if (H5Tget_class(tid) == H5T_COMPOUND) { - unsigned j; - hid_t memb; - unsigned nmembs; - size_t offset; - - nmembs = H5Tget_nmembers(tid); - - for (j = 0; j < nmembs; j++) { - offset = H5Tget_member_offset(tid, j); - memb = H5Tget_member_type(tid, j); - - if (render_bin_output(stream, container, memb, mem + offset) < 0) - return FAIL; - - H5Tclose(memb); - } - } - else if (H5Tget_class(tid) == H5T_ENUM) { - unsigned int i; - if (1 == size) { - HDfprintf(stream, "0x%02x", mem[0]); - } - else { - for (i = 0; i < size; i++) { - HDfprintf(stream, "%s%02x", i?":":"", mem[i]); - } /*i*/ - }/*else 1 */ - } - else if (H5Tget_class(tid) == H5T_ARRAY) { - int k, ndims; - hsize_t i, dims[H5S_MAX_RANK], temp_nelmts, nelmts; - hid_t memb; - - /* get the array's base datatype for each element */ - memb = H5Tget_super(tid); - size = H5Tget_size(memb); - ndims = H5Tget_array_ndims(tid); - H5Tget_array_dims2(tid, dims); - HDassert(ndims >= 1 && ndims <= H5S_MAX_RANK); - - /* calculate the number of array elements */ - for (k = 0, nelmts = 1; k < ndims; k++) { - temp_nelmts = nelmts; - temp_nelmts *= dims[k]; - nelmts = (size_t) temp_nelmts; - } - - /* dump the array element */ - for (i = 0; i < nelmts; i++) { - if (render_bin_output(stream, container, memb, mem + i * size) < 0) - H5E_THROW(FAIL, H5E_tools_min_id_g, "render_bin_output failed"); - } - - H5Tclose(memb); - } - else if (H5Tget_class(tid) == H5T_VLEN) { - unsigned int i; - hsize_t nelmts; - hid_t memb; - - /* get the VL sequences's base datatype for each element */ - memb = H5Tget_super(tid); - size = H5Tget_size(memb); - - /* Get the number of sequence elements */ - nelmts = ((hvl_t *) mem)->len; - - for (i = 0; i < nelmts; i++) { - /* dump the array element */ - if (render_bin_output(stream, container, memb, ((char *) (((hvl_t *) mem)->p)) + i * size) < 0) - H5E_THROW(FAIL, H5E_tools_min_id_g, "render_bin_output failed"); - } - H5Tclose(memb); - } - else if (H5Tequal(tid, H5T_STD_REF_DSETREG)) { - if (region_output) { - /* region data */ - hid_t region_id, region_space; - H5S_sel_type region_type; - - region_id = H5Rdereference2(container, H5P_DEFAULT, H5R_DATASET_REGION, mem); - if (region_id >= 0) { - region_space = H5Rget_region(container, H5R_DATASET_REGION, mem); - if (region_space >= 0) { - region_type = H5Sget_select_type(region_space); - if(region_type == H5S_SEL_POINTS) - render_bin_output_region_points(region_space, region_id, stream, container); - else - render_bin_output_region_blocks(region_space, region_id, stream, container); - H5Sclose(region_space); - } /* end if (region_space >= 0) */ - H5Dclose(region_id); - } /* end if (region_id >= 0) */ - } /* end if (region_output... */ - } - else if (H5Tequal(tid, H5T_STD_REF_OBJ)) { - } - else { - size_t i; - if (1 == size) { - HDfprintf(stream, "0x%02x", mem[0]); - } - else { - for (i = 0; i < size; i++) { - HDfprintf(stream, "%s%02x", i?":":"", mem[i]); - } /*i*/ - }/*else 1 */ - } - -CATCH - return ret_value; -} -#else int render_bin_output(FILE *stream, hid_t container, hid_t tid, void *_mem, hsize_t block_nelmts) { @@ -1504,7 +1254,6 @@ render_bin_output(FILE *stream, hid_t container, hid_t tid, void *_mem, hsize_t CATCH return ret_value; } -#endif /*------------------------------------------------------------------------- * Audience: Public diff --git a/tools/lib/h5tools_utils.c b/tools/lib/h5tools_utils.c index 11ab5f3..79322bc 100644 --- a/tools/lib/h5tools_utils.c +++ b/tools/lib/h5tools_utils.c @@ -852,6 +852,8 @@ H5tools_get_symlink_info(hid_t file_id, const char * linkpath, h5tool_link_info_ /* set target obj type to return */ link_info->trg_type = trg_oinfo.type; + link_info->objno = trg_oinfo.addr; + link_info->fileno = trg_oinfo.fileno; } /* end if */ else link_info->trg_type = H5O_TYPE_UNKNOWN; diff --git a/tools/lib/h5tools_utils.h b/tools/lib/h5tools_utils.h index f30974a..10c643d 100644 --- a/tools/lib/h5tools_utils.h +++ b/tools/lib/h5tools_utils.h @@ -161,6 +161,8 @@ typedef struct { H5O_type_t trg_type; /* OUT: target type */ const char *trg_path; /* OUT: target obj path. This must be freed * when used with H5tools_get_symlink_info() */ + haddr_t objno; /* OUT: target object address */ + unsigned long fileno; /* OUT: File number that target object is located in */ H5L_info_t linfo; /* OUT: link info */ h5tool_opt_t opt; /* IN: options */ } h5tool_link_info_t; diff --git a/tools/lib/h5trav.c b/tools/lib/h5trav.c index 0215c46..8455360 100644 --- a/tools/lib/h5trav.c +++ b/tools/lib/h5trav.c @@ -354,6 +354,31 @@ trav_info_add(trav_info_t *info, const char *path, h5trav_type_t obj_type) info->paths[idx].objno = HADDR_UNDEF; } /* end trav_info_add() */ + +/*------------------------------------------------------------------------- + * Function: trav_fileinfo_add + * + * Purpose: Add a file addr & fileno to info struct + * + * Return: void + * + *------------------------------------------------------------------------- + */ +void +trav_fileinfo_add(trav_info_t *info, hid_t loc_id) +{ + H5O_info_t oinfo; + size_t idx = info->nused - 1; + + if ( info->paths[idx].path && HDstrcmp(info->paths[idx].path, ".")) + H5Oget_info_by_name(loc_id, info->paths[idx].path, &oinfo, H5P_DEFAULT); + else + H5Oget_info(loc_id, &oinfo); + + info->paths[idx].objno = oinfo.addr; + info->paths[idx].fileno = oinfo.fileno; +} /* end trav_fileinfo_add() */ + /*------------------------------------------------------------------------- * Function: trav_info_visit_obj diff --git a/tools/lib/h5trav.h b/tools/lib/h5trav.h index c416cf8..3548c6b 100644 --- a/tools/lib/h5trav.h +++ b/tools/lib/h5trav.h @@ -177,6 +177,8 @@ H5TOOLS_DLL void trav_info_free(trav_info_t *info); H5TOOLS_DLL void trav_info_add(trav_info_t *info, const char *path, h5trav_type_t obj_type); +H5TOOLS_DLL void trav_fileinfo_add(trav_info_t *info, hid_t loc_id); + /*------------------------------------------------------------------------- * table private functions *------------------------------------------------------------------------- |