summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/H5G.c35
-rw-r--r--src/H5Gpublic.h13
-rw-r--r--src/H5R.c23
3 files changed, 44 insertions, 27 deletions
diff --git a/src/H5G.c b/src/H5G.c
index a606574..4ad8593 100644
--- a/src/H5G.c
+++ b/src/H5G.c
@@ -2284,23 +2284,9 @@ H5G_get_objinfo_cb(H5G_loc_t *grp_loc/*in*/, const char UNUSED *name, const H5O_
/* Common code to retrieve the file's fileno */
/* (Use the object location's file info, if it's available) */
- if(H5F_get_fileno((obj_loc ? obj_loc : grp_loc)->oloc->file, &statbuf->fileno) < 0)
+ if(H5F_get_fileno((obj_loc ? obj_loc : grp_loc)->oloc->file, &statbuf->fileno[0]) < 0)
HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "unable to read fileno")
- /* Get common info from link */
- if(lnk != NULL) {
- statbuf->cset = lnk->cset;
- statbuf->ctime = lnk->ctime;
- } /* end if */
- else {
- /* lookup must be on '.' */
- HDassert(HDstrcmp(name, ".") == 0);
-
- /* Set "fake" hard link info */
- statbuf->cset = H5T_CSET_ASCII;
- statbuf->ctime = 0;
- } /* end else */
-
/* Get info for soft link */
/* (If we don't follow the link, we can retrieve info about the soft link itself) */
if(!udata->follow_link && lnk && lnk->type == H5G_LINK_SOFT) {
@@ -2308,7 +2294,7 @@ H5G_get_objinfo_cb(H5G_loc_t *grp_loc/*in*/, const char UNUSED *name, const H5O_
statbuf->type = H5G_LINK;
/* Get length of link value */
- statbuf->u.slink.linklen = HDstrlen(lnk->u.soft.name) + 1; /*count the null terminator*/
+ statbuf->linklen = HDstrlen(lnk->u.soft.name) + 1; /*count the null terminator*/
} /* end if */
/* Get info for hard link */
else {
@@ -2318,20 +2304,25 @@ H5G_get_objinfo_cb(H5G_loc_t *grp_loc/*in*/, const char UNUSED *name, const H5O_
H5E_clear_stack(NULL); /* clear any errors resulting from checking type */
/* Get basic info for object */
- statbuf->u.obj.objno = obj_loc->oloc->addr;
- statbuf->u.obj.nlink = H5O_link(obj_loc->oloc, 0, udata->dxpl_id);
+ statbuf->objno[0] = (unsigned long)(obj_loc->oloc->addr);
+#if H5_SIZEOF_UINT64_T > H5_SIZEOF_LONG
+ statbuf->objno[1] = (unsigned long)(obj_loc->oloc->addr >> 8 * sizeof(long));
+#else
+ statbuf->objno[1] = 0;
+#endif
+ statbuf->nlink = H5O_link(obj_loc->oloc, 0, udata->dxpl_id);
/* Get creation time for object */
- if(NULL == H5O_read(obj_loc->oloc, H5O_MTIME_ID, 0, &(statbuf->u.obj.mtime), udata->dxpl_id)) {
+ if(NULL == H5O_read(obj_loc->oloc, H5O_MTIME_ID, 0, &(statbuf->mtime), udata->dxpl_id)) {
H5E_clear_stack(NULL);
- if(NULL == H5O_read(obj_loc->oloc, H5O_MTIME_NEW_ID, 0, &(statbuf->u.obj.mtime), udata->dxpl_id)) {
+ if(NULL == H5O_read(obj_loc->oloc, H5O_MTIME_NEW_ID, 0, &(statbuf->mtime), udata->dxpl_id)) {
H5E_clear_stack(NULL);
- statbuf->u.obj.mtime = 0;
+ statbuf->mtime = 0;
} /* end if */
} /* end if */
/* Get object header information */
- if(H5O_get_info(obj_loc->oloc, &(statbuf->u.obj.ohdr), udata->dxpl_id) < 0)
+ if(H5O_get_info(obj_loc->oloc, &(statbuf->ohdr), udata->dxpl_id) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "unable to get object header information")
} /* end else */
} /* end if */
diff --git a/src/H5Gpublic.h b/src/H5Gpublic.h
index 0a264e5..361c85d 100644
--- a/src/H5Gpublic.h
+++ b/src/H5Gpublic.h
@@ -69,6 +69,7 @@ typedef enum H5G_obj_t {
#define H5G_NUSERTYPES (H5G_NTYPES-H5G_NLIBTYPES)
#define H5G_USERTYPE(X) (8+(X)) /* User defined types */
+#ifdef QAK
/* Information about an object */
typedef struct H5G_obj_stat_t {
haddr_t objno; /* Object number */
@@ -91,6 +92,18 @@ typedef struct H5G_stat_t {
H5G_slink_stat_t slink; /* Information about symbolic links */
} u;
} H5G_stat_t;
+#else /* QAK */
+/* Information about an object */
+typedef struct H5G_stat_t {
+ unsigned long fileno[2]; /*file number */
+ unsigned long objno[2]; /*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 */
+ H5O_stat_t ohdr; /* Object header information */
+} H5G_stat_t;
+#endif /* QAK */
#define H5G_SAME_LOC 0
#define H5Glink(cur_loc_id, type, cur_name, new_name) \
diff --git a/src/H5R.c b/src/H5R.c
index 35f1313..0e06384 100644
--- a/src/H5R.c
+++ b/src/H5R.c
@@ -137,7 +137,10 @@ H5R_term_interface(void)
static herr_t
H5R_create(void *_ref, H5G_loc_t *loc, const char *name, H5R_type_t ref_type, H5S_t *space, hid_t dxpl_id)
{
- H5G_stat_t sb; /* Stat buffer for retrieving OID */
+ H5G_loc_t obj_loc; /* Group hier. location of object */
+ H5G_name_t path; /* Object group hier. path */
+ H5O_loc_t oloc; /* Object object location */
+ hbool_t obj_found = FALSE; /* Object location found */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT(H5R_create)
@@ -147,15 +150,22 @@ H5R_create(void *_ref, H5G_loc_t *loc, const char *name, H5R_type_t ref_type, H5
HDassert(name);
HDassert(ref_type > H5R_BADTYPE || ref_type < H5R_MAXTYPE);
- if(H5G_get_objinfo(loc, name, 0, &sb, dxpl_id) < 0)
- HGOTO_ERROR(H5E_REFERENCE, H5E_NOTFOUND, FAIL, "unable to stat object")
+ /* Set up object location to fill in */
+ obj_loc.oloc = &oloc;
+ obj_loc.path = &path;
+ H5G_loc_reset(&obj_loc);
+
+ /* Find the object */
+ if(H5G_loc_find(loc, name, &obj_loc, dxpl_id) < 0)
+ HGOTO_ERROR(H5E_REFERENCE, H5E_NOTFOUND, FAIL, "object not found")
+ obj_found = TRUE;
switch(ref_type) {
case H5R_OBJECT:
{
hobj_ref_t *ref = (hobj_ref_t *)_ref; /* Get pointer to correct type of reference struct */
- *ref=sb.u.obj.objno;
+ *ref = obj_loc.oloc->addr;
break;
}
@@ -202,7 +212,7 @@ H5R_create(void *_ref, H5G_loc_t *loc, const char *name, H5R_type_t ref_type, H5
/* Serialize information for dataset OID */
p = (uint8_t *)buf;
- H5F_addr_encode(loc->oloc->file, &p, sb.u.obj.objno);
+ H5F_addr_encode(loc->oloc->file, &p, obj_loc.oloc->addr);
/* Serialize the selection */
if(H5S_SELECT_SERIALIZE(space, p) < 0)
@@ -234,6 +244,9 @@ H5R_create(void *_ref, H5G_loc_t *loc, const char *name, H5R_type_t ref_type, H5
} /* end switch */
done:
+ if(obj_found)
+ H5G_loc_free(&obj_loc);
+
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5R_create() */