summaryrefslogtreecommitdiffstats
path: root/tools/lib
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2006-04-14 22:21:54 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2006-04-14 22:21:54 (GMT)
commit2521c4084c06f078846fe06bb1d3cd7bfa506316 (patch)
tree466b9213c163d812778434bba2097705b423e799 /tools/lib
parent3468ff3a5c4f6c384801edef9ae52ecc4f2de3c5 (diff)
downloadhdf5-2521c4084c06f078846fe06bb1d3cd7bfa506316.zip
hdf5-2521c4084c06f078846fe06bb1d3cd7bfa506316.tar.gz
hdf5-2521c4084c06f078846fe06bb1d3cd7bfa506316.tar.bz2
[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)
Diffstat (limited to 'tools/lib')
-rw-r--r--tools/lib/h5diff.c8
-rw-r--r--tools/lib/h5tools_ref.c18
-rw-r--r--tools/lib/h5tools_str.c14
-rw-r--r--tools/lib/h5tools_utils.c20
-rw-r--r--tools/lib/h5trav.c29
5 files changed, 53 insertions, 36 deletions
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);