summaryrefslogtreecommitdiffstats
path: root/tools
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 /tools
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
Diffstat (limited to 'tools')
-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
9 files changed, 63 insertions, 63 deletions
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)