mirror of
https://github.com/HDFGroup/hdf5.git
synced 2025-04-12 17:31:09 +08:00
[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
This commit is contained in:
parent
538d37a1bc
commit
fefbe61aca
@ -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 */
|
||||
|
||||
|
14
src/H5G.c
14
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 */
|
||||
|
@ -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
|
||||
|
@ -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)
|
||||
|
@ -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.");
|
||||
|
@ -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;
|
||||
|
12
test/mtime.c
12
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;
|
||||
|
14
test/tattr.c
14
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);
|
||||
|
32
test/tmisc.c
32
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);
|
||||
|
@ -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.");
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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,
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
|
@ -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
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user