summaryrefslogtreecommitdiffstats
path: root/src/H5FDdirect.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/H5FDdirect.c')
-rw-r--r--src/H5FDdirect.c60
1 files changed, 59 insertions, 1 deletions
diff --git a/src/H5FDdirect.c b/src/H5FDdirect.c
index a6139da..66843e9 100644
--- a/src/H5FDdirect.c
+++ b/src/H5FDdirect.c
@@ -140,6 +140,8 @@ static herr_t H5FD__direct_truncate(H5FD_t *_file, hid_t dxpl_id, hbool_t closi
static herr_t H5FD__direct_lock(H5FD_t *_file, hbool_t rw);
static herr_t H5FD__direct_unlock(H5FD_t *_file);
static herr_t H5FD__direct_delete(const char *filename, hid_t fapl_id);
+static herr_t H5FD__direct_ctl(H5FD_t *_file, uint64_t op_code, uint64_t flags, const void *input,
+ void **output);
static const H5FD_class_t H5FD_direct_g = {
H5FD_DIRECT_VALUE, /* value */
@@ -175,7 +177,7 @@ static const H5FD_class_t H5FD_direct_g = {
H5FD__direct_lock, /* lock */
H5FD__direct_unlock, /* unlock */
H5FD__direct_delete, /* del */
- NULL, /* ctl */
+ H5FD__direct_ctl, /* ctl */
H5FD_FLMAP_DICHOTOMY /* fl_map */
};
@@ -1421,4 +1423,60 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5FD__direct_delete() */
+/*-------------------------------------------------------------------------
+ * Function: H5FD__direct_ctl
+ *
+ * Purpose: Direct VFD version of the ctl callback.
+ *
+ * The desired operation is specified by the op_code
+ * parameter.
+ *
+ * The flags parameter controls management of op_codes that
+ * are unknown to the callback
+ *
+ * The input and output parameters allow op_code specific
+ * input and output
+ *
+ * At present, the only op code supported is
+ * H5FD_CTL__GET_TERMINAL_VFD, which is used to obtain the
+ * instance of H5FD_t associated with the terminal
+ * VFD. This allows comparison of files whose terminal
+ * VFD may have overlying pass through VFDs.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Changes: None.
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5FD__direct_ctl(H5FD_t *_file, uint64_t op_code, uint64_t flags, const void H5_ATTR_UNUSED *input,
+ void **output)
+{
+ H5FD_direct_t *file = (H5FD_direct_t *)_file;
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_PACKAGE
+
+ /* Sanity checks */
+ HDassert(file);
+
+ switch (op_code) {
+
+ case H5FD_CTL__GET_TERMINAL_VFD:
+ HDassert(output);
+ *output = (void *)(file);
+ break;
+
+ /* Unknown op code */
+ default:
+ if (flags & H5FD_CTL__FAIL_IF_UNKNOWN_FLAG)
+ HGOTO_ERROR(H5E_VFL, H5E_FCNTL, FAIL, "unknown op_code and fail if unknown flag is set")
+ break;
+ }
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5FD__direct_ctl() */
+
#endif /* H5_HAVE_DIRECT */