summaryrefslogtreecommitdiffstats
path: root/src/H5VLnative_object.c
diff options
context:
space:
mode:
authorkmu <kmu@hdfgroup.org>2020-01-23 03:30:36 (GMT)
committerkmu <kmu@hdfgroup.org>2020-01-23 03:30:36 (GMT)
commit2de0ce0d8ba2fb58fadefc5d718a3c0fedab25c8 (patch)
tree795739e979593ab3b0d0d3b4a6124c1f7049ab50 /src/H5VLnative_object.c
parent408b9b1f3b8e84ba090c51e665d38eedef32c7ee (diff)
parentd7414053638316081f11fad78474b2c3cde336c5 (diff)
downloadhdf5-2de0ce0d8ba2fb58fadefc5d718a3c0fedab25c8.zip
hdf5-2de0ce0d8ba2fb58fadefc5d718a3c0fedab25c8.tar.gz
hdf5-2de0ce0d8ba2fb58fadefc5d718a3c0fedab25c8.tar.bz2
merge and fix conflict
Diffstat (limited to 'src/H5VLnative_object.c')
-rw-r--r--src/H5VLnative_object.c179
1 files changed, 118 insertions, 61 deletions
diff --git a/src/H5VLnative_object.c b/src/H5VLnative_object.c
index 6a22b05..3a29b6c 100644
--- a/src/H5VLnative_object.c
+++ b/src/H5VLnative_object.c
@@ -72,11 +72,12 @@ H5VL__native_object_open(void *obj, const H5VL_loc_params_t *loc_params, H5I_typ
case H5VL_OBJECT_BY_TOKEN:
{
- const uint8_t *p = (const uint8_t *)loc_params->loc_data.loc_by_token.token;
+ H5O_token_t token = *loc_params->loc_data.loc_by_token.token;
haddr_t addr;
/* Decode token */
- H5F_addr_decode(loc.oloc->file, &p, &addr);
+ if(H5VL_native_token_to_addr(loc.oloc->file, H5I_FILE, token, &addr) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTUNSERIALIZE, NULL, "can't deserialize object token into address")
/* Open the object */
if(NULL == (ret_value = H5O_open_by_addr(&loc, addr, opened_type)))
@@ -184,13 +185,15 @@ H5VL__native_object_get(void *obj, const H5VL_loc_params_t *loc_params, H5VL_obj
} /* end if */
else if(loc_params->type == H5VL_OBJECT_BY_TOKEN) {
H5O_loc_t obj_oloc; /* Object location */
- const uint8_t *p = (const uint8_t *)loc_params->loc_data.loc_by_token.token;
+ H5O_token_t token = *loc_params->loc_data.loc_by_token.token;
/* Initialize the object location */
H5O_loc_reset(&obj_oloc);
obj_oloc.file = loc.oloc->file;
+
/* Decode token */
- H5F_addr_decode(obj_oloc.file, &p, &obj_oloc.addr);
+ if(H5VL_native_token_to_addr(obj_oloc.file, H5I_FILE, token, &obj_oloc.addr) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTUNSERIALIZE, FAIL, "can't deserialize object token into address")
/* Retrieve object's name */
if((*ret = H5G_get_name_by_addr(loc.oloc->file, &obj_oloc, name, size)) < 0)
@@ -209,13 +212,15 @@ H5VL__native_object_get(void *obj, const H5VL_loc_params_t *loc_params, H5VL_obj
if(loc_params->type == H5VL_OBJECT_BY_TOKEN) {
H5O_loc_t obj_oloc; /* Object location */
unsigned rc; /* Reference count of object */
- const uint8_t *p = (const uint8_t *)loc_params->loc_data.loc_by_token.token;
+ H5O_token_t token = *loc_params->loc_data.loc_by_token.token;
/* Initialize the object location */
H5O_loc_reset(&obj_oloc);
obj_oloc.file = loc.oloc->file;
+
/* Decode token */
- H5F_addr_decode(obj_oloc.file, &p, &obj_oloc.addr);
+ if(H5VL_native_token_to_addr(obj_oloc.file, H5I_FILE, token, &obj_oloc.addr) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTUNSERIALIZE, FAIL, "can't deserialize object token into address")
/* Get the # of links for object, and its type */
/* (To check to make certain that this object hasn't been deleted) */
@@ -226,6 +231,56 @@ H5VL__native_object_get(void *obj, const H5VL_loc_params_t *loc_params, H5VL_obj
break;
}
+ /* H5Oget_info(_name|_by_idx)3 */
+ case H5VL_OBJECT_GET_INFO:
+ {
+ H5O_info2_t *oinfo = HDva_arg(arguments, H5O_info2_t *);
+ unsigned fields = HDva_arg(arguments, unsigned);
+
+ /* Use the original H5Oget_info code to get the data */
+
+ if(loc_params->type == H5VL_OBJECT_BY_SELF) { /* H5Oget_info */
+ /* Retrieve the object's information */
+ if(H5G_loc_info(&loc, ".", oinfo, fields) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "object not found")
+ } /* end if */
+ else if(loc_params->type == H5VL_OBJECT_BY_NAME) { /* H5Oget_info_by_name */
+ /* Retrieve the object's information */
+ if(H5G_loc_info(&loc, loc_params->loc_data.loc_by_name.name, oinfo, fields) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "object not found")
+ } /* end else-if */
+ else if(loc_params->type == H5VL_OBJECT_BY_IDX) { /* H5Oget_info_by_idx */
+ H5G_loc_t obj_loc; /* Location used to open group */
+ H5G_name_t obj_path; /* Opened object group hier. path */
+ H5O_loc_t obj_oloc; /* Opened object object location */
+
+ /* Set up opened group location to fill in */
+ obj_loc.oloc = &obj_oloc;
+ obj_loc.path = &obj_path;
+ H5G_loc_reset(&obj_loc);
+
+ /* Find the object's location, according to the order in the index */
+ if(H5G_loc_find_by_idx(&loc, loc_params->loc_data.loc_by_idx.name,
+ loc_params->loc_data.loc_by_idx.idx_type,
+ loc_params->loc_data.loc_by_idx.order,
+ loc_params->loc_data.loc_by_idx.n, &obj_loc/*out*/) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "group not found")
+
+ /* Retrieve the object's information */
+ if(H5O_get_info(obj_loc.oloc, oinfo, fields) < 0) {
+ H5G_loc_free(&obj_loc);
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't retrieve object info")
+ } /* end if */
+
+ /* Release the object location */
+ if(H5G_loc_free(&obj_loc) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTRELEASE, FAIL, "can't free location")
+ } /* end else-if */
+ else
+ HGOTO_ERROR(H5E_OHDR, H5E_UNSUPPORTED, FAIL, "unknown get info parameters")
+ break;
+ }
+
default:
HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't get this type of information from object")
} /* end switch */
@@ -287,7 +342,7 @@ H5VL__native_object_specific(void *obj, const H5VL_loc_params_t *loc_params, H5V
/* Lookup object */
case H5VL_OBJECT_LOOKUP:
{
- H5VL_token_t *token = va_arg(arguments, H5VL_token_t *);
+ H5O_token_t *token = va_arg(arguments, H5O_token_t *);
HDassert(token);
@@ -295,7 +350,6 @@ H5VL__native_object_specific(void *obj, const H5VL_loc_params_t *loc_params, H5V
H5G_loc_t obj_loc; /* Group hier. location of object */
H5G_name_t obj_path; /* Object group hier. path */
H5O_loc_t obj_oloc; /* Object object location */
- uint8_t *p = (uint8_t *)token; /* Pointer to token */
/* Set up opened group location to fill in */
obj_loc.oloc = &obj_oloc;
@@ -307,7 +361,8 @@ H5VL__native_object_specific(void *obj, const H5VL_loc_params_t *loc_params, H5V
HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "object not found")
/* Encode token */
- H5F_addr_encode(obj_oloc.file, &p, obj_loc.oloc->addr);
+ if(H5VL_native_addr_to_token(loc.oloc->file, H5I_FILE, obj_loc.oloc->addr, token) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTSERIALIZE, FAIL, "can't serialize address into object token")
/* Release the object location */
if(H5G_loc_free(&obj_loc) < 0)
@@ -322,7 +377,7 @@ H5VL__native_object_specific(void *obj, const H5VL_loc_params_t *loc_params, H5V
{
H5_index_t idx_type = (H5_index_t)HDva_arg(arguments, int); /* enum work-around */
H5_iter_order_t order = (H5_iter_order_t)HDva_arg(arguments, int); /* enum work-around */
- H5O_iterate_t op = HDva_arg(arguments, H5O_iterate_t);
+ H5O_iterate2_t op = HDva_arg(arguments, H5O_iterate2_t);
void *op_data = HDva_arg(arguments, void *);
unsigned fields = HDva_arg(arguments, unsigned);
@@ -384,10 +439,9 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5VL__native_object_optional(void *obj, hid_t H5_ATTR_UNUSED dxpl_id,
- void H5_ATTR_UNUSED **req, va_list arguments)
+H5VL__native_object_optional(void *obj, H5VL_object_optional_t optional_type,
+ hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req, va_list arguments)
{
- H5VL_native_object_optional_t optional_type = HDva_arg(arguments, H5VL_native_object_optional_t);
H5VL_loc_params_t *loc_params = HDva_arg(arguments, H5VL_loc_params_t *);
H5G_loc_t loc; /* Location of group */
herr_t ret_value = SUCCEED; /* Return value */
@@ -398,54 +452,6 @@ H5VL__native_object_optional(void *obj, hid_t H5_ATTR_UNUSED dxpl_id,
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object")
switch(optional_type) {
- /* H5Oget_info / H5Oget_info_by_name / H5Oget_info_by_idx */
- case H5VL_NATIVE_OBJECT_GET_INFO:
- {
- H5O_info_t *obj_info = HDva_arg(arguments, H5O_info_t *);
- unsigned fields = HDva_arg(arguments, unsigned);
-
- if(loc_params->type == H5VL_OBJECT_BY_SELF) { /* H5Oget_info */
- /* Retrieve the object's information */
- if(H5G_loc_info(&loc, ".", obj_info, fields) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "object not found")
- } /* end if */
- else if(loc_params->type == H5VL_OBJECT_BY_NAME) { /* H5Oget_info_by_name */
- /* Retrieve the object's information */
- if(H5G_loc_info(&loc, loc_params->loc_data.loc_by_name.name, obj_info, fields) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "object not found")
- } /* end else-if */
- else if(loc_params->type == H5VL_OBJECT_BY_IDX) { /* H5Oget_info_by_idx */
- H5G_loc_t obj_loc; /* Location used to open group */
- H5G_name_t obj_path; /* Opened object group hier. path */
- H5O_loc_t obj_oloc; /* Opened object object location */
-
- /* Set up opened group location to fill in */
- obj_loc.oloc = &obj_oloc;
- obj_loc.path = &obj_path;
- H5G_loc_reset(&obj_loc);
-
- /* Find the object's location, according to the order in the index */
- if(H5G_loc_find_by_idx(&loc, loc_params->loc_data.loc_by_idx.name,
- loc_params->loc_data.loc_by_idx.idx_type,
- loc_params->loc_data.loc_by_idx.order,
- loc_params->loc_data.loc_by_idx.n, &obj_loc/*out*/) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "group not found")
-
- /* Retrieve the object's information */
- if(H5O_get_info(obj_loc.oloc, obj_info, fields) < 0) {
- H5G_loc_free(&obj_loc);
- HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't retrieve object info")
- } /* end if */
-
- /* Release the object location */
- if(H5G_loc_free(&obj_loc) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTRELEASE, FAIL, "can't free location")
- } /* end else-if */
- else
- HGOTO_ERROR(H5E_OHDR, H5E_UNSUPPORTED, FAIL, "unknown get info parameters")
- break;
- }
-
/* H5Oget_comment / H5Oget_comment_by_name */
case H5VL_NATIVE_OBJECT_GET_COMMENT:
{
@@ -521,6 +527,57 @@ H5VL__native_object_optional(void *obj, hid_t H5_ATTR_UNUSED dxpl_id,
break;
}
+ /* H5Oget_native_info(_name|_by_idx) */
+ case H5VL_NATIVE_OBJECT_GET_NATIVE_INFO:
+ {
+ H5O_native_info_t *native_info = HDva_arg(arguments, H5O_native_info_t *);
+ unsigned fields = HDva_arg(arguments, unsigned);
+
+ /* Use the original H5Oget_info code to get the data */
+
+ if(loc_params->type == H5VL_OBJECT_BY_SELF) { /* H5Oget_info */
+ /* Retrieve the object's information */
+ if(H5G_loc_native_info(&loc, ".", native_info, fields) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "object not found")
+ } /* end if */
+ else if(loc_params->type == H5VL_OBJECT_BY_NAME) { /* H5Oget_info_by_name */
+ /* Retrieve the object's information */
+ if(H5G_loc_native_info(&loc, loc_params->loc_data.loc_by_name.name, native_info, fields) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "object not found")
+ } /* end else-if */
+ else if(loc_params->type == H5VL_OBJECT_BY_IDX) { /* H5Oget_info_by_idx */
+ H5G_loc_t obj_loc; /* Location used to open group */
+ H5G_name_t obj_path; /* Opened object group hier. path */
+ H5O_loc_t obj_oloc; /* Opened object object location */
+
+ /* Set up opened group location to fill in */
+ obj_loc.oloc = &obj_oloc;
+ obj_loc.path = &obj_path;
+ H5G_loc_reset(&obj_loc);
+
+ /* Find the object's location, according to the order in the index */
+ if(H5G_loc_find_by_idx(&loc, loc_params->loc_data.loc_by_idx.name,
+ loc_params->loc_data.loc_by_idx.idx_type,
+ loc_params->loc_data.loc_by_idx.order,
+ loc_params->loc_data.loc_by_idx.n, &obj_loc/*out*/) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "group not found")
+
+ /* Retrieve the object's information */
+ if(H5O_get_native_info(obj_loc.oloc, native_info, fields) < 0) {
+ H5G_loc_free(&obj_loc);
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't retrieve object info")
+ } /* end if */
+
+ /* Release the object location */
+ if(H5G_loc_free(&obj_loc) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTRELEASE, FAIL, "can't free location")
+ } /* end else-if */
+ else
+ HGOTO_ERROR(H5E_OHDR, H5E_UNSUPPORTED, FAIL, "unknown get info parameters")
+
+ break;
+ }
+
default:
HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't perform this operation on object");
} /* end switch */