From 2521c4084c06f078846fe06bb1d3cd7bfa506316 Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Fri, 14 Apr 2006 17:21:54 -0500 Subject: [svn-r12254] Purpose: Anti-feature Description: Revert changes to H5G_stat_t struct, to make it compatible with the 1.6.x branch again. The information that was added to the H5G_stat_t struct will be reported through other API routines. Platforms tested: FreeBSD 4.11 (sleipnir) w/C++ Linux 2.4/64 (mir) w/C++ & Fortran Solaris 2.9 (shanti) --- c++/test/tattr.cpp | 14 ++++---- hl/src/H5DS.c | 18 ++++++----- hl/src/H5IMpublic.h | 4 --- src/H5G.c | 35 ++++++++------------ src/H5Gpublic.h | 13 ++++++++ src/H5R.c | 23 ++++++++++--- test/links.c | 8 ++--- test/mount.c | 4 +-- test/mtime.c | 12 +++---- test/objcopy.c | 16 +++++---- test/stab.c | 20 ++++++------ test/tattr.c | 14 ++++---- test/tmisc.c | 60 +++++++++++++++++----------------- test/unlink.c | 2 +- tools/h5dump/h5dump.c | 55 +++++++++++++++++++------------ tools/h5ls/h5ls.c | 73 +++++++++++++++++++++++------------------- tools/h5repack/h5repack_copy.c | 4 +-- tools/h5repack/h5repack_refs.c | 2 +- tools/lib/h5diff.c | 8 ++--- tools/lib/h5tools_ref.c | 18 +++++++---- tools/lib/h5tools_str.c | 14 +++++--- tools/lib/h5tools_utils.c | 20 +++++++----- tools/lib/h5trav.c | 29 +++++++++-------- tools/misc/h5stat.c | 24 ++++++++------ 24 files changed, 274 insertions(+), 216 deletions(-) diff --git a/c++/test/tattr.cpp b/c++/test/tattr.cpp index 9051f3f..7768952 100644 --- a/c++/test/tattr.cpp +++ b/c++/test/tattr.cpp @@ -1051,7 +1051,7 @@ test_attr_dtype_shared(void) // Check reference count on named datatype */ fid1.getObjinfo(TYPE1_NAME, statbuf); - verify_val(statbuf.u.obj.nlink, 1, "DataType::getObjinfo", __LINE__, __FILE__); + verify_val(statbuf.nlink, 1, "DataType::getObjinfo", __LINE__, __FILE__); // Create dataspace for dataset */ DataSpace dspace; @@ -1061,14 +1061,14 @@ test_attr_dtype_shared(void) // Check reference count on named datatype */ fid1.getObjinfo(TYPE1_NAME, statbuf); - verify_val(statbuf.u.obj.nlink, 2, "H5File::getObjinfo", __LINE__, __FILE__); + verify_val(statbuf.nlink, 2, "H5File::getObjinfo", __LINE__, __FILE__); // Create attribute on dataset */ Attribute attr = dset.createAttribute(ATTR1_NAME,dtype,dspace); // Check reference count on named datatype */ fid1.getObjinfo(TYPE1_NAME, statbuf); - verify_val(statbuf.u.obj.nlink, 3, "DataSet::getObjinfo", __LINE__, __FILE__); + verify_val(statbuf.nlink, 3, "DataSet::getObjinfo", __LINE__, __FILE__); // Close attribute */ attr.close(); @@ -1078,14 +1078,14 @@ test_attr_dtype_shared(void) // Check reference count on named datatype */ fid1.getObjinfo(TYPE1_NAME, statbuf); - verify_val(statbuf.u.obj.nlink, 2, "DataSet::getObjinfo after DataSet::removeAttr", __LINE__, __FILE__); + verify_val(statbuf.nlink, 2, "DataSet::getObjinfo after DataSet::removeAttr", __LINE__, __FILE__); // Create attribute on dataset */ attr = dset.createAttribute(ATTR1_NAME,dtype,dspace); // Check reference count on named datatype */ fid1.getObjinfo(TYPE1_NAME, statbuf); - verify_val(statbuf.u.obj.nlink, 3, "DataSet::createAttribute", __LINE__, __FILE__); + verify_val(statbuf.nlink, 3, "DataSet::createAttribute", __LINE__, __FILE__); // Write data into the attribute */ attr.write(PredType::NATIVE_INT,&data); @@ -1116,14 +1116,14 @@ test_attr_dtype_shared(void) // Check reference count on named datatype */ fid1.getObjinfo(TYPE1_NAME, statbuf); - verify_val(statbuf.u.obj.nlink, 3, "DataSet::openAttribute", __LINE__, __FILE__); + verify_val(statbuf.nlink, 3, "DataSet::openAttribute", __LINE__, __FILE__); // Unlink the dataset */ fid1.unlink(DSET1_NAME); // Check reference count on named datatype */ fid1.getObjinfo(TYPE1_NAME, statbuf); - verify_val(statbuf.u.obj.nlink, 1, "H5File::unlink", __LINE__, __FILE__); + verify_val(statbuf.nlink, 1, "H5File::unlink", __LINE__, __FILE__); // Unlink the named datatype */ fid1.unlink(TYPE1_NAME); diff --git a/hl/src/H5DS.c b/hl/src/H5DS.c index 0c8c201..c3e1dc3 100644 --- a/hl/src/H5DS.c +++ b/hl/src/H5DS.c @@ -157,7 +157,7 @@ herr_t H5DSattach_scale(hid_t did, return FAIL; /* same object, not valid */ - if (sb1.fileno==sb2.fileno && sb1.u.obj.objno==sb2.u.obj.objno) + if (!HDmemcmp(&sb1.fileno, &sb2.fileno, sizeof(sb1.fileno)) && !HDmemcmp(&sb1.objno, &sb2.objno, sizeof(sb1.objno))) return FAIL; /* get ID type */ @@ -334,7 +334,7 @@ herr_t H5DSattach_scale(hid_t did, goto out; /* same object, so this DS scale is already in this DIM IDX */ - if (sb1.fileno==sb2.fileno && sb1.u.obj.objno==sb2.u.obj.objno) + if (!HDmemcmp(&sb1.fileno, &sb2.fileno, sizeof(sb1.fileno)) && !HDmemcmp(&sb1.objno, &sb2.objno, sizeof(sb1.objno))) { found_ds = 1; } @@ -620,7 +620,7 @@ herr_t H5DSdetach_scale(hid_t did, return FAIL; /* same object, not valid */ - if (sb1.fileno==sb2.fileno && sb1.u.obj.objno==sb2.u.obj.objno) + if (!HDmemcmp(&sb1.fileno, &sb2.fileno, sizeof(sb1.fileno)) && !HDmemcmp(&sb1.objno, &sb2.objno, sizeof(sb1.objno))) return FAIL; /* get ID type */ @@ -714,7 +714,7 @@ herr_t H5DSdetach_scale(hid_t did, goto out; /* same object, reset */ - if (sb1.fileno==sb2.fileno && sb1.u.obj.objno==sb2.u.obj.objno) + if (!HDmemcmp(&sb1.fileno, &sb2.fileno, sizeof(sb1.fileno)) && !HDmemcmp(&sb1.objno, &sb2.objno, sizeof(sb1.objno))) { for(jj=j; jjoloc->file, &statbuf->fileno) < 0) + if(H5F_get_fileno((obj_loc ? obj_loc : grp_loc)->oloc->file, &statbuf->fileno[0]) < 0) HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "unable to read fileno") - /* Get common info from link */ - if(lnk != NULL) { - statbuf->cset = lnk->cset; - statbuf->ctime = lnk->ctime; - } /* end if */ - else { - /* lookup must be on '.' */ - HDassert(HDstrcmp(name, ".") == 0); - - /* Set "fake" hard link info */ - statbuf->cset = H5T_CSET_ASCII; - statbuf->ctime = 0; - } /* end else */ - /* Get info for soft link */ /* (If we don't follow the link, we can retrieve info about the soft link itself) */ if(!udata->follow_link && lnk && lnk->type == H5G_LINK_SOFT) { @@ -2308,7 +2294,7 @@ H5G_get_objinfo_cb(H5G_loc_t *grp_loc/*in*/, const char UNUSED *name, const H5O_ statbuf->type = H5G_LINK; /* Get length of link value */ - statbuf->u.slink.linklen = HDstrlen(lnk->u.soft.name) + 1; /*count the null terminator*/ + statbuf->linklen = HDstrlen(lnk->u.soft.name) + 1; /*count the null terminator*/ } /* end if */ /* Get info for hard link */ else { @@ -2318,20 +2304,25 @@ H5G_get_objinfo_cb(H5G_loc_t *grp_loc/*in*/, const char UNUSED *name, const H5O_ H5E_clear_stack(NULL); /* clear any errors resulting from checking type */ /* Get basic info for object */ - statbuf->u.obj.objno = obj_loc->oloc->addr; - statbuf->u.obj.nlink = H5O_link(obj_loc->oloc, 0, udata->dxpl_id); + statbuf->objno[0] = (unsigned long)(obj_loc->oloc->addr); +#if H5_SIZEOF_UINT64_T > H5_SIZEOF_LONG + statbuf->objno[1] = (unsigned long)(obj_loc->oloc->addr >> 8 * sizeof(long)); +#else + statbuf->objno[1] = 0; +#endif + statbuf->nlink = H5O_link(obj_loc->oloc, 0, udata->dxpl_id); /* Get creation time for object */ - if(NULL == H5O_read(obj_loc->oloc, H5O_MTIME_ID, 0, &(statbuf->u.obj.mtime), udata->dxpl_id)) { + if(NULL == H5O_read(obj_loc->oloc, H5O_MTIME_ID, 0, &(statbuf->mtime), udata->dxpl_id)) { H5E_clear_stack(NULL); - if(NULL == H5O_read(obj_loc->oloc, H5O_MTIME_NEW_ID, 0, &(statbuf->u.obj.mtime), udata->dxpl_id)) { + if(NULL == H5O_read(obj_loc->oloc, H5O_MTIME_NEW_ID, 0, &(statbuf->mtime), udata->dxpl_id)) { H5E_clear_stack(NULL); - statbuf->u.obj.mtime = 0; + statbuf->mtime = 0; } /* end if */ } /* end if */ /* Get object header information */ - if(H5O_get_info(obj_loc->oloc, &(statbuf->u.obj.ohdr), udata->dxpl_id) < 0) + if(H5O_get_info(obj_loc->oloc, &(statbuf->ohdr), udata->dxpl_id) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "unable to get object header information") } /* end else */ } /* end if */ diff --git a/src/H5Gpublic.h b/src/H5Gpublic.h index 0a264e5..361c85d 100644 --- a/src/H5Gpublic.h +++ b/src/H5Gpublic.h @@ -69,6 +69,7 @@ typedef enum H5G_obj_t { #define H5G_NUSERTYPES (H5G_NTYPES-H5G_NLIBTYPES) #define H5G_USERTYPE(X) (8+(X)) /* User defined types */ +#ifdef QAK /* Information about an object */ typedef struct H5G_obj_stat_t { haddr_t objno; /* Object number */ @@ -91,6 +92,18 @@ typedef struct H5G_stat_t { H5G_slink_stat_t slink; /* Information about symbolic links */ } u; } H5G_stat_t; +#else /* QAK */ +/* Information about an object */ +typedef struct H5G_stat_t { + unsigned long fileno[2]; /*file number */ + unsigned long objno[2]; /*object number */ + unsigned nlink; /*number of hard links to object*/ + H5G_obj_t type; /*basic object type */ + time_t mtime; /*modification time */ + size_t linklen; /*symbolic link value length */ + H5O_stat_t ohdr; /* Object header information */ +} H5G_stat_t; +#endif /* QAK */ #define H5G_SAME_LOC 0 #define H5Glink(cur_loc_id, type, cur_name, new_name) \ diff --git a/src/H5R.c b/src/H5R.c index 35f1313..0e06384 100644 --- a/src/H5R.c +++ b/src/H5R.c @@ -137,7 +137,10 @@ H5R_term_interface(void) static herr_t H5R_create(void *_ref, H5G_loc_t *loc, const char *name, H5R_type_t ref_type, H5S_t *space, hid_t dxpl_id) { - H5G_stat_t sb; /* Stat buffer for retrieving OID */ + H5G_loc_t obj_loc; /* Group hier. location of object */ + H5G_name_t path; /* Object group hier. path */ + H5O_loc_t oloc; /* Object object location */ + hbool_t obj_found = FALSE; /* Object location found */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT(H5R_create) @@ -147,15 +150,22 @@ H5R_create(void *_ref, H5G_loc_t *loc, const char *name, H5R_type_t ref_type, H5 HDassert(name); HDassert(ref_type > H5R_BADTYPE || ref_type < H5R_MAXTYPE); - if(H5G_get_objinfo(loc, name, 0, &sb, dxpl_id) < 0) - HGOTO_ERROR(H5E_REFERENCE, H5E_NOTFOUND, FAIL, "unable to stat object") + /* Set up object location to fill in */ + obj_loc.oloc = &oloc; + obj_loc.path = &path; + H5G_loc_reset(&obj_loc); + + /* Find the object */ + if(H5G_loc_find(loc, name, &obj_loc, dxpl_id) < 0) + HGOTO_ERROR(H5E_REFERENCE, H5E_NOTFOUND, FAIL, "object not found") + obj_found = TRUE; switch(ref_type) { case H5R_OBJECT: { hobj_ref_t *ref = (hobj_ref_t *)_ref; /* Get pointer to correct type of reference struct */ - *ref=sb.u.obj.objno; + *ref = obj_loc.oloc->addr; break; } @@ -202,7 +212,7 @@ H5R_create(void *_ref, H5G_loc_t *loc, const char *name, H5R_type_t ref_type, H5 /* Serialize information for dataset OID */ p = (uint8_t *)buf; - H5F_addr_encode(loc->oloc->file, &p, sb.u.obj.objno); + H5F_addr_encode(loc->oloc->file, &p, obj_loc.oloc->addr); /* Serialize the selection */ if(H5S_SELECT_SERIALIZE(space, p) < 0) @@ -234,6 +244,9 @@ H5R_create(void *_ref, H5G_loc_t *loc, const char *name, H5R_type_t ref_type, H5 } /* end switch */ done: + if(obj_found) + H5G_loc_free(&obj_loc); + FUNC_LEAVE_NOAPI(ret_value) } /* end H5R_create() */ diff --git a/test/links.c b/test/links.c index 96ebbf4..3c47463 100644 --- a/test/links.c +++ b/test/links.c @@ -244,7 +244,7 @@ cklinks(hid_t fapl) printf(" %d: Unexpected object type should have been a dataset\n", __LINE__); goto error; } - if (sb1.u.obj.objno!=sb2.u.obj.objno) { + if (HDmemcmp(&sb1.objno, &sb2.objno, sizeof(sb1.objno))) { H5_FAILED(); puts(" Hard link test failed. Link seems not to point to the "); puts(" expected file location."); @@ -258,7 +258,7 @@ cklinks(hid_t fapl) printf(" %d: Unexpected object type should have been a dataset\n", __LINE__); goto error; } - if (sb1.u.obj.objno!=sb2.u.obj.objno) { + if (HDmemcmp(&sb1.objno, &sb2.objno, sizeof(sb1.objno))) { H5_FAILED(); puts(" Soft link test failed. Link seems not to point to the "); puts(" expected file location."); @@ -376,7 +376,7 @@ ck_new_links(hid_t fapl) printf(" %d: Unexpected object type should have been a dataset\n", __LINE__); goto error; } - if( sb_dset.u.obj.objno!=sb_hard1.u.obj.objno || sb_dset.u.obj.objno!=sb_hard2.u.obj.objno ) { + if(HDmemcmp(&sb_dset.objno, &sb_hard1.objno, sizeof(sb_dset.objno)) || HDmemcmp(&sb_dset.objno, &sb_hard2.objno, sizeof(sb_dset.objno))) { H5_FAILED(); puts(" Hard link test failed. Link seems not to point to the "); puts(" expected file location."); @@ -394,7 +394,7 @@ ck_new_links(hid_t fapl) TEST_ERROR; } - if( sb_dset.u.obj.objno!=sb_soft1.u.obj.objno || sb_dset.u.obj.objno!=sb_soft2.u.obj.objno ) { + if(HDmemcmp(&sb_dset.objno, &sb_soft1.objno, sizeof(sb_dset.objno)) || HDmemcmp(&sb_dset.objno, &sb_soft2.objno, sizeof(sb_dset.objno))) { H5_FAILED(); puts(" Soft link test failed. Link seems not to point to the "); puts(" expected file location."); diff --git a/test/mount.c b/test/mount.c index d997bd9..0f748a8 100644 --- a/test/mount.c +++ b/test/mount.c @@ -293,7 +293,7 @@ test_hide(hid_t fapl) * other names. This is a rather stupid test but demonstrates a point. */ if (H5Gget_objinfo(file1, "/file1", TRUE, &sb2)<0) goto error; - if (sb1.fileno!=sb2.fileno || sb1.u.obj.objno!=sb2.u.obj.objno) { + if (HDmemcmp(&sb1.fileno, &sb2.fileno, sizeof(sb1.fileno)) || HDmemcmp(&sb1.objno, &sb2.objno, sizeof(sb1.objno))) { H5_FAILED(); puts(" Hard link failed for hidden object."); goto error; @@ -363,7 +363,7 @@ test_assoc(hid_t fapl) */ if(H5Gget_objinfo(file1, "/mnt1", TRUE, &sb2) < 0) TEST_ERROR - if(sb1.fileno != sb2.fileno || sb1.u.obj.objno != sb2.u.obj.objno) { + if(HDmemcmp(&sb1.fileno, &sb2.fileno, sizeof(sb1.fileno)) || HDmemcmp(&sb1.objno, &sb2.objno, sizeof(sb1.objno))) { H5_FAILED(); puts(" Association failed."); AT(); diff --git a/test/mtime.c b/test/mtime.c index 963ccb7..da2fe63 100644 --- a/test/mtime.c +++ b/test/mtime.c @@ -97,7 +97,7 @@ main(void) if (H5Fclose(file)<0) TEST_ERROR; /* Compare times from the two ways of calling H5Gget_objinfo() */ - if (sb1.u.obj.objno!=sb2.u.obj.objno || sb1.u.obj.mtime!=sb2.u.obj.mtime) { + if (HDmemcmp(&sb1.objno, &sb2.objno, sizeof(sb1.objno)) || sb1.mtime!=sb2.mtime) { H5_FAILED(); puts(" Calling H5Gget_objinfo() with the dataset ID returned"); puts(" different values than calling it with a file and dataset"); @@ -106,15 +106,15 @@ main(void) } /* Compare times -- they must be within 60 seconds of one another */ - if (0==sb1.u.obj.mtime) { + if (0==sb1.mtime) { SKIPPED(); puts(" The modification time could not be decoded on this OS."); puts(" Modification times will be mantained in the file but"); puts(" cannot be queried on this system. See H5O_mtime_decode()."); return 0; - } else if (fabs(HDdifftime(now, sb1.u.obj.mtime))>60.0) { + } else if (fabs(HDdifftime(now, sb1.mtime))>60.0) { H5_FAILED(); - tm = localtime(&(sb1.u.obj.mtime)); + tm = localtime(&(sb1.mtime)); strftime((char*)buf1, sizeof buf1, "%Y-%m-%d %H:%M:%S", tm); tm = localtime(&now); strftime((char*)buf2, sizeof buf2, "%Y-%m-%d %H:%M:%S", tm); @@ -140,7 +140,7 @@ main(void) if (file >= 0){ if(H5Gget_objinfo(file, "/Dataset1", TRUE, &sb1)<0) TEST_ERROR; - if(sb1.u.obj.mtime!=MTIME1) { + if(sb1.mtime!=MTIME1) { H5_FAILED(); /* If this fails, examine H5Omtime.c. Modification time is very * system dependant (e.g., on Windows DST must be hardcoded). */ @@ -175,7 +175,7 @@ main(void) if (file >= 0){ if(H5Gget_objinfo(file, "/Dataset1", TRUE, &sb2)<0) TEST_ERROR; - if(sb2.u.obj.mtime!=MTIME2) { + if(sb2.mtime!=MTIME2) { H5_FAILED(); puts(" Modification time incorrect."); goto error; diff --git a/test/objcopy.c b/test/objcopy.c index b19e5dd..9d77f57 100755 --- a/test/objcopy.c +++ b/test/objcopy.c @@ -108,7 +108,7 @@ addr_insert(H5G_stat_t *sb) /* Don't add it if the link count is 1 because such an object can only * be encountered once. */ - if(sb->u.obj.nlink < 2) + if(sb->nlink < 2) return; /* Extend the table */ @@ -119,7 +119,7 @@ addr_insert(H5G_stat_t *sb) /* Insert the entry */ n = idtab_g.nobjs++; - idtab_g.obj[n] = sb->u.obj.objno; + idtab_g.obj[n] = (haddr_t)sb->objno[0] | ((haddr_t)sb->objno[1] << (8 * sizeof(long))); } /* end addr_insert() */ @@ -140,12 +140,14 @@ addr_insert(H5G_stat_t *sb) static hbool_t addr_lookup(H5G_stat_t *sb) { + haddr_t obj_addr; /* Object's address in the file */ size_t n; - if (sb->u.obj.nlink<2) return FALSE; /*only one link possible*/ + if (sb->nlink<2) return FALSE; /*only one link possible*/ + obj_addr = (haddr_t)sb->objno[0] | ((haddr_t)sb->objno[1] << (8 * sizeof(long))); for(n = 0; n < idtab_g.nobjs; n++) - if(idtab_g.obj[n] == sb->u.obj.objno) + if(idtab_g.obj[n] == obj_addr) return TRUE; return FALSE; } /* end addr_lookup() */ @@ -804,9 +806,9 @@ compare_groups(hid_t gid, hid_t gid2) if(H5Gget_objinfo(gid2, objname2, FALSE, &objstat2) < 0) TEST_ERROR; if(objstat.type != objstat2.type) TEST_ERROR; if(objstat.type != H5G_LINK) { - if(objstat.u.obj.nlink != objstat2.u.obj.nlink) TEST_ERROR; - if(objstat.u.obj.ohdr.nmesgs != objstat2.u.obj.ohdr.nmesgs) TEST_ERROR; - if(objstat.u.obj.ohdr.nchunks != objstat2.u.obj.ohdr.nchunks) TEST_ERROR; + if(objstat.nlink != objstat2.nlink) TEST_ERROR; + if(objstat.ohdr.nmesgs != objstat2.ohdr.nmesgs) TEST_ERROR; + if(objstat.ohdr.nchunks != objstat2.ohdr.nchunks) TEST_ERROR; } /* end if */ /* Check for object already having been compared */ diff --git a/test/stab.c b/test/stab.c index 4cf73d9..09a5438 100644 --- a/test/stab.c +++ b/test/stab.c @@ -380,13 +380,13 @@ lifecycle(hid_t fapl) /* Check that the object header is only one chunk and the space has been allocated correctly */ if(H5Gget_objinfo(gid, ".", FALSE, &obj_stat) < 0) TEST_ERROR; #ifdef H5_HAVE_LARGE_HSIZET - if(obj_stat.u.obj.ohdr.size != 232) TEST_ERROR; + if(obj_stat.ohdr.size != 232) TEST_ERROR; #else /* H5_HAVE_LARGE_HSIZET */ - if(obj_stat.u.obj.ohdr.size != 224) TEST_ERROR; + if(obj_stat.ohdr.size != 224) TEST_ERROR; #endif /* H5_HAVE_LARGE_HSIZET */ - if(obj_stat.u.obj.ohdr.free != 0) TEST_ERROR; - if(obj_stat.u.obj.ohdr.nmesgs != 6) TEST_ERROR; - if(obj_stat.u.obj.ohdr.nchunks != 1) TEST_ERROR; + if(obj_stat.ohdr.free != 0) TEST_ERROR; + if(obj_stat.ohdr.nmesgs != 6) TEST_ERROR; + if(obj_stat.ohdr.nchunks != 1) TEST_ERROR; /* Create one more "bottom" group, which should push top group into using a symbol table */ sprintf(objname, LIFECYCLE_BOTTOM_GROUP, u); @@ -408,13 +408,13 @@ lifecycle(hid_t fapl) /* Check that the object header is still one chunk and the space has been allocated correctly */ if(H5Gget_objinfo(gid, ".", FALSE, &obj_stat) < 0) TEST_ERROR; #ifdef H5_HAVE_LARGE_HSIZET - if(obj_stat.u.obj.ohdr.size != 232) TEST_ERROR; + if(obj_stat.ohdr.size != 232) TEST_ERROR; #else /* H5_HAVE_LARGE_HSIZET */ - if(obj_stat.u.obj.ohdr.size != 224) TEST_ERROR; + if(obj_stat.ohdr.size != 224) TEST_ERROR; #endif /* H5_HAVE_LARGE_HSIZET */ - if(obj_stat.u.obj.ohdr.free != 136) TEST_ERROR; - if(obj_stat.u.obj.ohdr.nmesgs != 4) TEST_ERROR; - if(obj_stat.u.obj.ohdr.nchunks != 1) TEST_ERROR; + if(obj_stat.ohdr.free != 136) TEST_ERROR; + if(obj_stat.ohdr.nmesgs != 4) TEST_ERROR; + if(obj_stat.ohdr.nchunks != 1) TEST_ERROR; /* Unlink objects from top group */ while(u >= LIFECYCLE_MIN_DENSE) { diff --git a/test/tattr.c b/test/tattr.c index d7b0e58..5bb9947 100644 --- a/test/tattr.c +++ b/test/tattr.c @@ -1547,7 +1547,7 @@ test_attr_dtype_shared(void) /* Check reference count on named datatype */ ret=H5Gget_objinfo(file_id,TYPE1_NAME,0,&statbuf); CHECK(ret, FAIL, "H5Gget_objinfo"); - VERIFY(statbuf.u.obj.nlink, 1, "H5Tcommit"); + VERIFY(statbuf.nlink, 1, "H5Tcommit"); /* Create dataspace for dataset */ space_id=H5Screate(H5S_SCALAR); @@ -1560,7 +1560,7 @@ test_attr_dtype_shared(void) /* Check reference count on named datatype */ ret=H5Gget_objinfo(file_id,TYPE1_NAME,0,&statbuf); CHECK(ret, FAIL, "H5Gget_objinfo"); - VERIFY(statbuf.u.obj.nlink, 2, "H5Dcreate"); + VERIFY(statbuf.nlink, 2, "H5Dcreate"); /* Create attribute on dataset */ attr_id=H5Acreate(dset_id,ATTR1_NAME,type_id,space_id,H5P_DEFAULT); @@ -1569,7 +1569,7 @@ test_attr_dtype_shared(void) /* Check reference count on named datatype */ ret=H5Gget_objinfo(file_id,TYPE1_NAME,0,&statbuf); CHECK(ret, FAIL, "H5Gget_objinfo"); - VERIFY(statbuf.u.obj.nlink, 3, "H5Acreate"); + VERIFY(statbuf.nlink, 3, "H5Acreate"); /* Close attribute */ ret=H5Aclose(attr_id); @@ -1582,7 +1582,7 @@ test_attr_dtype_shared(void) /* Check reference count on named datatype */ ret=H5Gget_objinfo(file_id,TYPE1_NAME,0,&statbuf); CHECK(ret, FAIL, "H5Gget_objinfo"); - VERIFY(statbuf.u.obj.nlink, 2, "H5Adelete"); + VERIFY(statbuf.nlink, 2, "H5Adelete"); /* Create attribute on dataset */ attr_id=H5Acreate(dset_id,ATTR1_NAME,type_id,space_id,H5P_DEFAULT); @@ -1591,7 +1591,7 @@ test_attr_dtype_shared(void) /* Check reference count on named datatype */ ret=H5Gget_objinfo(file_id,TYPE1_NAME,0,&statbuf); CHECK(ret, FAIL, "H5Gget_objinfo"); - VERIFY(statbuf.u.obj.nlink, 3, "H5Acreate"); + VERIFY(statbuf.nlink, 3, "H5Acreate"); /* Write data into the attribute */ ret=H5Awrite(attr_id,H5T_NATIVE_INT,&data); @@ -1645,7 +1645,7 @@ test_attr_dtype_shared(void) /* Check reference count on named datatype */ ret=H5Gget_objinfo(file_id,TYPE1_NAME,0,&statbuf); CHECK(ret, FAIL, "H5Gget_objinfo"); - VERIFY(statbuf.u.obj.nlink, 3, "H5Aopen_name"); + VERIFY(statbuf.nlink, 3, "H5Aopen_name"); /* Unlink the dataset */ ret=H5Gunlink(file_id,DSET1_NAME); @@ -1654,7 +1654,7 @@ test_attr_dtype_shared(void) /* Check reference count on named datatype */ ret=H5Gget_objinfo(file_id,TYPE1_NAME,0,&statbuf); CHECK(ret, FAIL, "H5Gget_objinfo"); - VERIFY(statbuf.u.obj.nlink, 1, "H5Gunlink"); + VERIFY(statbuf.nlink, 1, "H5Gunlink"); /* Unlink the named datatype */ ret=H5Gunlink(file_id,TYPE1_NAME); diff --git a/test/tmisc.c b/test/tmisc.c index 90e20d2..c114048 100644 --- a/test/tmisc.c +++ b/test/tmisc.c @@ -623,12 +623,12 @@ test_misc4(void) CHECK(ret, FAIL, "H5Gget_objinfo"); /* Verify that the fileno values are the same for groups from file1 */ - VERIFY(stat1.fileno,stat2.fileno,"H5Gget_objinfo"); + VERIFY(stat1.fileno[0],stat2.fileno[0],"H5Gget_objinfo"); /* Verify that the fileno values are not the same between file1 & file2 */ - if(stat1.fileno==stat3.fileno) + if(stat1.fileno[0]==stat3.fileno[0]) TestErrPrintf("Error on line %d: stat1.fileno==stat3.fileno\n",__LINE__); - if(stat2.fileno==stat3.fileno) + if(stat2.fileno[0]==stat3.fileno[0]) TestErrPrintf("Error on line %d: stat1.fileno==stat3.fileno\n",__LINE__); /* Close the objects */ @@ -2827,13 +2827,13 @@ test_misc18(void) /* Get object information */ ret = H5Gget_objinfo(fid,MISC18_DSET1_NAME,0,&statbuf); CHECK(ret, FAIL, "H5Gget_objinfo"); - VERIFY(statbuf.u.obj.ohdr.nmesgs, 6, "H5Gget_objinfo"); - VERIFY(statbuf.u.obj.ohdr.nchunks, 1, "H5Gget_objinfo"); - VERIFY(statbuf.u.obj.ohdr.size, 272, "H5Gget_objinfo"); + VERIFY(statbuf.ohdr.nmesgs, 6, "H5Gget_objinfo"); + VERIFY(statbuf.ohdr.nchunks, 1, "H5Gget_objinfo"); + VERIFY(statbuf.ohdr.size, 272, "H5Gget_objinfo"); #ifdef H5_HAVE_LARGE_HSIZET - VERIFY(statbuf.u.obj.ohdr.free, 152, "H5Gget_objinfo"); + VERIFY(statbuf.ohdr.free, 152, "H5Gget_objinfo"); #else /* H5_HAVE_LARGE_HSIZET */ - VERIFY(statbuf.u.obj.ohdr.free, 160, "H5Gget_objinfo"); + VERIFY(statbuf.ohdr.free, 160, "H5Gget_objinfo"); #endif /* H5_HAVE_LARGE_HSIZET */ /* Create second dataset */ @@ -2843,13 +2843,13 @@ test_misc18(void) /* Get object information */ ret = H5Gget_objinfo(fid,MISC18_DSET2_NAME,0,&statbuf); CHECK(ret, FAIL, "H5Gget_objinfo"); - VERIFY(statbuf.u.obj.ohdr.nmesgs, 6, "H5Gget_objinfo"); - VERIFY(statbuf.u.obj.ohdr.nchunks, 1, "H5Gget_objinfo"); - VERIFY(statbuf.u.obj.ohdr.size, 272, "H5Gget_objinfo"); + VERIFY(statbuf.ohdr.nmesgs, 6, "H5Gget_objinfo"); + VERIFY(statbuf.ohdr.nchunks, 1, "H5Gget_objinfo"); + VERIFY(statbuf.ohdr.size, 272, "H5Gget_objinfo"); #ifdef H5_HAVE_LARGE_HSIZET - VERIFY(statbuf.u.obj.ohdr.free, 152, "H5Gget_objinfo"); + VERIFY(statbuf.ohdr.free, 152, "H5Gget_objinfo"); #else /* H5_HAVE_LARGE_HSIZET */ - VERIFY(statbuf.u.obj.ohdr.free, 160, "H5Gget_objinfo"); + VERIFY(statbuf.ohdr.free, 160, "H5Gget_objinfo"); #endif /* H5_HAVE_LARGE_HSIZET */ /* Loop creating attributes on each dataset, flushing them to the file each time */ @@ -2880,30 +2880,30 @@ test_misc18(void) ret = H5Gget_objinfo(fid,MISC18_DSET1_NAME,0,&statbuf); CHECK(ret, FAIL, "H5Gget_objinfo"); #ifdef H5_HAVE_LARGE_HSIZET - VERIFY(statbuf.u.obj.ohdr.nmesgs, 28, "H5Gget_objinfo"); - VERIFY(statbuf.u.obj.ohdr.nchunks, 9, "H5Gget_objinfo"); - VERIFY(statbuf.u.obj.ohdr.size, 944, "H5Gget_objinfo"); - VERIFY(statbuf.u.obj.ohdr.free, 72, "H5Gget_objinfo"); + VERIFY(statbuf.ohdr.nmesgs, 28, "H5Gget_objinfo"); + VERIFY(statbuf.ohdr.nchunks, 9, "H5Gget_objinfo"); + VERIFY(statbuf.ohdr.size, 944, "H5Gget_objinfo"); + VERIFY(statbuf.ohdr.free, 72, "H5Gget_objinfo"); #else /* H5_HAVE_LARGE_HSIZET */ - VERIFY(statbuf.u.obj.ohdr.nmesgs, 26, "H5Gget_objinfo"); - VERIFY(statbuf.u.obj.ohdr.nchunks, 9, "H5Gget_objinfo"); - VERIFY(statbuf.u.obj.ohdr.size, 888, "H5Gget_objinfo"); - VERIFY(statbuf.u.obj.ohdr.free, 24, "H5Gget_objinfo"); + VERIFY(statbuf.ohdr.nmesgs, 26, "H5Gget_objinfo"); + VERIFY(statbuf.ohdr.nchunks, 9, "H5Gget_objinfo"); + VERIFY(statbuf.ohdr.size, 888, "H5Gget_objinfo"); + VERIFY(statbuf.ohdr.free, 24, "H5Gget_objinfo"); #endif /* H5_HAVE_LARGE_HSIZET */ /* Get object information for dataset #2 now */ ret = H5Gget_objinfo(fid,MISC18_DSET2_NAME,0,&statbuf); CHECK(ret, FAIL, "H5Gget_objinfo"); #ifdef H5_HAVE_LARGE_HSIZET - VERIFY(statbuf.u.obj.ohdr.nmesgs, 28, "H5Gget_objinfo"); - VERIFY(statbuf.u.obj.ohdr.nchunks, 9, "H5Gget_objinfo"); - VERIFY(statbuf.u.obj.ohdr.size, 944, "H5Gget_objinfo"); - VERIFY(statbuf.u.obj.ohdr.free, 72, "H5Gget_objinfo"); + VERIFY(statbuf.ohdr.nmesgs, 28, "H5Gget_objinfo"); + VERIFY(statbuf.ohdr.nchunks, 9, "H5Gget_objinfo"); + VERIFY(statbuf.ohdr.size, 944, "H5Gget_objinfo"); + VERIFY(statbuf.ohdr.free, 72, "H5Gget_objinfo"); #else /* H5_HAVE_LARGE_HSIZET */ - VERIFY(statbuf.u.obj.ohdr.nmesgs, 26, "H5Gget_objinfo"); - VERIFY(statbuf.u.obj.ohdr.nchunks, 9, "H5Gget_objinfo"); - VERIFY(statbuf.u.obj.ohdr.size, 888, "H5Gget_objinfo"); - VERIFY(statbuf.u.obj.ohdr.free, 24, "H5Gget_objinfo"); + VERIFY(statbuf.ohdr.nmesgs, 26, "H5Gget_objinfo"); + VERIFY(statbuf.ohdr.nchunks, 9, "H5Gget_objinfo"); + VERIFY(statbuf.ohdr.size, 888, "H5Gget_objinfo"); + VERIFY(statbuf.ohdr.free, 24, "H5Gget_objinfo"); #endif /* H5_HAVE_LARGE_HSIZET */ /* Close second dataset */ @@ -3843,7 +3843,7 @@ test_misc23(void) status = H5Gget_objinfo(tmp_id, ".", FALSE, &sb); CHECK(status, FAIL, "H5Gget_objinfo"); - VERIFY(sb.u.obj.nlink,1,"H5Gget_objinfo"); + VERIFY(sb.nlink,1,"H5Gget_objinfo"); status = H5Gclose(tmp_id); CHECK(status, FAIL, "H5Gclose"); diff --git a/test/unlink.c b/test/unlink.c index 5555dab..ee938d9 100644 --- a/test/unlink.c +++ b/test/unlink.c @@ -462,7 +462,7 @@ check_new_move(void) puts(" Unexpected object type, should have been a group"); goto error; } - if( sb_hard1.u.obj.objno!=sb_hard2.u.obj.objno) { + if (HDmemcmp(&sb_hard1.objno, &sb_hard2.objno, sizeof(sb_hard1.objno))) { H5_FAILED(); puts(" Hard link test failed. Link seems not to point to the "); puts(" expected file location."); diff --git a/tools/h5dump/h5dump.c b/tools/h5dump/h5dump.c index 029990e..2a6b33a 100644 --- a/tools/h5dump/h5dump.c +++ b/tools/h5dump/h5dump.c @@ -673,7 +673,6 @@ print_datatype(hid_t type,unsigned in_group) hsize_t dims[H5DUMP_MAX_RANK]; H5T_str_t str_pad; H5T_cset_t cset; - H5G_stat_t statbuf; H5T_order_t order; hid_t super; hid_t tmp_type; @@ -683,10 +682,13 @@ print_datatype(hid_t type,unsigned in_group) const char *sign_s=NULL; /* sign scheme string */ if (!in_group && H5Tcommitted(type) > 0) { + H5G_stat_t statbuf; + haddr_t objno; /* Compact form of object's location */ obj_t *obj; /* Found object */ H5Gget_objinfo(type, ".", TRUE, &statbuf); - obj = search_obj(type_table, statbuf.u.obj.objno); + objno = (haddr_t)statbuf.objno[0] | ((haddr_t)statbuf.objno[1] << (8 * sizeof(long))); + obj = search_obj(type_table, objno); if (obj) { if (!obj->recorded) @@ -1420,7 +1422,7 @@ dump_all(hid_t group, const char *name, void * op_data) char *targbuf; indentation(indent); - targbuf = HDmalloc(statbuf.u.slink.linklen); + targbuf = HDmalloc(statbuf.linklen); HDassert(targbuf); if (!doxml) { @@ -1429,7 +1431,7 @@ dump_all(hid_t group, const char *name, void * op_data) indentation(indent + COL); } - if (H5Gget_linkval(group, name, statbuf.u.slink.linklen, targbuf) < 0) { + if (H5Gget_linkval(group, name, statbuf.linklen, targbuf) < 0) { error_msg(progname, "unable to get link value\n"); d_status = EXIT_FAILURE; ret = FAIL; @@ -1450,7 +1452,7 @@ dump_all(hid_t group, const char *name, void * op_data) char *t_link_path; int res; - t_link_path = HDmalloc(HDstrlen(prefix) + statbuf.u.slink.linklen + 1); + t_link_path = HDmalloc(HDstrlen(prefix) + statbuf.linklen + 1); if(targbuf[0] == '/') HDstrcpy(t_link_path, targbuf); else { @@ -1543,13 +1545,16 @@ dump_all(hid_t group, const char *name, void * op_data) case H5G_DATASET: if ((obj = H5Dopen(group, name)) >= 0) { + haddr_t objno; /* Compact form of object's location */ + /* hard link */ H5Gget_objinfo(obj, ".", TRUE, &statbuf); + objno = (haddr_t)statbuf.objno[0] | ((haddr_t)statbuf.objno[1] << (8 * sizeof(long))); - if (statbuf.u.obj.nlink > 1) { + if (statbuf.nlink > 1) { obj_t *found_obj; /* Found object */ - found_obj = search_obj(dset_table, statbuf.u.obj.objno); + found_obj = search_obj(dset_table, objno); if (found_obj == NULL) { indentation(indent); @@ -1709,6 +1714,7 @@ static void dump_group(hid_t gid, const char *name) { H5G_stat_t statbuf; + haddr_t objno; /* Compact form of object's location */ hid_t dset, type; char type_name[1024], *tmp; int xtype = H5G_UNKNOWN; /* dump all */ @@ -1741,11 +1747,12 @@ dump_group(hid_t gid, const char *name) } /* end if */ H5Gget_objinfo(gid, ".", TRUE, &statbuf); + objno = (haddr_t)statbuf.objno[0] | ((haddr_t)statbuf.objno[1] << (8 * sizeof(long))); - if (statbuf.u.obj.nlink > 1) { + if (statbuf.nlink > 1) { obj_t *found_obj; /* Found object */ - found_obj = search_obj(group_table, statbuf.u.obj.objno); + found_obj = search_obj(group_table, objno); if (found_obj == NULL) { indentation(indent); @@ -2838,6 +2845,7 @@ static void handle_datasets(hid_t fid, char *dset, void *data) { H5G_stat_t statbuf; + haddr_t objno; /* Compact form of object's location */ hid_t dsetid; struct subset_t *sset = (struct subset_t *)data; @@ -2904,11 +2912,12 @@ handle_datasets(hid_t fid, char *dset, void *data) } H5Gget_objinfo(dsetid, ".", TRUE, &statbuf); + objno = (haddr_t)statbuf.objno[0] | ((haddr_t)statbuf.objno[1] << (8 * sizeof(long))); - if (statbuf.u.obj.nlink > 1) { + if (statbuf.nlink > 1) { obj_t *found_obj; /* Found object */ - found_obj = search_obj(dset_table, statbuf.u.obj.objno); + found_obj = search_obj(dset_table, objno); if (found_obj) { if (found_obj->displayed) { @@ -2951,7 +2960,6 @@ handle_datasets(hid_t fid, char *dset, void *data) static void handle_groups(hid_t fid, char *group, void UNUSED * data) { - H5G_stat_t statbuf; hid_t gid; if ((gid = H5Gopen(fid, group)) < 0) { @@ -2970,7 +2978,6 @@ handle_groups(hid_t fid, char *group, void UNUSED * data) prefix = HDrealloc(prefix, prefix_len); } - H5Gget_objinfo(gid, ".", TRUE, &statbuf); HDstrcpy(prefix, group); dump_group(gid, group); @@ -3002,13 +3009,13 @@ handle_links(hid_t fid, char *links, void UNUSED * data) error_msg(progname, "unable to get obj info from \"%s\"\n", links); d_status = EXIT_FAILURE; } else if (statbuf.type == H5G_LINK) { - char *buf = HDmalloc(statbuf.u.slink.linklen); + char *buf = HDmalloc(statbuf.linklen); begin_obj(dump_header_format->softlinkbegin, links, dump_header_format->softlinkblockbegin); indentation(COL); - if (H5Gget_linkval(fid, links, statbuf.u.slink.linklen, buf) >= 0) { + if (H5Gget_linkval(fid, links, statbuf.linklen, buf) >= 0) { printf("LINKTARGET \"%s\"\n", buf); } else { error_msg(progname, "h5dump error: unable to get link value for \"%s\"\n", @@ -4001,7 +4008,6 @@ xml_print_datatype(hid_t type, unsigned in_group) hsize_t dims[H5DUMP_MAX_RANK]; H5T_str_t str_pad; H5T_cset_t cset; - H5G_stat_t statbuf; hid_t super; H5T_order_t ord; H5T_sign_t sgn; @@ -4015,11 +4021,14 @@ xml_print_datatype(hid_t type, unsigned in_group) htri_t is_vlstr=FALSE; if (!in_group && H5Tcommitted(type) > 0) { + H5G_stat_t statbuf; + haddr_t objno; /* Compact form of object's location */ obj_t *found_obj; /* Found object */ /* detect a shared datatype, output only once */ H5Gget_objinfo(type, ".", TRUE, &statbuf); - found_obj = search_obj(type_table, statbuf.u.obj.objno); + objno = (haddr_t)statbuf.objno[0] | ((haddr_t)statbuf.objno[1] << (8 * sizeof(long))); + found_obj = search_obj(type_table, objno); if (found_obj) { /* This should be defined somewhere else */ @@ -4378,17 +4387,19 @@ xml_print_datatype(hid_t type, unsigned in_group) static void xml_dump_datatype(hid_t type) { - H5G_stat_t statbuf; indent += COL; indentation(indent); if (H5Tcommitted(type) > 0) { + H5G_stat_t statbuf; + haddr_t objno; /* Compact form of object's location */ obj_t *found_obj; /* Found object */ /* Data type is a shared or named data type */ H5Gget_objinfo(type, ".", TRUE, &statbuf); - found_obj = search_obj(type_table, statbuf.u.obj.objno); + objno = (haddr_t)statbuf.objno[0] | ((haddr_t)statbuf.objno[1] << (8 * sizeof(long))); + found_obj = search_obj(type_table, objno); if (found_obj) { /* Shared data type, must be entered as an object */ @@ -4833,6 +4844,7 @@ static void xml_dump_group(hid_t gid, const char *name) { H5G_stat_t statbuf; + haddr_t objno; /* Compact form of object's location */ char *cp; hid_t dset, type; char type_name[1024], *tmp = NULL; @@ -4865,12 +4877,13 @@ xml_dump_group(hid_t gid, const char *name) indent += COL; H5Gget_objinfo(gid, ".", TRUE, &statbuf); + objno = (haddr_t)statbuf.objno[0] | ((haddr_t)statbuf.objno[1] << (8 * sizeof(long))); - if (statbuf.u.obj.nlink > 1) { + if (statbuf.nlink > 1) { obj_t *found_obj; /* Found object */ /* Group with more than one link to it... */ - found_obj = search_obj(group_table, statbuf.u.obj.objno); + found_obj = search_obj(group_table, objno); if (found_obj == NULL) { indentation(indent); diff --git a/tools/h5ls/h5ls.c b/tools/h5ls/h5ls.c index 792db23..a6a7e95 100644 --- a/tools/h5ls/h5ls.c +++ b/tools/h5ls/h5ls.c @@ -145,11 +145,12 @@ usage: %s [OPTIONS] [OBJECTS...]\n\ static void sym_insert(H5G_stat_t *sb, const char *name) { + haddr_t objno; /* Compact form of object's location */ int n; /* Don't add it if the link count is 1 because such an object can only * have one name. */ - if (sb->u.obj.nlink<2) return; + if (sb->nlink<2) return; /* Extend the table */ if (idtab_g.nobjs>=idtab_g.nalloc) { @@ -160,7 +161,8 @@ sym_insert(H5G_stat_t *sb, const char *name) /* Insert the entry */ n = idtab_g.nobjs++; - idtab_g.obj[n].id = sb->u.obj.objno; + objno = (haddr_t)sb->objno[0] | ((haddr_t)sb->objno[1] << (8 * sizeof(long))); + idtab_g.obj[n].id = objno; idtab_g.obj[n].name = HDstrdup(name); } @@ -184,11 +186,13 @@ sym_insert(H5G_stat_t *sb, const char *name) static char * sym_lookup(H5G_stat_t *sb) { + haddr_t objno; /* Compact form of object's location */ int n; - if (sb->u.obj.nlink<2) return NULL; /*only one name possible*/ + if (sb->nlink<2) return NULL; /*only one name possible*/ + objno = (haddr_t)sb->objno[0] | ((haddr_t)sb->objno[1] << (8 * sizeof(long))); for (n=0; nu.obj.objno) + if(idtab_g.obj[n].id == objno) return idtab_g.obj[n].name; } return NULL; @@ -1164,44 +1168,45 @@ static void display_type(hid_t type, int ind) { H5T_class_t data_class = H5Tget_class(type); - H5G_stat_t sb; /* Bad data type */ if (type<0) { - printf(""); - return; + printf(""); + return; } /* Shared? If so then print the type's OID */ if (H5Tcommitted(type)) { - if (H5Gget_objinfo(type, ".", FALSE, &sb)>=0) { - printf("shared-%lu:"H5_PRINTF_HADDR_FMT" ", - sb.fileno, sb.u.obj.objno); - } else { - printf("shared "); - } + H5G_stat_t sb; + + if (H5Gget_objinfo(type, ".", FALSE, &sb)>=0) { + haddr_t objno; /* Compact form of object's location */ + + objno = (haddr_t)sb.objno[0] | ((haddr_t)sb.objno[1] << (8 * sizeof(long))); + printf("shared-%lu:"H5_PRINTF_HADDR_FMT" ", + sb.fileno[0], objno); + } else + printf("shared "); } /* Print the type */ if ((!simple_output_g && display_native_type(type, ind)) || - display_ieee_type(type, ind) || - display_int_type(type, ind) || - display_float_type(type, ind) || - display_cmpd_type(type, ind) || - display_enum_type(type, ind) || - display_string_type(type, ind) || - display_reference_type(type, ind) || - display_vlen_type(type, ind) || - display_array_type(type, ind) || - display_opaque_type(type, ind) || - display_bitfield_type(type, ind)) { - return; - } + display_ieee_type(type, ind) || + display_int_type(type, ind) || + display_float_type(type, ind) || + display_cmpd_type(type, ind) || + display_enum_type(type, ind) || + display_string_type(type, ind) || + display_reference_type(type, ind) || + display_vlen_type(type, ind) || + display_array_type(type, ind) || + display_opaque_type(type, ind) || + display_bitfield_type(type, ind)) + return; /* Unknown type */ printf("%lu-byte class-%u unknown", - (unsigned long)H5Tget_size(type), - (unsigned)data_class); + (unsigned long)H5Tget_size(type), (unsigned)data_class); } @@ -1763,6 +1768,7 @@ list (hid_t group, const char *name, void *_iter) hid_t obj=-1; char buf[512], comment[50], *fullname=NULL, *s=NULL; H5G_stat_t sb; + haddr_t objno; /* Compact form of object's location */ struct tm *tm; herr_t status; iter_t *iter = (iter_t*)_iter; @@ -1792,6 +1798,7 @@ list (hid_t group, const char *name, void *_iter) if (sb.type>=0 && dispatch_g[sb.type].name) { fputs(dispatch_g[sb.type].name, stdout); } + objno = (haddr_t)sb.objno[0] | ((haddr_t)sb.objno[1] << (8 * sizeof(long))); /* If the object has already been printed then just show the object ID * and return. */ @@ -1824,11 +1831,11 @@ list (hid_t group, const char *name, void *_iter) if (verbose_g>0 && H5G_LINK!=sb.type) { if (sb.type>=0) H5Aiterate(obj, NULL, list_attr, NULL); - printf(" %-10s %lu:"H5_PRINTF_HADDR_FMT"\n", "Location:", sb.fileno, sb.u.obj.objno); - printf(" %-10s %u\n", "Links:", sb.u.obj.nlink); - if (sb.u.obj.mtime>0) { - if (simple_output_g) tm=gmtime(&(sb.u.obj.mtime)); - else tm=localtime(&(sb.u.obj.mtime)); + printf(" %-10s %lu:"H5_PRINTF_HADDR_FMT"\n", "Location:", sb.fileno[0], objno); + printf(" %-10s %u\n", "Links:", sb.nlink); + if (sb.mtime>0) { + if (simple_output_g) tm=gmtime(&(sb.mtime)); + else tm=localtime(&(sb.mtime)); if (tm) { strftime(buf, sizeof(buf), "%Y-%m-%d %H:%M:%S %Z", tm); printf(" %-10s %s\n", "Modified:", buf); diff --git a/tools/h5repack/h5repack_copy.c b/tools/h5repack/h5repack_copy.c index 55b56d1..7b11b93 100644 --- a/tools/h5repack/h5repack_copy.c +++ b/tools/h5repack/h5repack_copy.c @@ -572,9 +572,9 @@ int do_copy_objects(hid_t fidin, if (H5Gget_objinfo(fidin,travt->objs[i].name,FALSE,&statbuf)<0) goto error; - targbuf = malloc(statbuf.u.slink.linklen); + targbuf = malloc(statbuf.linklen); - if (H5Gget_linkval(fidin,travt->objs[i].name,statbuf.u.slink.linklen,targbuf)<0) + if (H5Gget_linkval(fidin,travt->objs[i].name,statbuf.linklen,targbuf)<0) goto error; if (H5Glink(fidout, diff --git a/tools/h5repack/h5repack_refs.c b/tools/h5repack/h5repack_refs.c index 83b1c13..6e3156b 100644 --- a/tools/h5repack/h5repack_refs.c +++ b/tools/h5repack/h5repack_refs.c @@ -787,7 +787,7 @@ static const char* MapIdToName(hid_t refobj_id, return NULL; if (H5Dclose(id)<0) return NULL; - if (refstat.fileno==objstat.fileno && refstat.u.obj.objno==objstat.u.obj.objno) + if (!HDmemcmp(&refstat.fileno, &objstat.fileno, sizeof(refstat.fileno)) && !HDmemcmp(&refstat.objno, &objstat.objno, sizeof(refstat.objno))) { H5Fclose(fid); return travt->objs[i].name; diff --git a/tools/lib/h5diff.c b/tools/lib/h5diff.c index 4fd9c10..b4c9022 100644 --- a/tools/lib/h5diff.c +++ b/tools/lib/h5diff.c @@ -1042,12 +1042,12 @@ hsize_t diff (hid_t file1_id, if (H5Gget_objinfo (file1_id, path1, FALSE, &sb2) < 0) goto out; - buf1 = HDmalloc (sb1.u.slink.linklen); - buf2 = HDmalloc (sb2.u.slink.linklen); + buf1 = HDmalloc (sb1.linklen); + buf2 = HDmalloc (sb2.linklen); - if (H5Gget_linkval (file1_id, path1, sb1.u.slink.linklen, buf1) < 0) + if (H5Gget_linkval (file1_id, path1, sb1.linklen, buf1) < 0) goto out; - if (H5Gget_linkval (file2_id, path2, sb1.u.slink.linklen, buf2) < 0) + if (H5Gget_linkval (file2_id, path2, sb1.linklen, buf2) < 0) goto out; ret = HDstrcmp (buf1, buf2); diff --git a/tools/lib/h5tools_ref.c b/tools/lib/h5tools_ref.c index 89bdaf1..f49cb07 100644 --- a/tools/lib/h5tools_ref.c +++ b/tools/lib/h5tools_ref.c @@ -65,7 +65,8 @@ static hbool_t ref_path_table_find(haddr_t objno); int init_ref_path_table(hid_t fid) { - H5G_stat_t sb; + H5G_stat_t sb; + haddr_t objno; /* Compact form of object's location */ char *root_path; /* Set file ID for later queries (XXX: this should be fixed) */ @@ -83,9 +84,10 @@ init_ref_path_table(hid_t fid) HDfree(root_path); return (-1); } + objno = (haddr_t)sb.objno[0] | ((haddr_t)sb.objno[1] << (8 * sizeof(long))); /* Insert into table (takes ownership of path) */ - ref_path_table_put(root_path, sb.u.obj.objno); + ref_path_table_put(root_path, objno); return(0); } @@ -156,6 +158,7 @@ haddr_t ref_path_table_lookup(const char *thepath) { H5G_stat_t sb; + haddr_t objno; /* Compact form of object's location */ /* Check for external link first, so we don't return the OID of an object in another file */ if(H5Gget_objinfo(thefile, thepath, FALSE, &sb)<0) @@ -169,13 +172,14 @@ ref_path_table_lookup(const char *thepath) /* fatal error ? */ return HADDR_UNDEF; } /* end if */ + objno = (haddr_t)sb.objno[0] | ((haddr_t)sb.objno[1] << (8 * sizeof(long))); /* All existing objects in the file had better be in the table */ - HDassert(ref_path_table_find(sb.u.obj.objno)); + HDassert(ref_path_table_find(objno)); /* Return OID */ - return(sb.u.obj.objno); + return(objno); } /*------------------------------------------------------------------------- @@ -332,11 +336,13 @@ fill_ref_path_table(hid_t group, const char *obj_name, void *op_data) { const char *obj_prefix = (const char *)op_data; H5G_stat_t statbuf; + haddr_t objno; /* Compact form of object's location */ H5Gget_objinfo(group, obj_name, FALSE, &statbuf); + objno = (haddr_t)statbuf.objno[0] | ((haddr_t)statbuf.objno[1] << (8 * sizeof(long))); /* Check if the object is in the path table */ - if (!ref_path_table_find(statbuf.u.obj.objno)) { + if (!ref_path_table_find(objno)) { size_t tmp_len; char *thepath; @@ -353,7 +359,7 @@ fill_ref_path_table(hid_t group, const char *obj_name, void *op_data) HDstrcat(thepath, obj_name); /* Insert the object into the path table */ - ref_path_table_put(thepath, statbuf.u.obj.objno); + ref_path_table_put(thepath, objno); if(statbuf.type == H5G_GROUP) { /* Iterate over objects in this group, using this group's diff --git a/tools/lib/h5tools_str.c b/tools/lib/h5tools_str.c index 2286b4e..7ad5db7 100644 --- a/tools/lib/h5tools_str.c +++ b/tools/lib/h5tools_str.c @@ -841,14 +841,17 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai if (h5tools_is_zero(vp, H5Tget_size(type))) { h5tools_str_append(str, "NULL"); } else { + haddr_t objno; /* Compact form of object's location */ + obj = H5Rdereference(container, H5R_DATASET_REGION, vp); region = H5Rget_region(container, H5R_DATASET_REGION, vp); H5Gget_objinfo(obj, ".", FALSE, &sb); + objno = (haddr_t)sb.objno[0] | ((haddr_t)sb.objno[1] << (8 * sizeof(long))); if (info->dset_hidefileno) - h5tools_str_append(str, info->dset_format, sb.u.obj.objno); + h5tools_str_append(str, info->dset_format, objno); else - h5tools_str_append(str, info->dset_format, sb.fileno, sb.u.obj.objno); + h5tools_str_append(str, info->dset_format, sb.fileno[0], objno); h5tools_str_dump_region(str, region, info); H5Sclose(region); @@ -862,7 +865,9 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai if (h5tools_is_zero(vp, H5Tget_size(type))) { h5tools_str_append(str, "NULL"); } else { + haddr_t objno; /* Compact form of object's location */ const char *path; + otype = H5Rget_obj_type(container, H5R_OBJECT, vp); obj = H5Rdereference(container, H5R_OBJECT, vp); H5Gget_objinfo(obj, ".", FALSE, &sb); @@ -887,10 +892,11 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai } /* Print OID */ + objno = (haddr_t)sb.objno[0] | ((haddr_t)sb.objno[1] << (8 * sizeof(long))); if (info->obj_hidefileno) - h5tools_str_append(str, info->obj_format, sb.u.obj.objno); + h5tools_str_append(str, info->obj_format, objno); else - h5tools_str_append(str, info->obj_format, sb.fileno,sb.u.obj.objno); + h5tools_str_append(str, info->obj_format, sb.fileno[0], objno); /* Print name */ path = lookup_ref_path(*(haddr_t *)vp); diff --git a/tools/lib/h5tools_utils.c b/tools/lib/h5tools_utils.c index 9eba7c5..c1fa292 100644 --- a/tools/lib/h5tools_utils.c +++ b/tools/lib/h5tools_utils.c @@ -488,15 +488,18 @@ find_objs_cb(hid_t group, const char *name, void *op_data) if(H5Gget_objinfo(group, name, FALSE, &statbuf) < 0) ret_value = FAIL; else { + haddr_t objno; /* Compact form of object's location */ + + objno = (haddr_t)statbuf.objno[0] | ((haddr_t)statbuf.objno[1] << (8 * sizeof(long))); switch (statbuf.type) { char *tmp; case H5G_GROUP: - if (search_obj(info->group_table, statbuf.u.obj.objno) == NULL) { + if (search_obj(info->group_table, objno) == NULL) { char *old_prefix; tmp = build_obj_path_name(info->prefix, name); - add_obj(info->group_table, statbuf.u.obj.objno, tmp, TRUE); + add_obj(info->group_table, objno, tmp, TRUE); old_prefix = info->prefix; info->prefix = tmp; @@ -509,11 +512,11 @@ find_objs_cb(hid_t group, const char *name, void *op_data) break; case H5G_DATASET: - if (search_obj(info->dset_table, statbuf.u.obj.objno) == NULL) { + if (search_obj(info->dset_table, objno) == NULL) { hid_t dset; tmp = build_obj_path_name(info->prefix, name); - add_obj(info->dset_table, statbuf.u.obj.objno, tmp, TRUE); + add_obj(info->dset_table, objno, tmp, TRUE); if ((dset = H5Dopen (group, name)) >= 0) { hid_t type; @@ -522,11 +525,12 @@ find_objs_cb(hid_t group, const char *name, void *op_data) if (H5Tcommitted(type) > 0) { H5Gget_objinfo(type, ".", TRUE, &statbuf); + objno = (haddr_t)statbuf.objno[0] | ((haddr_t)statbuf.objno[1] << (8 * sizeof(long))); - if (search_obj(info->type_table, statbuf.u.obj.objno) == NULL) { + if (search_obj(info->type_table, objno) == NULL) { char *type_name = HDstrdup(tmp); - add_obj(info->type_table, statbuf.u.obj.objno, type_name, FALSE); + add_obj(info->type_table, objno, type_name, FALSE); } /* end if */ } @@ -543,8 +547,8 @@ find_objs_cb(hid_t group, const char *name, void *op_data) obj_t *found_obj; tmp = build_obj_path_name(info->prefix, name); - if ((found_obj = search_obj(info->type_table, statbuf.u.obj.objno)) == NULL) - add_obj(info->type_table, statbuf.u.obj.objno, tmp, TRUE); + if ((found_obj = search_obj(info->type_table, objno)) == NULL) + add_obj(info->type_table, objno, tmp, TRUE); else { /* Use latest version of name */ HDfree(found_obj->objname); diff --git a/tools/lib/h5trav.c b/tools/lib/h5trav.c index b59162a..f5c6e91 100644 --- a/tools/lib/h5trav.c +++ b/tools/lib/h5trav.c @@ -292,7 +292,7 @@ static int traverse( hid_t loc_id, int *idx, int print) { - + haddr_t objno; /* Compact form of object's location */ char *name=NULL; H5G_obj_t type; int n_names; @@ -325,6 +325,7 @@ static int traverse( hid_t loc_id, /* get info */ H5Gget_objinfo( loc_id, path, FALSE, &statbuf); } H5E_END_TRY; + objno = (haddr_t)statbuf.objno[0] | ((haddr_t)statbuf.objno[1] << (8 * sizeof(long))); /* add to array */ if ( info ) @@ -349,10 +350,10 @@ static int traverse( hid_t loc_id, inserted_objs++; /* nlink is number of hard links to object */ - if (statbuf.u.obj.nlink > 0 && trav_table_search(statbuf.u.obj.objno, table ) == -1) + if (statbuf.nlink > 0 && trav_table_search(objno, table ) == -1) { /* add object to table */ - trav_table_add(statbuf.u.obj.objno, path, H5G_GROUP, table ); + trav_table_add(objno, path, H5G_GROUP, table ); /* print it */ if (print) @@ -364,9 +365,9 @@ static int traverse( hid_t loc_id, /* search table group with more than one link to it */ - if (statbuf.u.obj.nlink > 1) + if (statbuf.nlink > 1) { - if ((j = trav_table_search(statbuf.u.obj.objno, table )) < 0 ) + if ((j = trav_table_search(objno, table )) < 0 ) return -1; trav_table_addlink(table,j,path); @@ -397,10 +398,10 @@ static int traverse( hid_t loc_id, inserted_objs++; /* nlink is number of hard links to object */ - if (statbuf.u.obj.nlink > 0 && trav_table_search(statbuf.u.obj.objno, table ) == -1) + if (statbuf.nlink > 0 && trav_table_search(objno, table ) == -1) { /* add object to table */ - trav_table_add(statbuf.u.obj.objno, path, H5G_DATASET, table ); + trav_table_add(objno, path, H5G_DATASET, table ); /* print it */ if (print) @@ -409,9 +410,9 @@ static int traverse( hid_t loc_id, /* search table dataset with more than one link to it */ - if (statbuf.u.obj.nlink > 1) + if (statbuf.nlink > 1) { - if ((j = trav_table_search(statbuf.u.obj.objno, table )) < 0 ) + if ((j = trav_table_search(objno, table )) < 0 ) return -1; trav_table_addlink(table,j,path); @@ -442,10 +443,10 @@ static int traverse( hid_t loc_id, inserted_objs++; /* nlink is number of hard links to object */ - if (statbuf.u.obj.nlink > 0 && trav_table_search(statbuf.u.obj.objno, table ) == -1) + if (statbuf.nlink > 0 && trav_table_search(objno, table ) == -1) { /* add object to table */ - trav_table_add(statbuf.u.obj.objno, path, H5G_TYPE, table ); + trav_table_add(objno, path, H5G_TYPE, table ); /* print it */ if (print) @@ -468,13 +469,13 @@ static int traverse( hid_t loc_id, /* add object to table */ trav_table_add(HADDR_UNDEF, path, H5G_LINK, table ); - if (statbuf.u.slink.linklen>0) + if (statbuf.linklen>0) { char *targbuf; - targbuf = HDmalloc(statbuf.u.slink.linklen); + targbuf = HDmalloc(statbuf.linklen); assert(targbuf); - H5Gget_linkval(loc_id,path,statbuf.u.slink.linklen,targbuf); + H5Gget_linkval(loc_id,path,statbuf.linklen,targbuf); if (print) printf(" %-10s %s -> %s\n", "link", path, targbuf); free(targbuf); diff --git a/tools/misc/h5stat.c b/tools/misc/h5stat.c index e8f1647..e72f609 100644 --- a/tools/misc/h5stat.c +++ b/tools/misc/h5stat.c @@ -123,11 +123,12 @@ ceil_log10(unsigned long x) static void sym_insert(H5G_stat_t *sb, const char *name) { + haddr_t objno; /* Compact form of object's location */ int n; /* Don't add it if the link count is 1 because such an object can only * have one name. */ - if (sb->u.obj.nlink<2) return; + if (sb->nlink<2) return; /* Extend the table */ if (idtab_g.nobjs>=idtab_g.nalloc) { @@ -138,7 +139,8 @@ sym_insert(H5G_stat_t *sb, const char *name) /* Insert the entry */ n = idtab_g.nobjs++; - idtab_g.obj[n].id = sb->u.obj.objno; + objno = (haddr_t)sb->objno[0] | ((haddr_t)sb->objno[1] << (8 * sizeof(long))); + idtab_g.obj[n].id = objno; idtab_g.obj[n].name = strdup(name); } @@ -162,12 +164,14 @@ sym_insert(H5G_stat_t *sb, const char *name) static char * sym_lookup(H5G_stat_t *sb) { + haddr_t objno; /* Compact form of object's location */ int n; - if (sb->u.obj.nlink<2) + if (sb->nlink<2) return NULL; /*only one name possible*/ + objno = (haddr_t)sb->objno[0] | ((haddr_t)sb->objno[1] << (8 * sizeof(long))); for (n=0; nu.obj.objno) + if(idtab_g.obj[n].id == objno) return idtab_g.obj[n].name; } return NULL; @@ -267,8 +271,8 @@ printf("walk: fullname = %s\n", fullname); sym_insert(&sb, fullname); /* Gather some statistics about the object */ - if(sb.u.obj.nlink > iter->max_links) - iter->max_links = sb.u.obj.nlink; + if(sb.nlink > iter->max_links) + iter->max_links = sb.nlink; switch(sb.type) { case H5G_GROUP: @@ -284,8 +288,8 @@ printf("walk: fullname = %s\n", fullname); iter->max_depth = iter->curr_depth; /* Get object header information */ - iter->group_ohdr_info.total_size += sb.u.obj.ohdr.size; - iter->group_ohdr_info.free_size += sb.u.obj.ohdr.free; + iter->group_ohdr_info.total_size += sb.ohdr.size; + iter->group_ohdr_info.free_size += sb.ohdr.free; gid = H5Gopen(group, name); assert(gid > 0); @@ -346,8 +350,8 @@ printf("walk: fullname = %s\n", fullname); iter->uniq_dsets++; /* Get object header information */ - iter->dset_ohdr_info.total_size += sb.u.obj.ohdr.size; - iter->dset_ohdr_info.free_size += sb.u.obj.ohdr.free; + iter->dset_ohdr_info.total_size += sb.ohdr.size; + iter->dset_ohdr_info.free_size += sb.ohdr.free; did = H5Dopen(group, name); assert(did > 0); -- cgit v0.12