summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@lbl.gov>2020-02-28 22:11:14 (GMT)
committerQuincey Koziol <koziol@lbl.gov>2020-02-28 22:11:14 (GMT)
commitaeda2170af97d2354f14605d61f51635fa1e756c (patch)
treec42949aa50ce01810d6fa0dd670bc6027cc4a6f8
parent8c0d1b248a4c444dd14e151cbb2d07c6af77d5bc (diff)
parent9ac3f9526aeb0191eb36fc9eec4c63fa72a13697 (diff)
downloadhdf5-aeda2170af97d2354f14605d61f51635fa1e756c.zip
hdf5-aeda2170af97d2354f14605d61f51635fa1e756c.tar.gz
hdf5-aeda2170af97d2354f14605d61f51635fa1e756c.tar.bz2
Merge pull request #2420 in HDFFV/hdf5 from revise_get_offset_1_12 to hdf5_1_12
* commit '9ac3f9526aeb0191eb36fc9eec4c63fa72a13697': Switch the 'get offset' operation from a dataset 'get' callback to a [native] dataset 'optional' operation.
-rw-r--r--src/H5D.c2
-rw-r--r--src/H5VLconnector.h1
-rw-r--r--src/H5VLnative.h1
-rw-r--r--src/H5VLnative_dataset.c48
-rw-r--r--src/H5trace.c6
5 files changed, 21 insertions, 37 deletions
diff --git a/src/H5D.c b/src/H5D.c
index 178bb30..61a40df 100644
--- a/src/H5D.c
+++ b/src/H5D.c
@@ -598,7 +598,7 @@ H5Dget_offset(hid_t dset_id)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, HADDR_UNDEF, "invalid dataset identifier")
/* Get the offset */
- if(H5VL_dataset_get(vol_obj, H5VL_DATASET_GET_OFFSET, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0)
+ if(H5VL_dataset_optional(vol_obj, H5VL_NATIVE_DATASET_GET_OFFSET, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, HADDR_UNDEF, "unable to get offset")
done:
diff --git a/src/H5VLconnector.h b/src/H5VLconnector.h
index baa4cca..39d9b14 100644
--- a/src/H5VLconnector.h
+++ b/src/H5VLconnector.h
@@ -91,7 +91,6 @@ typedef int H5VL_attr_optional_t;
typedef enum H5VL_dataset_get_t {
H5VL_DATASET_GET_DAPL, /* access property list */
H5VL_DATASET_GET_DCPL, /* creation property list */
- H5VL_DATASET_GET_OFFSET, /* offset */
H5VL_DATASET_GET_SPACE, /* dataspace */
H5VL_DATASET_GET_SPACE_STATUS, /* space status */
H5VL_DATASET_GET_STORAGE_SIZE, /* storage size */
diff --git a/src/H5VLnative.h b/src/H5VLnative.h
index e1f3f93..b607abc 100644
--- a/src/H5VLnative.h
+++ b/src/H5VLnative.h
@@ -48,6 +48,7 @@
#define H5VL_NATIVE_DATASET_CHUNK_READ 6 /* H5Dchunk_read */
#define H5VL_NATIVE_DATASET_CHUNK_WRITE 7 /* H5Dchunk_write */
#define H5VL_NATIVE_DATASET_GET_VLEN_BUF_SIZE 8 /* H5Dvlen_get_buf_size */
+#define H5VL_NATIVE_DATASET_GET_OFFSET 9 /* H5Dget_offset */
/* Values for native VOL connector file optional VOL operations */
#define H5VL_NATIVE_FILE_CLEAR_ELINK_CACHE 0 /* H5Fclear_elink_file_cache */
diff --git a/src/H5VLnative_dataset.c b/src/H5VLnative_dataset.c
index bea2c50..8660e80 100644
--- a/src/H5VLnative_dataset.c
+++ b/src/H5VLnative_dataset.c
@@ -297,18 +297,6 @@ H5VL__native_dataset_get(void *obj, H5VL_dataset_get_t get_type,
break;
}
- /* H5Dget_offset */
- case H5VL_DATASET_GET_OFFSET:
- {
- haddr_t *ret = HDva_arg(arguments, haddr_t *);
-
- /* Set return value */
- *ret = H5D__get_offset(dset);
- if(!H5F_addr_defined(*ret))
- *ret = HADDR_UNDEF;
- break;
- }
-
default:
HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't get this type of information from dataset")
} /* end switch */
@@ -391,16 +379,17 @@ herr_t
H5VL__native_dataset_optional(void *obj, H5VL_dataset_optional_t optional_type,
hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req, va_list arguments)
{
- H5D_t *dset = NULL; /* Dataset */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5D_t *dset = (H5D_t *)obj; /* Dataset */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
+ /* Sanity checks */
+ HDassert(dset);
+
switch(optional_type) {
case H5VL_NATIVE_DATASET_FORMAT_CONVERT:
{ /* H5Dformat_convert */
- dset = (H5D_t *)obj;
-
switch(dset->shared->layout.type) {
case H5D_CHUNKED:
/* Convert the chunk indexing type to version 1 B-tree if not */
@@ -436,8 +425,6 @@ H5VL__native_dataset_optional(void *obj, H5VL_dataset_optional_t optional_type,
{ /* H5Dget_chunk_index_type */
H5D_chunk_index_t *idx_type = HDva_arg(arguments, H5D_chunk_index_t *);
- dset = (H5D_t *)obj;
-
/* Make sure the dataset is chunked */
if(H5D_CHUNKED != dset->shared->layout.type)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a chunked dataset")
@@ -453,8 +440,6 @@ H5VL__native_dataset_optional(void *obj, H5VL_dataset_optional_t optional_type,
hsize_t *offset = HDva_arg(arguments, hsize_t *);
hsize_t *chunk_nbytes = HDva_arg(arguments, hsize_t *);
- dset = (H5D_t *)obj;
-
/* Make sure the dataset is chunked */
if(H5D_CHUNKED != dset->shared->layout.type)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a chunked dataset")
@@ -472,8 +457,6 @@ H5VL__native_dataset_optional(void *obj, H5VL_dataset_optional_t optional_type,
hid_t space_id = HDva_arg(arguments, hid_t);
hsize_t *nchunks = HDva_arg(arguments, hsize_t *);
- dset = (H5D_t *)obj;
- HDassert(dset);
HDassert(dset->shared);
HDassert(dset->shared->space);
@@ -505,8 +488,6 @@ H5VL__native_dataset_optional(void *obj, H5VL_dataset_optional_t optional_type,
haddr_t *addr = HDva_arg(arguments, haddr_t *);
hsize_t *size = HDva_arg(arguments, hsize_t *);
- dset = (H5D_t *)obj;
- HDassert(dset);
HDassert(dset->shared);
HDassert(dset->shared->space);
@@ -534,8 +515,6 @@ H5VL__native_dataset_optional(void *obj, H5VL_dataset_optional_t optional_type,
haddr_t *addr = HDva_arg(arguments, haddr_t *);
hsize_t *size = HDva_arg(arguments, hsize_t *);
- dset = (H5D_t *)obj;
- HDassert(dset);
HDassert(dset->shared);
/* Make sure the dataset is chunked */
@@ -556,8 +535,6 @@ H5VL__native_dataset_optional(void *obj, H5VL_dataset_optional_t optional_type,
void *buf = HDva_arg(arguments, void *);
hsize_t offset_copy[H5O_LAYOUT_NDIMS]; /* Internal copy of chunk offset */
- dset = (H5D_t *)obj;
-
/* Check arguments */
if(NULL == dset->oloc.file)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "dataset is not associated with a file")
@@ -585,8 +562,6 @@ H5VL__native_dataset_optional(void *obj, H5VL_dataset_optional_t optional_type,
const void *buf = HDva_arg(arguments, const void *);
hsize_t offset_copy[H5O_LAYOUT_NDIMS]; /* Internal copy of chunk offset */
- dset = (H5D_t *)obj;
-
/* Check arguments */
if(NULL == dset->oloc.file)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "dataset is not associated with a file")
@@ -612,13 +587,22 @@ H5VL__native_dataset_optional(void *obj, H5VL_dataset_optional_t optional_type,
hid_t space_id = HDva_arg(arguments, hid_t);
hsize_t *size = HDva_arg(arguments, hsize_t *);
- dset = (H5D_t *)obj;
-
if(H5D__vlen_get_buf_size(dset, type_id, space_id, size) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get size of vlen buf needed")
break;
}
+ /* H5Dget_offset */
+ case H5VL_NATIVE_DATASET_GET_OFFSET:
+ {
+ haddr_t *ret = HDva_arg(arguments, haddr_t *);
+
+ /* Set return value */
+ *ret = H5D__get_offset(dset);
+ if(!H5F_addr_defined(*ret))
+ *ret = HADDR_UNDEF;
+ break;
+ }
default:
HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "invalid optional operation")
diff --git a/src/H5trace.c b/src/H5trace.c
index 8ef8fb5..26a59c7 100644
--- a/src/H5trace.c
+++ b/src/H5trace.c
@@ -2742,9 +2742,6 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case H5VL_DATASET_GET_STORAGE_SIZE:
HDfprintf(out, "H5VL_DATASET_GET_STORAGE_SIZE");
break;
- case H5VL_DATASET_GET_OFFSET:
- HDfprintf(out, "H5VL_DATASET_GET_OFFSET");
- break;
default:
HDfprintf(out, "%ld", (long)get);
break;
@@ -3272,6 +3269,9 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case H5VL_NATIVE_DATASET_GET_VLEN_BUF_SIZE:
HDfprintf(out, "H5VL_NATIVE_DATASET_GET_VLEN_BUF_SIZE");
break;
+ case H5VL_NATIVE_DATASET_GET_OFFSET:
+ HDfprintf(out, "H5VL_NATIVE_DATASET_GET_OFFSET");
+ break;
default:
HDfprintf(out, "%ld", (long)optional);
break;