summaryrefslogtreecommitdiffstats
path: root/src
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 /src
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 'src')
-rw-r--r--src/H5G.c14
-rw-r--r--src/H5Gpublic.h24
-rw-r--r--src/H5R.c4
3 files changed, 26 insertions, 16 deletions
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)