summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJerome Soumagne <jsoumagne@hdfgroup.org>2019-05-22 18:29:09 (GMT)
committerJerome Soumagne <jsoumagne@hdfgroup.org>2019-05-23 18:48:04 (GMT)
commit982ed75720d7dece10623868cda22c46908baebe (patch)
tree7fecdb7e207a9637d149844d7a5383b0d55a7985
parent6eaef5ebd61b8019f66f51d3fe74ec3c1b1d4f0f (diff)
downloadhdf5-982ed75720d7dece10623868cda22c46908baebe.zip
hdf5-982ed75720d7dece10623868cda22c46908baebe.tar.gz
hdf5-982ed75720d7dece10623868cda22c46908baebe.tar.bz2
Rename H5VL_ID_GET_NAME to H5VL_OBJECT_GET_NAME
Implement native H5VL_OBJECT_GET_NAME by addr
-rw-r--r--src/H5I.c2
-rw-r--r--src/H5VLnative_object.c25
-rw-r--r--src/H5VLpublic.h2
-rw-r--r--src/H5trace.c4
4 files changed, 24 insertions, 9 deletions
diff --git a/src/H5I.c b/src/H5I.c
index 93c9e98..87ff04a 100644
--- a/src/H5I.c
+++ b/src/H5I.c
@@ -2186,7 +2186,7 @@ H5Iget_name(hid_t id, char *name/*out*/, size_t size)
loc_params.obj_type = H5I_get_type(id);
/* Retrieve object's name */
- if(H5VL_object_get(vol_obj, &loc_params, H5VL_ID_GET_NAME, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value, name, size) < 0)
+ if(H5VL_object_get(vol_obj, &loc_params, H5VL_OBJECT_GET_NAME, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value, name, size) < 0)
HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, (-1), "can't retrieve object name")
done:
diff --git a/src/H5VLnative_object.c b/src/H5VLnative_object.c
index 0b1d73a..de2a8a5 100644
--- a/src/H5VLnative_object.c
+++ b/src/H5VLnative_object.c
@@ -213,17 +213,32 @@ H5VL__native_object_get(void *obj, const H5VL_loc_params_t *loc_params, H5VL_obj
break;
}
- /* H5Iget_name */
- case H5VL_ID_GET_NAME:
+ /* Object name */
+ case H5VL_OBJECT_GET_NAME:
{
ssize_t *ret = HDva_arg(arguments, ssize_t *);
char *name = HDva_arg(arguments, char *);
size_t size = HDva_arg(arguments, size_t);
- /* Retrieve object's name */
- if((*ret = H5G_get_name(&loc, name, size, NULL)) < 0)
- HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, FAIL, "can't retrieve object name")
+ if(loc_params->type == H5VL_OBJECT_BY_SELF) {
+ /* Retrieve object's name */
+ if((*ret = H5G_get_name(&loc, name, size, NULL)) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't retrieve object name")
+ } /* end if */
+ else if(loc_params->type == H5VL_OBJECT_BY_ADDR) {
+ H5O_loc_t obj_oloc; /* Object location */
+
+ /* Initialize the object location */
+ H5O_loc_reset(&obj_oloc);
+ obj_oloc.file = loc.oloc->file;
+ obj_oloc.addr = loc_params->loc_data.loc_by_addr.addr;
+ /* Retrieve object's name */
+ if((*ret = H5G_get_name_by_addr(loc.oloc->file, &obj_oloc, name, size)) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't determine object name")
+ } /* end else-if */
+ else
+ HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "unknown get_name parameters")
break;
}
diff --git a/src/H5VLpublic.h b/src/H5VLpublic.h
index 45fd022..ebe424a 100644
--- a/src/H5VLpublic.h
+++ b/src/H5VLpublic.h
@@ -146,7 +146,7 @@ typedef enum H5VL_object_get_t {
H5VL_REF_GET_NAME, /* object name, for reference */
H5VL_REF_GET_REGION, /* dataspace of region */
H5VL_REF_GET_TYPE, /* type of object */
- H5VL_ID_GET_NAME /* object name, for hid_t */
+ H5VL_OBJECT_GET_NAME /* object name */
} H5VL_object_get_t;
/* types for object SPECIFIC callback */
diff --git a/src/H5trace.c b/src/H5trace.c
index 23f2f1d..851ec73 100644
--- a/src/H5trace.c
+++ b/src/H5trace.c
@@ -2905,8 +2905,8 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case H5VL_REF_GET_NAME:
HDfprintf(out, "H5VL_REF_GET_NAME");
break;
- case H5VL_ID_GET_NAME:
- HDfprintf(out, "H5VL_ID_GET_NAME");
+ case H5VL_OBJECT_GET_NAME:
+ HDfprintf(out, "H5VL_OBJECT_GET_NAME");
break;
default:
HDfprintf(out, "%ld", (long)get);