summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2005-08-27 13:34:28 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2005-08-27 13:34:28 (GMT)
commitfefbe61aca1a42e716e900be7af5b382be5e19c1 (patch)
treedbb600c8b6555569a4d94ff69b24e72c4787693d
parent538d37a1bcc15a600c71fad0566d8480c2344ee6 (diff)
downloadhdf5-fefbe61aca1a42e716e900be7af5b382be5e19c1.zip
hdf5-fefbe61aca1a42e716e900be7af5b382be5e19c1.tar.gz
hdf5-fefbe61aca1a42e716e900be7af5b382be5e19c1.tar.bz2
[svn-r11304] Purpose:
Code cleanup (sorta) Description: Adjust H5G_stat_t to prepare for eventual "external link" information. This also puts the information for regular objects and soft links into more obviously separate places. Platforms tested: FreeBSD 4.11 (sleipnir) Linux 2.4
-rw-r--r--hl/src/H5DS.c16
-rw-r--r--src/H5G.c14
-rw-r--r--src/H5Gpublic.h24
-rw-r--r--src/H5R.c4
-rw-r--r--test/links.c8
-rw-r--r--test/mount.c4
-rw-r--r--test/mtime.c12
-rw-r--r--test/tattr.c14
-rw-r--r--test/tmisc.c32
-rw-r--r--test/unlink.c2
-rw-r--r--tools/h5dump/h5dump.c32
-rw-r--r--tools/h5ls/h5ls.c20
-rw-r--r--tools/h5repack/h5repack_copy.c4
-rw-r--r--tools/h5repack/h5repack_refs.c2
-rw-r--r--tools/lib/h5diff.c8
-rw-r--r--tools/lib/h5tools_ref.c8
-rw-r--r--tools/lib/h5tools_str.c8
-rw-r--r--tools/lib/h5tools_utils.c16
-rw-r--r--tools/lib/h5trav.c28
19 files changed, 133 insertions, 123 deletions
diff --git a/hl/src/H5DS.c b/hl/src/H5DS.c
index b77b97f..b88020b 100644
--- a/hl/src/H5DS.c
+++ b/hl/src/H5DS.c
@@ -148,7 +148,7 @@ herr_t H5DSattach_scale(hid_t did,
return FAIL;
/* same object, not valid */
- if (sb1.fileno==sb2.fileno && sb1.objno==sb2.objno)
+ if (sb1.fileno==sb2.fileno && sb1.u.obj.objno==sb2.u.obj.objno)
return FAIL;
/* get ID type */
@@ -325,7 +325,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.objno==sb2.objno)
+ if (sb1.fileno==sb2.fileno && sb1.u.obj.objno==sb2.u.obj.objno)
{
found_ds = 1;
}
@@ -602,7 +602,7 @@ herr_t H5DSdetach_scale(hid_t did,
return FAIL;
/* same object, not valid */
- if (sb1.fileno==sb2.fileno && sb1.objno==sb2.objno)
+ if (sb1.fileno==sb2.fileno && sb1.u.obj.objno==sb2.u.obj.objno)
return FAIL;
/* get ID type */
@@ -696,7 +696,7 @@ herr_t H5DSdetach_scale(hid_t did,
goto out;
/* same object, reset */
- if (sb1.fileno==sb2.fileno && sb1.objno==sb2.objno)
+ if (sb1.fileno==sb2.fileno && sb1.u.obj.objno==sb2.u.obj.objno)
{
for(jj=j; jj<buf[idx].len-1; jj++)
{
@@ -781,7 +781,7 @@ herr_t H5DSdetach_scale(hid_t did,
goto out;
/* same object, reset. we want to detach only for this DIM */
- if (sb3.fileno==sb4.fileno && sb3.objno==sb4.objno && (int)idx==dsbuf[i].dim_idx)
+ if (sb3.fileno==sb4.fileno && sb3.u.obj.objno==sb4.u.obj.objno && (int)idx==dsbuf[i].dim_idx)
{
for(jj=i; jj<nelmts-1; jj++)
{
@@ -1787,7 +1787,7 @@ htri_t H5DSis_attached(hid_t did,
return FAIL;
/* same object, not valid */
- if (sb1.fileno==sb2.fileno && sb1.objno==sb2.objno)
+ if (sb1.fileno==sb2.fileno && sb1.u.obj.objno==sb2.u.obj.objno)
return FAIL;
/* get ID type */
@@ -1869,7 +1869,7 @@ htri_t H5DSis_attached(hid_t did,
goto out;
/* same object */
- if (sb1.fileno==sb2.fileno && sb1.objno==sb2.objno)
+ if (sb1.fileno==sb2.fileno && sb1.u.obj.objno==sb2.u.obj.objno)
{
found_ds = 1;
}
@@ -1957,7 +1957,7 @@ htri_t H5DSis_attached(hid_t did,
goto out;
/* same object */
- if (sb3.fileno==sb4.fileno && sb3.objno==sb4.objno && (int)idx==dsbuf[i].dim_idx) {
+ if (sb3.fileno==sb4.fileno && sb3.u.obj.objno==sb4.u.obj.objno && (int)idx==dsbuf[i].dim_idx) {
found_dset=1;
} /* if */
diff --git a/src/H5G.c b/src/H5G.c
index 0690039..360e690 100644
--- a/src/H5G.c
+++ b/src/H5G.c
@@ -2789,7 +2789,7 @@ H5G_get_objinfo (H5G_entry_t *loc, const char *name, hbool_t follow_link,
s = H5HL_offset_into(grp_ent.file, heap, obj_ent.cache.slink.lval_offset);
- statbuf->linklen = HDstrlen(s) + 1; /*count the null terminator*/
+ statbuf->u.slink.linklen = HDstrlen(s) + 1; /*count the null terminator*/
/* Release the local heap */
if (H5HL_unprotect(grp_ent.file, dxpl_id, heap, stab_mesg.heap_addr, H5AC__NO_FLAGS_SET) < 0)
@@ -2799,13 +2799,13 @@ H5G_get_objinfo (H5G_entry_t *loc, const char *name, hbool_t follow_link,
statbuf->type = H5G_LINK;
} else {
/* Some other type of object */
- statbuf->objno = obj_ent.header;
- statbuf->nlink = H5O_link (&obj_ent, 0, dxpl_id);
- if (NULL==H5O_read(&obj_ent, H5O_MTIME_ID, 0, &(statbuf->mtime), dxpl_id)) {
+ statbuf->u.obj.objno = obj_ent.header;
+ statbuf->u.obj.nlink = H5O_link (&obj_ent, 0, dxpl_id);
+ if (NULL==H5O_read(&obj_ent, H5O_MTIME_ID, 0, &(statbuf->u.obj.mtime), dxpl_id)) {
H5E_clear_stack(NULL);
- if (NULL==H5O_read(&obj_ent, H5O_MTIME_NEW_ID, 0, &(statbuf->mtime), dxpl_id)) {
+ if (NULL==H5O_read(&obj_ent, H5O_MTIME_NEW_ID, 0, &(statbuf->u.obj.mtime), dxpl_id)) {
H5E_clear_stack(NULL);
- statbuf->mtime = 0;
+ statbuf->u.obj.mtime = 0;
}
}
/* Get object type */
@@ -2813,7 +2813,7 @@ H5G_get_objinfo (H5G_entry_t *loc, const char *name, hbool_t follow_link,
H5E_clear_stack(NULL); /*clear errors resulting from checking type*/
/* Get object header information */
- if(H5O_get_info(&obj_ent, &(statbuf->ohdr), dxpl_id)<0)
+ if(H5O_get_info(&obj_ent, &(statbuf->u.obj.ohdr), dxpl_id)<0)
HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "unable to get object header information")
}
} /* end if */
diff --git a/src/H5Gpublic.h b/src/H5Gpublic.h
index d38a8cb..6ab22fe 100644
--- a/src/H5Gpublic.h
+++ b/src/H5Gpublic.h
@@ -71,14 +71,24 @@ typedef enum H5G_obj_t {
#define H5G_USERTYPE(X) (8+(X)) /* User defined types */
/* Information about an object */
-typedef struct H5G_stat_t {
- unsigned long fileno; /*file number */
- haddr_t objno; /*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 */
+typedef struct H5G_obj_stat_t {
+ haddr_t objno; /* Object number */
+ unsigned nlink; /* Number of hard links to object*/
+ time_t mtime; /* Modification time */
H5O_stat_t ohdr; /* Object header information */
+} H5G_obj_stat_t;
+
+typedef struct H5G_slink_stat_t {
+ size_t linklen; /* Symbolic link value length */
+} H5G_slink_stat_t;
+
+typedef struct H5G_stat_t {
+ unsigned long fileno; /* File number */
+ H5G_obj_t type; /* Object type */
+ union {
+ H5G_obj_stat_t obj; /* Information about objects */
+ H5G_slink_stat_t slink; /* Information about symbolic links */
+ } u;
} H5G_stat_t;
#define H5G_SAME_LOC 0
diff --git a/src/H5R.c b/src/H5R.c
index b06d990..fce6c7a 100644
--- a/src/H5R.c
+++ b/src/H5R.c
@@ -153,7 +153,7 @@ H5R_create(void *_ref, H5G_entry_t *loc, const char *name, H5R_type_t ref_type,
{
hobj_ref_t *ref=(hobj_ref_t *)_ref; /* Get pointer to correct type of reference struct */
- *ref=sb.objno;
+ *ref=sb.u.obj.objno;
break;
}
@@ -200,7 +200,7 @@ H5R_create(void *_ref, H5G_entry_t *loc, const char *name, H5R_type_t ref_type,
/* Serialize information for dataset OID */
p=(uint8_t *)buf;
- H5F_addr_encode(loc->file,&p,sb.objno);
+ H5F_addr_encode(loc->file,&p,sb.u.obj.objno);
/* Serialize the selection */
if (H5S_SELECT_SERIALIZE(space,p) < 0)
diff --git a/test/links.c b/test/links.c
index 7484211..8a89929 100644
--- a/test/links.c
+++ b/test/links.c
@@ -269,7 +269,7 @@ cklinks(hid_t fapl)
puts(" Unexpected object type should have been a dataset");
goto error;
}
- if (sb1.objno!=sb2.objno) {
+ if (sb1.u.obj.objno!=sb2.u.obj.objno) {
H5_FAILED();
puts(" Hard link test failed. Link seems not to point to the ");
puts(" expected file location.");
@@ -283,7 +283,7 @@ cklinks(hid_t fapl)
puts(" Unexpected object type should have been a dataset");
goto error;
}
- if (sb1.objno!=sb2.objno) {
+ if (sb1.u.obj.objno!=sb2.u.obj.objno) {
H5_FAILED();
puts(" Soft link test failed. Link seems not to point to the ");
puts(" expected file location.");
@@ -403,7 +403,7 @@ ck_new_links(hid_t fapl)
puts(" Unexpected object type, should have been a dataset");
goto error;
}
- if( sb_dset.objno!=sb_hard1.objno || sb_dset.objno!=sb_hard2.objno ) {
+ if( sb_dset.u.obj.objno!=sb_hard1.u.obj.objno || sb_dset.u.obj.objno!=sb_hard2.u.obj.objno ) {
H5_FAILED();
puts(" Hard link test failed. Link seems not to point to the ");
puts(" expected file location.");
@@ -421,7 +421,7 @@ ck_new_links(hid_t fapl)
goto error;
}
- if( sb_dset.objno!=sb_soft1.objno || sb_dset.objno!=sb_soft2.objno ) {
+ if( sb_dset.u.obj.objno!=sb_soft1.u.obj.objno || sb_dset.u.obj.objno!=sb_soft2.u.obj.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 3b9d4ce..6c19143 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.objno!=sb2.objno) {
+ if (sb1.fileno!=sb2.fileno || sb1.u.obj.objno!=sb2.u.obj.objno) {
H5_FAILED();
puts(" Hard link failed for hidden object.");
goto error;
@@ -360,7 +360,7 @@ test_assoc(hid_t fapl)
* of file2.
*/
if (H5Gget_objinfo(file1, "/mnt1", TRUE, &sb2)<0) goto error;
- if (sb1.fileno!=sb2.fileno || sb1.objno!=sb2.objno) {
+ if (sb1.fileno!=sb2.fileno || sb1.u.obj.objno!=sb2.u.obj.objno) {
H5_FAILED();
puts(" Association failed.");
goto error;
diff --git a/test/mtime.c b/test/mtime.c
index 18f0bbf..963ccb7 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.objno!=sb2.objno || sb1.mtime!=sb2.mtime) {
+ if (sb1.u.obj.objno!=sb2.u.obj.objno || sb1.u.obj.mtime!=sb2.u.obj.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.mtime) {
+ if (0==sb1.u.obj.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.mtime))>60.0) {
+ } else if (fabs(HDdifftime(now, sb1.u.obj.mtime))>60.0) {
H5_FAILED();
- tm = localtime(&(sb1.mtime));
+ tm = localtime(&(sb1.u.obj.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.mtime!=MTIME1) {
+ if(sb1.u.obj.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.mtime!=MTIME2) {
+ if(sb2.u.obj.mtime!=MTIME2) {
H5_FAILED();
puts(" Modification time incorrect.");
goto error;
diff --git a/test/tattr.c b/test/tattr.c
index 4297316..dc82190 100644
--- a/test/tattr.c
+++ b/test/tattr.c
@@ -1433,7 +1433,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.nlink, 1, "H5Tcommit");
+ VERIFY(statbuf.u.obj.nlink, 1, "H5Tcommit");
/* Create dataspace for dataset */
space_id=H5Screate(H5S_SCALAR);
@@ -1446,7 +1446,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.nlink, 2, "H5Dcreate");
+ VERIFY(statbuf.u.obj.nlink, 2, "H5Dcreate");
/* Create attribute on dataset */
attr_id=H5Acreate(dset_id,ATTR1_NAME,type_id,space_id,H5P_DEFAULT);
@@ -1455,7 +1455,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.nlink, 3, "H5Acreate");
+ VERIFY(statbuf.u.obj.nlink, 3, "H5Acreate");
/* Close attribute */
ret=H5Aclose(attr_id);
@@ -1468,7 +1468,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.nlink, 2, "H5Adelete");
+ VERIFY(statbuf.u.obj.nlink, 2, "H5Adelete");
/* Create attribute on dataset */
attr_id=H5Acreate(dset_id,ATTR1_NAME,type_id,space_id,H5P_DEFAULT);
@@ -1477,7 +1477,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.nlink, 3, "H5Acreate");
+ VERIFY(statbuf.u.obj.nlink, 3, "H5Acreate");
/* Write data into the attribute */
ret=H5Awrite(attr_id,H5T_NATIVE_INT,&data);
@@ -1531,7 +1531,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.nlink, 3, "H5Aopen_name");
+ VERIFY(statbuf.u.obj.nlink, 3, "H5Aopen_name");
/* Unlink the dataset */
ret=H5Gunlink(file_id,DSET1_NAME);
@@ -1540,7 +1540,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.nlink, 1, "H5Gunlink");
+ VERIFY(statbuf.u.obj.nlink, 1, "H5Gunlink");
/* Unlink the named datatype */
ret=H5Gunlink(file_id,TYPE1_NAME);
diff --git a/test/tmisc.c b/test/tmisc.c
index 6cc7556..d228452 100644
--- a/test/tmisc.c
+++ b/test/tmisc.c
@@ -2812,10 +2812,10 @@ test_misc18(void)
/* Get object information */
ret = H5Gget_objinfo(fid,MISC18_DSET1_NAME,0,&statbuf);
CHECK(ret, FAIL, "H5Gget_objinfo");
- VERIFY(statbuf.ohdr.nmesgs, 6, "H5Gget_objinfo");
- VERIFY(statbuf.ohdr.nchunks, 1, "H5Gget_objinfo");
- VERIFY(statbuf.ohdr.size, 272, "H5Gget_objinfo");
- VERIFY(statbuf.ohdr.free, 152, "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.u.obj.ohdr.free, 152, "H5Gget_objinfo");
/* Create second dataset */
did2 = H5Dcreate(fid, MISC18_DSET2_NAME, H5T_STD_U32LE, sid, H5P_DEFAULT);
@@ -2824,10 +2824,10 @@ test_misc18(void)
/* Get object information */
ret = H5Gget_objinfo(fid,MISC18_DSET2_NAME,0,&statbuf);
CHECK(ret, FAIL, "H5Gget_objinfo");
- VERIFY(statbuf.ohdr.nmesgs, 6, "H5Gget_objinfo");
- VERIFY(statbuf.ohdr.nchunks, 1, "H5Gget_objinfo");
- VERIFY(statbuf.ohdr.size, 272, "H5Gget_objinfo");
- VERIFY(statbuf.ohdr.free, 152, "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.u.obj.ohdr.free, 152, "H5Gget_objinfo");
/* Loop creating attributes on each dataset, flushing them to the file each time */
for(u=0; u<10; u++) {
@@ -2856,18 +2856,18 @@ test_misc18(void)
/* Get object information for dataset #1 now */
ret = H5Gget_objinfo(fid,MISC18_DSET1_NAME,0,&statbuf);
CHECK(ret, FAIL, "H5Gget_objinfo");
- VERIFY(statbuf.ohdr.nmesgs, 24, "H5Gget_objinfo");
- VERIFY(statbuf.ohdr.nchunks, 9, "H5Gget_objinfo");
- VERIFY(statbuf.ohdr.size, 888, "H5Gget_objinfo");
- VERIFY(statbuf.ohdr.free, 16, "H5Gget_objinfo");
+ VERIFY(statbuf.u.obj.ohdr.nmesgs, 24, "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, 16, "H5Gget_objinfo");
/* Get object information for dataset #2 now */
ret = H5Gget_objinfo(fid,MISC18_DSET2_NAME,0,&statbuf);
CHECK(ret, FAIL, "H5Gget_objinfo");
- VERIFY(statbuf.ohdr.nmesgs, 24, "H5Gget_objinfo");
- VERIFY(statbuf.ohdr.nchunks, 9, "H5Gget_objinfo");
- VERIFY(statbuf.ohdr.size, 888, "H5Gget_objinfo");
- VERIFY(statbuf.ohdr.free, 16, "H5Gget_objinfo");
+ VERIFY(statbuf.u.obj.ohdr.nmesgs, 24, "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, 16, "H5Gget_objinfo");
/* Close second dataset */
ret = H5Dclose(did2);
diff --git a/test/unlink.c b/test/unlink.c
index c8b7ddc..76c9bcc 100644
--- a/test/unlink.c
+++ b/test/unlink.c
@@ -464,7 +464,7 @@ check_new_move(void)
puts(" Unexpected object type, should have been a group");
goto error;
}
- if( sb_hard1.objno!=sb_hard2.objno) {
+ if( sb_hard1.u.obj.objno!=sb_hard2.u.obj.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 8356465..2a99989 100644
--- a/tools/h5dump/h5dump.c
+++ b/tools/h5dump/h5dump.c
@@ -683,7 +683,7 @@ print_datatype(hid_t type,unsigned in_group)
obj_t *obj; /* Found object */
H5Gget_objinfo(type, ".", TRUE, &statbuf);
- obj = search_obj(type_table, statbuf.objno);
+ obj = search_obj(type_table, statbuf.u.obj.objno);
if (obj) {
if (!obj->recorded)
@@ -1350,7 +1350,7 @@ dump_all(hid_t group, const char *name, void * op_data)
switch (statbuf.type) {
case H5G_LINK:
indentation(indent);
- targbuf = malloc(statbuf.linklen);
+ targbuf = malloc(statbuf.u.slink.linklen);
if (!doxml) {
begin_obj(dump_header_format->softlinkbegin, name,
@@ -1358,7 +1358,7 @@ dump_all(hid_t group, const char *name, void * op_data)
indentation(indent + COL);
}
- if (H5Gget_linkval(group, name, statbuf.linklen, targbuf) < 0) {
+ if (H5Gget_linkval(group, name, statbuf.u.slink.linklen, targbuf) < 0) {
error_msg(progname, "unable to get link value\n");
d_status = EXIT_FAILURE;
ret = FAIL;
@@ -1378,7 +1378,7 @@ dump_all(hid_t group, const char *name, void * op_data)
char *tmp2, *t_tmp;
int res;
- tmp2 = malloc(strlen(prefix) + statbuf.linklen + 1);
+ tmp2 = malloc(strlen(prefix) + statbuf.u.slink.linklen + 1);
strcpy(tmp2, prefix);
if (targbuf && targbuf[0] == '/')
@@ -1465,10 +1465,10 @@ dump_all(hid_t group, const char *name, void * op_data)
/* hard link */
H5Gget_objinfo(obj, ".", TRUE, &statbuf);
- if (statbuf.nlink > 1) {
+ if (statbuf.u.obj.nlink > 1) {
obj_t *found_obj; /* Found object */
- found_obj = search_obj(dset_table, statbuf.objno);
+ found_obj = search_obj(dset_table, statbuf.u.obj.objno);
if (found_obj == NULL) {
indentation(indent);
@@ -1659,10 +1659,10 @@ dump_group(hid_t gid, const char *name)
H5Gget_objinfo(gid, ".", TRUE, &statbuf);
- if (statbuf.nlink > 1) {
+ if (statbuf.u.obj.nlink > 1) {
obj_t *found_obj; /* Found object */
- found_obj = search_obj(group_table, statbuf.objno);
+ found_obj = search_obj(group_table, statbuf.u.obj.objno);
if (found_obj == NULL) {
indentation(indent);
@@ -2858,10 +2858,10 @@ handle_datasets(hid_t fid, char *dset, void *data)
H5Gget_objinfo(dsetid, ".", TRUE, &statbuf);
- if (statbuf.nlink > 1) {
+ if (statbuf.u.obj.nlink > 1) {
obj_t *found_obj; /* Found object */
- found_obj = search_obj(dset_table, statbuf.objno);
+ found_obj = search_obj(dset_table, statbuf.u.obj.objno);
if (found_obj) {
if (found_obj->displayed) {
@@ -2960,13 +2960,13 @@ handle_links(hid_t fid, char *links, void UNUSED * data)
dump_header_format->softlinkblockend);
d_status = EXIT_FAILURE;
} else if (statbuf.type == H5G_LINK) {
- char *buf = malloc(statbuf.linklen);
+ char *buf = malloc(statbuf.u.slink.linklen);
begin_obj(dump_header_format->softlinkbegin, links,
dump_header_format->softlinkblockbegin);
indentation(COL);
- if (H5Gget_linkval(fid, links, statbuf.linklen, buf) >= 0) {
+ if (H5Gget_linkval(fid, links, statbuf.u.slink.linklen, buf) >= 0) {
printf("LINKTARGET \"%s\"\n", buf);
} else {
error_msg(progname, "h5dump error: unable to get link value for \"%s\"\n",
@@ -3981,7 +3981,7 @@ xml_print_datatype(hid_t type, unsigned in_group)
/* detect a shared datatype, output only once */
H5Gget_objinfo(type, ".", TRUE, &statbuf);
- found_obj = search_obj(type_table, statbuf.objno);
+ found_obj = search_obj(type_table, statbuf.u.obj.objno);
if (found_obj) {
/* This should be defined somewhere else */
@@ -4348,7 +4348,7 @@ xml_dump_datatype(hid_t type)
/* Data type is a shared or named data type */
H5Gget_objinfo(type, ".", TRUE, &statbuf);
- found_obj = search_obj(type_table, statbuf.objno);
+ found_obj = search_obj(type_table, statbuf.u.obj.objno);
if (found_obj) {
/* Shared data type, must be entered as an object */
@@ -4830,11 +4830,11 @@ xml_dump_group(hid_t gid, const char *name)
indent += COL;
H5Gget_objinfo(gid, ".", TRUE, &statbuf);
- if (statbuf.nlink > 1) {
+ if (statbuf.u.obj.nlink > 1) {
obj_t *found_obj; /* Found object */
/* Group with more than one link to it... */
- found_obj = search_obj(group_table, statbuf.objno);
+ found_obj = search_obj(group_table, statbuf.u.obj.objno);
if (found_obj == NULL) {
indentation(indent);
diff --git a/tools/h5ls/h5ls.c b/tools/h5ls/h5ls.c
index a1a7f3b..75e4218 100644
--- a/tools/h5ls/h5ls.c
+++ b/tools/h5ls/h5ls.c
@@ -149,7 +149,7 @@ sym_insert(H5G_stat_t *sb, const char *name)
/* Don't add it if the link count is 1 because such an object can only
* have one name. */
- if (sb->nlink<2) return;
+ if (sb->u.obj.nlink<2) return;
/* Extend the table */
if (idtab_g.nobjs>=idtab_g.nalloc) {
@@ -160,7 +160,7 @@ sym_insert(H5G_stat_t *sb, const char *name)
/* Insert the entry */
n = idtab_g.nobjs++;
- idtab_g.obj[n].id = sb->objno;
+ idtab_g.obj[n].id = sb->u.obj.objno;
idtab_g.obj[n].name = HDstrdup(name);
}
@@ -186,9 +186,9 @@ sym_lookup(H5G_stat_t *sb)
{
int n;
- if (sb->nlink<2) return NULL; /*only one name possible*/
+ if (sb->u.obj.nlink<2) return NULL; /*only one name possible*/
for (n=0; n<idtab_g.nobjs; n++) {
- if (idtab_g.obj[n].id==sb->objno)
+ if (idtab_g.obj[n].id==sb->u.obj.objno)
return idtab_g.obj[n].name;
}
return NULL;
@@ -1176,7 +1176,7 @@ display_type(hid_t type, int ind)
if (H5Tcommitted(type)) {
if (H5Gget_objinfo(type, ".", FALSE, &sb)>=0) {
printf("shared-%lu:"H5_PRINTF_HADDR_FMT" ",
- sb.fileno, sb.objno);
+ sb.fileno, sb.u.obj.objno);
} else {
printf("shared ");
}
@@ -1824,11 +1824,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.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));
+ 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));
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 5b0520d..fee7440 100644
--- a/tools/h5repack/h5repack_copy.c
+++ b/tools/h5repack/h5repack_copy.c
@@ -504,9 +504,9 @@ int do_copy_objects(hid_t fidin,
if (H5Gget_objinfo(fidin,travt->objs[i].name,FALSE,&statbuf)<0)
goto error;
- targbuf = malloc(statbuf.linklen);
+ targbuf = malloc(statbuf.u.slink.linklen);
- if (H5Gget_linkval(fidin,travt->objs[i].name,statbuf.linklen,targbuf)<0)
+ if (H5Gget_linkval(fidin,travt->objs[i].name,statbuf.u.slink.linklen,targbuf)<0)
goto error;
if (H5Glink(fidout,
diff --git a/tools/h5repack/h5repack_refs.c b/tools/h5repack/h5repack_refs.c
index 99cd49f..4b075d5 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.objno==objstat.objno)
+ if (refstat.fileno==objstat.fileno && refstat.u.obj.objno==objstat.u.obj.objno)
{
H5Fclose(fid);
return travt->objs[i].name;
diff --git a/tools/lib/h5diff.c b/tools/lib/h5diff.c
index 5103280..8066e5e 100644
--- a/tools/lib/h5diff.c
+++ b/tools/lib/h5diff.c
@@ -1048,12 +1048,12 @@ diff (hid_t file1_id,
if (H5Gget_objinfo (file1_id, path1, FALSE, &sb2) < 0)
goto out;
- buf1 = malloc (sb1.linklen);
- buf2 = malloc (sb2.linklen);
+ buf1 = malloc (sb1.u.slink.linklen);
+ buf2 = malloc (sb2.u.slink.linklen);
- if (H5Gget_linkval (file1_id, path1, sb1.linklen, buf1) < 0)
+ if (H5Gget_linkval (file1_id, path1, sb1.u.slink.linklen, buf1) < 0)
goto out;
- if (H5Gget_linkval (file2_id, path2, sb1.linklen, buf2) < 0)
+ if (H5Gget_linkval (file2_id, path2, sb1.u.slink.linklen, buf2) < 0)
goto out;
ret = HDstrcmp (buf1, buf2);
diff --git a/tools/lib/h5tools_ref.c b/tools/lib/h5tools_ref.c
index df2873d..82dd1d0 100644
--- a/tools/lib/h5tools_ref.c
+++ b/tools/lib/h5tools_ref.c
@@ -85,7 +85,7 @@ init_ref_path_table(hid_t fid)
}
/* Insert into table (takes ownership of path) */
- ref_path_table_put(root_path, sb.objno);
+ ref_path_table_put(root_path, sb.u.obj.objno);
return(0);
}
@@ -164,7 +164,7 @@ ref_path_table_lookup(const char *thepath)
return HADDR_UNDEF;
/* Return OID or HADDR_UNDEF */
- ret_value = ref_path_table_find(sb.objno) ? sb.objno : HADDR_UNDEF;
+ ret_value = ref_path_table_find(sb.u.obj.objno) ? sb.u.obj.objno : HADDR_UNDEF;
return(ret_value);
}
@@ -327,7 +327,7 @@ fill_ref_path_table(hid_t group, const char *obj_name, void *op_data)
H5Gget_objinfo(group, obj_name, FALSE, &statbuf);
/* Check if the object is in the path table */
- if (!ref_path_table_find(statbuf.objno)) {
+ if (!ref_path_table_find(statbuf.u.obj.objno)) {
size_t tmp_len;
char *thepath;
@@ -344,7 +344,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.objno);
+ ref_path_table_put(thepath, statbuf.u.obj.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 82a6100..141aa3e 100644
--- a/tools/lib/h5tools_str.c
+++ b/tools/lib/h5tools_str.c
@@ -839,9 +839,9 @@ h5tools_str_sprint(h5tools_str_t *str, const h5dump_t *info, hid_t container,
H5Gget_objinfo(obj, ".", FALSE, &sb);
if (info->dset_hidefileno)
- h5tools_str_append(str, info->dset_format, sb.objno);
+ h5tools_str_append(str, info->dset_format, sb.u.obj.objno);
else
- h5tools_str_append(str, info->dset_format, sb.fileno, sb.objno);
+ h5tools_str_append(str, info->dset_format, sb.fileno, sb.u.obj.objno);
h5tools_str_dump_region(str, region, info);
H5Sclose(region);
@@ -881,9 +881,9 @@ h5tools_str_sprint(h5tools_str_t *str, const h5dump_t *info, hid_t container,
/* Print OID */
if (info->obj_hidefileno)
- h5tools_str_append(str, info->obj_format, sb.objno);
+ h5tools_str_append(str, info->obj_format, sb.u.obj.objno);
else
- h5tools_str_append(str, info->obj_format, sb.fileno,sb.objno);
+ h5tools_str_append(str, info->obj_format, sb.fileno,sb.u.obj.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 8516242..764d8b2 100644
--- a/tools/lib/h5tools_utils.c
+++ b/tools/lib/h5tools_utils.c
@@ -491,11 +491,11 @@ find_objs_cb(hid_t group, const char *name, void *op_data)
char *tmp;
case H5G_GROUP:
- if (search_obj(info->group_table, statbuf.objno) == NULL) {
+ if (search_obj(info->group_table, statbuf.u.obj.objno) == NULL) {
char *old_prefix;
tmp = build_obj_path_name(info->prefix, name);
- add_obj(info->group_table, statbuf.objno, tmp, TRUE);
+ add_obj(info->group_table, statbuf.u.obj.objno, tmp, TRUE);
old_prefix = info->prefix;
info->prefix = tmp;
@@ -508,11 +508,11 @@ find_objs_cb(hid_t group, const char *name, void *op_data)
break;
case H5G_DATASET:
- if (search_obj(info->dset_table, statbuf.objno) == NULL) {
+ if (search_obj(info->dset_table, statbuf.u.obj.objno) == NULL) {
hid_t dset;
tmp = build_obj_path_name(info->prefix, name);
- add_obj(info->dset_table, statbuf.objno, tmp, TRUE);
+ add_obj(info->dset_table, statbuf.u.obj.objno, tmp, TRUE);
if ((dset = H5Dopen (group, name)) >= 0) {
hid_t type;
@@ -522,10 +522,10 @@ find_objs_cb(hid_t group, const char *name, void *op_data)
if (H5Tcommitted(type) > 0) {
H5Gget_objinfo(type, ".", TRUE, &statbuf);
- if (search_obj(info->type_table, statbuf.objno) == NULL) {
+ if (search_obj(info->type_table, statbuf.u.obj.objno) == NULL) {
char *type_name = HDstrdup(tmp);
- add_obj(info->type_table, statbuf.objno, type_name, FALSE);
+ add_obj(info->type_table, statbuf.u.obj.objno, type_name, FALSE);
} /* end if */
}
@@ -542,8 +542,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.objno)) == NULL)
- add_obj(info->type_table, statbuf.objno, tmp, TRUE);
+ if ((found_obj = search_obj(info->type_table, statbuf.u.obj.objno)) == NULL)
+ add_obj(info->type_table, statbuf.u.obj.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 e3578c9..5030e37 100644
--- a/tools/lib/h5trav.c
+++ b/tools/lib/h5trav.c
@@ -370,10 +370,10 @@ int traverse( hid_t loc_id,
inserted_objs++;
/* nlink is number of hard links to object */
- if (statbuf.nlink > 0 && trav_table_search(statbuf.objno, table ) == -1)
+ if (statbuf.u.obj.nlink > 0 && trav_table_search(statbuf.u.obj.objno, table ) == -1)
{
/* add object to table */
- trav_table_add(statbuf.objno, path, H5G_GROUP, table );
+ trav_table_add(statbuf.u.obj.objno, path, H5G_GROUP, table );
/* print it */
if (print)
@@ -385,9 +385,9 @@ int traverse( hid_t loc_id,
/* search table
group with more than one link to it */
- if (statbuf.nlink > 1)
+ if (statbuf.u.obj.nlink > 1)
{
- if ((j = trav_table_search(statbuf.objno, table )) < 0 )
+ if ((j = trav_table_search(statbuf.u.obj.objno, table )) < 0 )
return -1;
trav_table_addlink(table,j,path);
@@ -418,10 +418,10 @@ int traverse( hid_t loc_id,
inserted_objs++;
/* nlink is number of hard links to object */
- if (statbuf.nlink > 0 && trav_table_search(statbuf.objno, table ) == -1)
+ if (statbuf.u.obj.nlink > 0 && trav_table_search(statbuf.u.obj.objno, table ) == -1)
{
/* add object to table */
- trav_table_add(statbuf.objno, path, H5G_DATASET, table );
+ trav_table_add(statbuf.u.obj.objno, path, H5G_DATASET, table );
/* print it */
if (print)
@@ -430,9 +430,9 @@ int traverse( hid_t loc_id,
/* search table
dataset with more than one link to it */
- if (statbuf.nlink > 1)
+ if (statbuf.u.obj.nlink > 1)
{
- if ((j = trav_table_search(statbuf.objno, table )) < 0 )
+ if ((j = trav_table_search(statbuf.u.obj.objno, table )) < 0 )
return -1;
trav_table_addlink(table,j,path);
@@ -463,10 +463,10 @@ int traverse( hid_t loc_id,
inserted_objs++;
/* nlink is number of hard links to object */
- if (statbuf.nlink > 0 && trav_table_search(statbuf.objno, table ) == -1)
+ if (statbuf.u.obj.nlink > 0 && trav_table_search(statbuf.u.obj.objno, table ) == -1)
{
/* add object to table */
- trav_table_add(statbuf.objno, path, H5G_TYPE, table );
+ trav_table_add(statbuf.u.obj.objno, path, H5G_TYPE, table );
/* print it */
if (print)
@@ -489,12 +489,12 @@ int traverse( hid_t loc_id,
inserted_objs++;
/* add object to table */
- trav_table_add(statbuf.objno, path, H5G_LINK, table );
+ trav_table_add(statbuf.u.obj.objno, path, H5G_LINK, table );
- if (statbuf.linklen>0)
+ if (statbuf.u.slink.linklen>0)
{
- targbuf=malloc(statbuf.linklen);
- H5Gget_linkval(loc_id,path,statbuf.linklen,targbuf);
+ targbuf=malloc(statbuf.u.slink.linklen);
+ H5Gget_linkval(loc_id,path,statbuf.u.slink.linklen,targbuf);
if (print)
printf(" %-10s %s -> %s\n", "link", path, targbuf);
if (targbuf)