diff options
Diffstat (limited to 'tools/lib/h5diff.c')
-rw-r--r-- | tools/lib/h5diff.c | 91 |
1 files changed, 45 insertions, 46 deletions
diff --git a/tools/lib/h5diff.c b/tools/lib/h5diff.c index 92d2769..7830e25 100644 --- a/tools/lib/h5diff.c +++ b/tools/lib/h5diff.c @@ -274,9 +274,9 @@ build_match_list (const char *objname1, trav_info_t *info1, const char *objname2 trav_table_t *table = NULL; size_t idx; - H5TOOLS_DEBUG("build_match_list start - errstat:%d", opts->err_stat); + H5TOOLS_START_DEBUG(" - errstat:%d", opts->err_stat); /* init */ - trav_table_init(&table); + trav_table_init(info1->fid, &table); if (table == NULL) { H5TOOLS_INFO("Cannot create traverse table"); H5TOOLS_GOTO_DONE_NO_RET(); @@ -314,10 +314,20 @@ build_match_list (const char *objname1, trav_info_t *info1, const char *objname2 trav_table_addflags(infile, path1_lp, info1->paths[curr1].type, table); /* if the two point to the same target object, * mark that in table */ - if (info1->paths[curr1].fileno == info2->paths[curr2].fileno && - info1->paths[curr1].objno == info2->paths[curr2].objno) { - idx = table->nobjs - 1; - table->objs[idx].is_same_trgobj = 1; + if(info1->paths[curr1].fileno == info2->paths[curr2].fileno) { + int token_cmp; + + if(H5Otoken_cmp(info1->fid, &info1->paths[curr1].obj_token, + &info2->paths[curr2].obj_token, &token_cmp) < 0) { + H5TOOLS_INFO("Failed to compare object tokens"); + opts->err_stat = H5DIFF_ERR; + H5TOOLS_GOTO_DONE_NO_RET(); + } + + if(!token_cmp) { + idx = table->nobjs - 1; + table->objs[idx].is_same_trgobj = 1; + } } } curr1++; @@ -372,7 +382,7 @@ build_match_list (const char *objname1, trav_info_t *info1, const char *objname2 done: *table_out = table; - H5TOOLS_ENDDEBUG("exit"); + H5TOOLS_ENDDEBUG(""); } @@ -382,7 +392,7 @@ done: * Purpose: Call back function from h5trav_visit(). *------------------------------------------------------------------------*/ static herr_t -trav_grp_objs(const char *path, const H5O_info_t *oinfo, +trav_grp_objs(const char *path, const H5O_info2_t *oinfo, const char *already_visited, void *udata) { trav_info_visit_obj(path, oinfo, already_visited, udata); @@ -397,7 +407,7 @@ trav_grp_objs(const char *path, const H5O_info_t *oinfo, * Track and extra checkings while visiting all symbolic-links. *------------------------------------------------------------------------*/ static herr_t -trav_grp_symlinks(const char *path, const H5L_info_t *linfo, void *udata) +trav_grp_symlinks(const char *path, const H5L_info2_t *linfo, void *udata) { trav_info_t *tinfo = (trav_info_t *)udata; diff_opt_t *opts = (diff_opt_t *)tinfo->opts; @@ -406,6 +416,7 @@ trav_grp_symlinks(const char *path, const H5L_info_t *linfo, void *udata) const char *ext_path; herr_t ret_value = SUCCEED; + H5TOOLS_START_DEBUG(""); /* init linkinfo struct */ HDmemset(&lnk_info, 0, sizeof(h5tool_link_info_t)); @@ -489,7 +500,7 @@ trav_grp_symlinks(const char *path, const H5L_info_t *linfo, void *udata) done: if (lnk_info.trg_path) HDfree(lnk_info.trg_path); - H5TOOLS_ENDDEBUG("exit"); + H5TOOLS_ENDDEBUG(""); return ret_value; } @@ -504,14 +515,10 @@ done: *------------------------------------------------------------------------- */ hsize_t -h5diff(const char *fname1, - const char *fname2, - const char *objname1, - const char *objname2, - diff_opt_t *opts) +h5diff(const char *fname1, const char *fname2, const char *objname1, const char *objname2, diff_opt_t *opts) { - hid_t file1_id = -1; - hid_t file2_id = -1; + hid_t file1_id = H5I_INVALID_HID; + hid_t file2_id = H5I_INVALID_HID; char filenames[2][MAX_FILENAME]; hsize_t nfound = 0; int l_ret1 = -1; @@ -523,7 +530,7 @@ h5diff(const char *fname1, h5trav_type_t obj1type = H5TRAV_TYPE_GROUP; h5trav_type_t obj2type = H5TRAV_TYPE_GROUP; /* for single object */ - H5O_info_t oinfo1, oinfo2; /* object info */ + H5O_info2_t oinfo1, oinfo2; /* object info */ trav_info_t *info1_obj = NULL; trav_info_t *info2_obj = NULL; /* for group object */ @@ -533,8 +540,8 @@ h5diff(const char *fname1, trav_info_t *info1_lp = NULL; trav_info_t *info2_lp = NULL; /* link info from specified object */ - H5L_info_t src_linfo1; - H5L_info_t src_linfo2; + H5L_info2_t src_linfo1; + H5L_info2_t src_linfo2; /* link info from member object */ h5tool_link_info_t trg_linfo1; h5tool_link_info_t trg_linfo2; @@ -542,7 +549,7 @@ h5diff(const char *fname1, trav_table_t *match_list = NULL; diff_err_t ret_value = H5DIFF_NO_ERR; - H5TOOLS_DEBUG("h5diff start"); + H5TOOLS_START_DEBUG(""); /* init filenames */ HDmemset(filenames, 0, MAX_FILENAME * 2); /* init link info struct */ @@ -635,7 +642,7 @@ h5diff(const char *fname1, H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "Error: Object could not be found"); } /* get info from link */ - if(H5Lget_info(file1_id, obj1fullname, &src_linfo1, H5P_DEFAULT) < 0) { + if(H5Lget_info2(file1_id, obj1fullname, &src_linfo1, H5P_DEFAULT) < 0) { parallel_print("Unable to get link info from <%s>\n", obj1fullname); H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Lget_info failed"); } @@ -651,14 +658,14 @@ h5diff(const char *fname1, /* optional data pass */ info1_obj->opts = (diff_opt_t*)opts; - if(H5Oget_info_by_name2(file1_id, obj1fullname, &oinfo1, H5O_INFO_BASIC, H5P_DEFAULT) < 0) { + if(H5Oget_info_by_name3(file1_id, obj1fullname, &oinfo1, H5O_INFO_BASIC, H5P_DEFAULT) < 0) { parallel_print("Error: Could not get file contents\n"); H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "Error: Could not get file contents"); } obj1type = (h5trav_type_t)oinfo1.type; trav_info_add(info1_obj, obj1fullname, obj1type); idx = info1_obj->nused - 1; - info1_obj->paths[idx].objno = oinfo1.addr; + HDmemcpy(&info1_obj->paths[idx].obj_token, &oinfo1.token, sizeof(H5O_token_t)); info1_obj->paths[idx].fileno = oinfo1.fileno; } else if (src_linfo1.type == H5L_TYPE_SOFT) { @@ -685,7 +692,7 @@ h5diff(const char *fname1, H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "Error: Object could not be found"); } /* get info from link */ - if(H5Lget_info(file2_id, obj2fullname, &src_linfo2, H5P_DEFAULT) < 0) { + if(H5Lget_info2(file2_id, obj2fullname, &src_linfo2, H5P_DEFAULT) < 0) { parallel_print("Unable to get link info from <%s>\n", obj2fullname); H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Lget_info failed"); } @@ -701,14 +708,14 @@ h5diff(const char *fname1, /* optional data pass */ info2_obj->opts = (diff_opt_t*)opts; - if(H5Oget_info_by_name2(file2_id, obj2fullname, &oinfo2, H5O_INFO_BASIC, H5P_DEFAULT) < 0) { + if(H5Oget_info_by_name3(file2_id, obj2fullname, &oinfo2, H5O_INFO_BASIC, H5P_DEFAULT) < 0) { parallel_print("Error: Could not get file contents\n"); H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "Error: Could not get file contents"); } obj2type = (h5trav_type_t)oinfo2.type; trav_info_add(info2_obj, obj2fullname, obj2type); idx = info2_obj->nused - 1; - info2_obj->paths[idx].objno = oinfo2.addr; + HDmemcpy(&info2_obj->paths[idx].obj_token, &oinfo2.token, sizeof(H5O_token_t)); info2_obj->paths[idx].fileno = oinfo2.fileno; } else if (src_linfo2.type == H5L_TYPE_SOFT) { @@ -778,8 +785,8 @@ h5diff(const char *fname1, size_t idx = info1_lp->nused - 1; H5TOOLS_DEBUG("h5diff ... ... ... info1_obj not null"); + HDmemcpy(&info1_lp->paths[idx].obj_token, &trg_linfo1.obj_token, sizeof(H5O_token_t)); info1_lp->paths[idx].type = (h5trav_type_t)trg_linfo1.trg_type; - info1_lp->paths[idx].objno = trg_linfo1.objno; info1_lp->paths[idx].fileno = trg_linfo1.fileno; } H5TOOLS_DEBUG("h5diff check symbolic link (object1) finished"); @@ -818,8 +825,8 @@ h5diff(const char *fname1, size_t idx = info2_lp->nused - 1; H5TOOLS_DEBUG("h5diff ... ... ... info2_obj not null"); + HDmemcpy(&info2_lp->paths[idx].obj_token, &trg_linfo2.obj_token, sizeof(H5O_token_t)); info2_lp->paths[idx].type = (h5trav_type_t)trg_linfo2.trg_type; - info2_lp->paths[idx].objno = trg_linfo2.objno; info2_lp->paths[idx].fileno = trg_linfo2.fileno; } H5TOOLS_DEBUG("h5diff check symbolic link (object1) finished"); @@ -962,9 +969,8 @@ done: H5Fclose(file2_id); } H5E_END_TRY; - H5TOOLS_DEBUG("h5diff finish - errstat:%d", opts->err_stat); + H5TOOLS_ENDDEBUG(" - errstat:%d", opts->err_stat); - H5TOOLS_ENDDEBUG("exit"); return nfound; } @@ -1002,7 +1008,7 @@ diff_match(hid_t file1_id, const char *grp1, trav_info_t *info1, size_t idx2 = 0; diff_err_t ret_value = opts->err_stat; - H5TOOLS_DEBUG("diff_match start - errstat:%d", opts->err_stat); + H5TOOLS_START_DEBUG(" - errstat:%d", opts->err_stat); /* * if not root, prepare object name to be pre-appended to group path to * make full path @@ -1042,7 +1048,7 @@ diff_match(hid_t file1_id, const char *grp1, trav_info_t *info1, */ #ifdef H5_HAVE_PARALLEL { - char *workerTasks = (char*)HDmalloc((g_nTasks - 1) * sizeof(char)); + char *workerTasks = (char*)HDmalloc((size_t)(g_nTasks - 1) * sizeof(char)); int n; int busyTasks = 0; struct diffs_found nFoundbyWorker; @@ -1051,7 +1057,7 @@ diff_match(hid_t file1_id, const char *grp1, trav_info_t *info1, MPI_Status Status; /*set all tasks as free */ - HDmemset(workerTasks, 1, (g_nTasks - 1)); + HDmemset(workerTasks, 1, (size_t)(g_nTasks - 1) * sizeof(char)); #endif for(i = 0; i < table->nobjs; i++) { @@ -1340,7 +1346,7 @@ diff_match(hid_t file1_id, const char *grp1, trav_info_t *info1, } /* end while */ for(i = 1; i < g_nTasks; i++) - MPI_Send(NULL, 0, MPI_BYTE, i, MPI_TAG_END, MPI_COMM_WORLD); + MPI_Send(NULL, 0, MPI_BYTE, (int)i, MPI_TAG_END, MPI_COMM_WORLD); /* Print any final data waiting in our queue */ print_incoming_data(); @@ -1357,9 +1363,8 @@ diff_match(hid_t file1_id, const char *grp1, trav_info_t *info1, if (table) trav_table_free(table); - H5TOOLS_DEBUG("diff_match finish diffs=%d - errstat:%d", nfound, opts->err_stat); + H5TOOLS_ENDDEBUG(" diffs=%d - errstat:%d", nfound, opts->err_stat); - H5TOOLS_ENDDEBUG("exit"); return nfound; } @@ -1378,12 +1383,7 @@ diff_match(hid_t file1_id, const char *grp1, trav_info_t *info1, *------------------------------------------------------------------------- */ hsize_t -diff(hid_t file1_id, - const char *path1, - hid_t file2_id, - const char *path2, - diff_opt_t * opts, - diff_args_t *argdata) +diff(hid_t file1_id, const char *path1, hid_t file2_id, const char *path2, diff_opt_t * opts, diff_args_t *argdata) { int status = -1; hid_t dset1_id = H5I_INVALID_HID; @@ -1403,7 +1403,7 @@ diff(hid_t file1_id, h5tool_link_info_t linkinfo1; h5tool_link_info_t linkinfo2; - H5TOOLS_DEBUG("diff start - errstat:%d", opts->err_stat); + H5TOOLS_START_DEBUG(" - errstat:%d", opts->err_stat); /*init link info struct */ HDmemset(&linkinfo1, 0, sizeof(h5tool_link_info_t)); @@ -1793,9 +1793,8 @@ done: /* enable error reporting */ } H5E_END_TRY; - H5TOOLS_DEBUG("diff finish:%d - errstat:%d", nfound, opts->err_stat); + H5TOOLS_ENDDEBUG(": %d - errstat:%d", nfound, opts->err_stat); - H5TOOLS_ENDDEBUG("exit"); return nfound; } |