summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@koziol.gov>2019-08-23 21:54:52 (GMT)
committerJerome Soumagne <jsoumagne@hdfgroup.org>2019-10-08 20:18:42 (GMT)
commitb571cf6c3851357d86cd5a231351d75177af29a4 (patch)
treec45720e47289f2ccf585119c8335148712304468
parent1b766420f1c5064b0ad2f126c6d62cba8373564f (diff)
downloadhdf5-b571cf6c3851357d86cd5a231351d75177af29a4.zip
hdf5-b571cf6c3851357d86cd5a231351d75177af29a4.tar.gz
hdf5-b571cf6c3851357d86cd5a231351d75177af29a4.tar.bz2
Adapt Jerome's "file info" H5VL 'get' query to retrieve container token info.
Remove "by address" location for VOL operations. (Switching to "by token")
-rw-r--r--src/H5Fpkg.h1
-rw-r--r--src/H5Fquery.c38
-rw-r--r--src/H5O.c4
-rw-r--r--src/H5Tvlen.c7
-rw-r--r--src/H5VLconnector.h55
-rw-r--r--src/H5VLnative_file.c86
-rw-r--r--src/H5VLnative_object.c16
-rw-r--r--src/H5trace.c9
8 files changed, 135 insertions, 81 deletions
diff --git a/src/H5Fpkg.h b/src/H5Fpkg.h
index 6a5c62f..4b5b788 100644
--- a/src/H5Fpkg.h
+++ b/src/H5Fpkg.h
@@ -411,6 +411,7 @@ H5_DLL herr_t H5F__close(H5F_t *f);
H5_DLL herr_t H5F__set_libver_bounds(H5F_t *f, H5F_libver_t low, H5F_libver_t high);
H5_DLL H5F_t *H5F__get_file(void *obj, H5I_type_t type);
H5_DLL hid_t H5F__get_file_id(H5F_t *file, hbool_t app_ref);
+H5_DLL herr_t H5F__get_cont_info(const H5F_t *f, H5VL_file_cont_info_t *info);
/* File mount related routines */
H5_DLL herr_t H5F__mount(H5G_loc_t *loc, const char *name, H5F_t *child, hid_t plist_id);
diff --git a/src/H5Fquery.c b/src/H5Fquery.c
index 69b042d..32743c4 100644
--- a/src/H5Fquery.c
+++ b/src/H5Fquery.c
@@ -1304,3 +1304,41 @@ H5F_get_vol_cls(const H5F_t *f)
FUNC_LEAVE_NOAPI(f->shared->vol_cls)
} /* end H5F_get_vol_cls */
+
+/*-------------------------------------------------------------------------
+ * Function: H5F_get_cont_info
+ *
+ * Purpose: Get the VOL container info for the file
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ * Programmer: Quincey Koziol
+ * Saturday, August 17, 2019
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5F__get_cont_info(const H5F_t *f, H5VL_file_cont_info_t *info)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_PACKAGE
+
+ /* Sanity checks */
+ HDassert(f);
+ HDassert(f->shared);
+
+ /* Verify structure version */
+ if(info->version != H5VL_CONTAINER_INFO_VERSION)
+ HGOTO_ERROR(H5E_FILE, H5E_VERSION, FAIL, "wrong container info version #")
+
+ /* Set the container info fields */
+ info->feature_flags = 0; /* None currently defined */
+ info->token_size = H5F_SIZEOF_ADDR(f);
+ info->blob_id_size = H5HG_HEAP_ID_SIZE(f);
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5F_get_cont_info */
+
diff --git a/src/H5O.c b/src/H5O.c
index bf2d799..e1d0751 100644
--- a/src/H5O.c
+++ b/src/H5O.c
@@ -263,8 +263,8 @@ H5Oopen_by_addr(hid_t loc_id, haddr_t addr)
FUNC_ENTER_API(H5I_INVALID_HID)
H5TRACE2("i", "ia", loc_id, addr);
- loc_params.type = H5VL_OBJECT_BY_ADDR;
- loc_params.loc_data.loc_by_addr.addr = addr;
+ loc_params.type = H5VL_OBJECT_BY_TOKEN;
+ loc_params.loc_data.loc_by_token.token = &addr;
loc_params.obj_type = H5I_get_type(loc_id);
/* Get the location object */
diff --git a/src/H5Tvlen.c b/src/H5Tvlen.c
index 939a26d..9f82340 100644
--- a/src/H5Tvlen.c
+++ b/src/H5Tvlen.c
@@ -818,20 +818,17 @@ static herr_t
H5T__vlen_disk_getlen(H5F_t H5_ATTR_UNUSED *f, const void *_vl, size_t *seq_len)
{
const uint8_t *vl = (const uint8_t *)_vl; /* Pointer to the user's hvl_t information */
- herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_STATIC
+ FUNC_ENTER_STATIC_NOERR
/* Check parameters */
- HDassert(f);
HDassert(vl);
HDassert(seq_len);
/* Get length of sequence (different from blob size) */
UINT32DECODE(vl, *seq_len);
-done:
- FUNC_LEAVE_NOAPI(ret_value)
+ FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5T__vlen_disk_getlen() */
diff --git a/src/H5VLconnector.h b/src/H5VLconnector.h
index 1221d88..5ab1402 100644
--- a/src/H5VLconnector.h
+++ b/src/H5VLconnector.h
@@ -37,6 +37,9 @@
#define H5VL_CAP_FLAG_NONE 0 /* No special connector capabilities */
#define H5VL_CAP_FLAG_THREADSAFE 0x01 /* Connector is threadsafe */
+/* Container info version */
+#define H5VL_CONTAINER_INFO_VERSION 0x01 /* Container info struct version */
+
/* The maximum size allowed for blobs */
#define H5VL_MAX_BLOB_ID_SIZE (16) /* Allow for 128-bits blob IDs */
@@ -94,10 +97,11 @@ typedef enum H5VL_datatype_specific_t {
/* types for file GET callback */
typedef enum H5VL_file_get_t {
+ H5VL_FILE_GET_CONT_INFO, /* file get container info */
H5VL_FILE_GET_FAPL, /* file access property list */
H5VL_FILE_GET_FCPL, /* file creation property list */
- H5VL_FILE_GET_INTENT, /* file intent */
H5VL_FILE_GET_FILENO, /* file number */
+ H5VL_FILE_GET_INTENT, /* file intent */
H5VL_FILE_GET_NAME, /* file name */
H5VL_FILE_GET_OBJ_COUNT, /* object count in file */
H5VL_FILE_GET_OBJ_IDS /* object ids in file */
@@ -179,56 +183,67 @@ typedef enum H5VL_blob_specific_t {
H5VL_BLOB_SETNULL /* Set a blob ID to the connector's "null" blob ID value */
} H5VL_blob_specific_t;
-/* types for different ways that objects are located in an HDF5 container */
+/* Types for different ways that objects are located in an HDF5 container */
typedef enum H5VL_loc_type_t {
H5VL_OBJECT_BY_SELF,
H5VL_OBJECT_BY_NAME,
H5VL_OBJECT_BY_IDX,
- H5VL_OBJECT_BY_ADDR,
- H5VL_OBJECT_BY_REF
+ H5VL_OBJECT_BY_REF,
+ H5VL_OBJECT_BY_TOKEN
} H5VL_loc_type_t;
-struct H5VL_loc_by_name {
+typedef struct H5VL_loc_by_name {
const char *name;
hid_t lapl_id;
-};
+} H5VL_loc_by_name_t;
-struct H5VL_loc_by_idx {
+typedef struct H5VL_loc_by_idx {
const char *name;
H5_index_t idx_type;
H5_iter_order_t order;
hsize_t n;
hid_t lapl_id;
-};
-
-struct H5VL_loc_by_addr {
- haddr_t addr;
-};
+} H5VL_loc_by_idx_t;
-struct H5VL_loc_by_ref {
+typedef struct H5VL_loc_by_ref {
H5R_type_t ref_type;
const void *_ref;
hid_t lapl_id;
-};
+} H5VL_loc_by_ref_t;
+
+typedef struct H5VL_loc_by_token {
+ void *token;
+} H5VL_loc_by_token_t;
/* Structure to hold parameters for object locations.
- * either: BY_ADDR, BY_ID, BY_NAME, BY_IDX, BY_REF
+ * Either: BY_SELF, BY_NAME, BY_IDX, BY_REF, BY_TOKEN
*
- * Note: Leave loc_by_addr as the first union member so we
+ * Note: Leave loc_by_token as the first union member so we
* can perform the simplest initialization of the struct
* without raising warnings.
+ *
+ * Note: BY_SELF requires no union members.
*/
typedef struct H5VL_loc_params_t {
H5I_type_t obj_type;
H5VL_loc_type_t type;
union{
- struct H5VL_loc_by_addr loc_by_addr;
- struct H5VL_loc_by_name loc_by_name;
- struct H5VL_loc_by_idx loc_by_idx;
- struct H5VL_loc_by_ref loc_by_ref;
+ H5VL_loc_by_token_t loc_by_token;
+ H5VL_loc_by_name_t loc_by_name;
+ H5VL_loc_by_idx_t loc_by_idx;
+ H5VL_loc_by_ref_t loc_by_ref;
} loc_data;
} H5VL_loc_params_t;
+/* Info for H5VL_FILE_GET_CONT_INFO */
+typedef struct H5VL_file_cont_info_t {
+ unsigned version; /* version information (keep first) */
+ uint64_t feature_flags; /* Container feature flags */
+ /* (none currently defined) */
+ size_t token_size; /* Size of tokens */
+ size_t blob_id_size; /* Size of blob IDs */
+} H5VL_file_cont_info_t;
+
/* VOL connector info fields & callbacks */
typedef struct H5VL_info_class_t {
size_t size; /* Size of the VOL info */
diff --git a/src/H5VLnative_file.c b/src/H5VLnative_file.c
index 0ac70e3..9afb718 100644
--- a/src/H5VLnative_file.c
+++ b/src/H5VLnative_file.c
@@ -129,6 +129,18 @@ H5VL__native_file_get(void *obj, H5VL_file_get_t get_type,
FUNC_ENTER_PACKAGE
switch(get_type) {
+ /* "get container info" */
+ case H5VL_FILE_GET_CONT_INFO:
+ {
+ H5VL_file_cont_info_t *info = HDva_arg(arguments, H5VL_file_cont_info_t *);
+
+ /* Retrieve the file's container info */
+ if(H5F__get_cont_info((H5F_t *)obj, info) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't get file container info")
+
+ break;
+ }
+
/* H5Fget_access_plist */
case H5VL_FILE_GET_FAPL:
{
@@ -139,7 +151,7 @@ H5VL__native_file_get(void *obj, H5VL_file_get_t get_type,
/* Retrieve the file's access property list */
if((*plist_id = H5F_get_access_plist(f, TRUE)) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get file access property list")
+ HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't get file access property list")
if(NULL == (new_plist = (H5P_genplist_t *)H5I_object(*plist_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list")
@@ -163,42 +175,6 @@ H5VL__native_file_get(void *obj, H5VL_file_get_t get_type,
break;
}
- /* H5Fget_obj_count */
- case H5VL_FILE_GET_OBJ_COUNT:
- {
- unsigned types = HDva_arg(arguments, unsigned);
- ssize_t *ret = HDva_arg(arguments, ssize_t *);
- size_t obj_count = 0; /* Number of opened objects */
-
- f = (H5F_t *)obj;
- /* Perform the query */
- if(H5F_get_obj_count(f, types, TRUE, &obj_count) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_BADITER, FAIL, "H5F_get_obj_count failed")
-
- /* Set the return value */
- *ret = (ssize_t)obj_count;
- break;
- }
-
- /* H5Fget_obj_ids */
- case H5VL_FILE_GET_OBJ_IDS:
- {
- unsigned types = HDva_arg(arguments, unsigned);
- size_t max_objs = HDva_arg(arguments, size_t);
- hid_t *oid_list = HDva_arg(arguments, hid_t *);
- ssize_t *ret = HDva_arg(arguments, ssize_t *);
- size_t obj_count = 0; /* Number of opened objects */
-
- f = (H5F_t *)obj;
- /* Perform the query */
- if(H5F_get_obj_ids(f, types, max_objs, oid_list, TRUE, &obj_count) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_BADITER, FAIL, "H5F_get_obj_ids failed")
-
- /* Set the return value */
- *ret = (ssize_t)obj_count;
- break;
- }
-
/* H5Fget_intent */
case H5VL_FILE_GET_INTENT:
{
@@ -266,6 +242,42 @@ H5VL__native_file_get(void *obj, H5VL_file_get_t get_type,
break;
}
+ /* H5Fget_obj_count */
+ case H5VL_FILE_GET_OBJ_COUNT:
+ {
+ unsigned types = HDva_arg(arguments, unsigned);
+ ssize_t *ret = HDva_arg(arguments, ssize_t *);
+ size_t obj_count = 0; /* Number of opened objects */
+
+ f = (H5F_t *)obj;
+ /* Perform the query */
+ if(H5F_get_obj_count(f, types, TRUE, &obj_count) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_BADITER, FAIL, "H5F_get_obj_count failed")
+
+ /* Set the return value */
+ *ret = (ssize_t)obj_count;
+ break;
+ }
+
+ /* H5Fget_obj_ids */
+ case H5VL_FILE_GET_OBJ_IDS:
+ {
+ unsigned types = HDva_arg(arguments, unsigned);
+ size_t max_objs = HDva_arg(arguments, size_t);
+ hid_t *oid_list = HDva_arg(arguments, hid_t *);
+ ssize_t *ret = HDva_arg(arguments, ssize_t *);
+ size_t obj_count = 0; /* Number of opened objects */
+
+ f = (H5F_t *)obj;
+ /* Perform the query */
+ if(H5F_get_obj_ids(f, types, max_objs, oid_list, TRUE, &obj_count) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_BADITER, FAIL, "H5F_get_obj_ids failed")
+
+ /* Set the return value */
+ *ret = (ssize_t)obj_count;
+ break;
+ }
+
default:
HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't get this type of information")
} /* end switch */
diff --git a/src/H5VLnative_object.c b/src/H5VLnative_object.c
index de2a8a5..ef8918d 100644
--- a/src/H5VLnative_object.c
+++ b/src/H5VLnative_object.c
@@ -71,10 +71,10 @@ H5VL__native_object_open(void *obj, const H5VL_loc_params_t *loc_params, H5I_typ
break;
}
- case H5VL_OBJECT_BY_ADDR:
+ case H5VL_OBJECT_BY_TOKEN:
{
/* Open the object */
- if(NULL == (ret_value = H5O_open_by_addr(&loc, loc_params->loc_data.loc_by_addr.addr, opened_type)))
+ if(NULL == (ret_value = H5O_open_by_addr(&loc, *(haddr_t *)loc_params->loc_data.loc_by_token.token, opened_type)))
HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, NULL, "unable to open object by address")
break;
}
@@ -225,18 +225,6 @@ H5VL__native_object_get(void *obj, const H5VL_loc_params_t *loc_params, H5VL_obj
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/H5trace.c b/src/H5trace.c
index a167d43..fe2d622 100644
--- a/src/H5trace.c
+++ b/src/H5trace.c
@@ -2754,18 +2754,21 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
H5VL_file_get_t get = (H5VL_file_get_t)HDva_arg(ap, int);
switch(get) {
+ case H5VL_FILE_GET_CONT_INFO:
+ HDfprintf(out, "H5VL_FILE_GET_CONT_INFO");
+ break;
case H5VL_FILE_GET_FAPL:
HDfprintf(out, "H5VL_FILE_GET_FAPL");
break;
case H5VL_FILE_GET_FCPL:
HDfprintf(out, "H5VL_FILE_GET_FCPL");
break;
- case H5VL_FILE_GET_INTENT:
- HDfprintf(out, "H5VL_FILE_GET_INTENT");
- break;
case H5VL_FILE_GET_FILENO:
HDfprintf(out, "H5VL_FILE_GET_FILENO");
break;
+ case H5VL_FILE_GET_INTENT:
+ HDfprintf(out, "H5VL_FILE_GET_INTENT");
+ break;
case H5VL_FILE_GET_NAME:
HDfprintf(out, "H5VL_FILE_GET_NAME");
break;