From f46494ffd8449fc610798c8af312362608029d3d Mon Sep 17 00:00:00 2001 From: Jerome Soumagne Date: Mon, 25 Nov 2019 19:07:44 -0600 Subject: Remove H5VL_NATIVE_FILE_GET_FILE_ID and add H5VL_OBJECT_GET_FILE Remove H5F__get_file_id() and use only private routine instead --- src/H5Fint.c | 65 ++++++++++++++----------------------------------- src/H5Fpkg.h | 1 - src/H5Fprivate.h | 2 +- src/H5I.c | 9 ++++++- src/H5O.c | 2 +- src/H5Ocopy_ref.c | 5 ++-- src/H5R.c | 6 ++--- src/H5Rdeprec.c | 14 +++++------ src/H5Rint.c | 6 ++--- src/H5Rpkg.h | 2 +- src/H5Tref.c | 2 +- src/H5VLconnector.h | 1 + src/H5VLnative.h | 37 ++++++++++++++-------------- src/H5VLnative_file.c | 14 ----------- src/H5VLnative_object.c | 22 ++++++++++++++++- src/H5trace.c | 3 +++ 16 files changed, 88 insertions(+), 103 deletions(-) diff --git a/src/H5Fint.c b/src/H5Fint.c index 435c1be..153ec2f 100644 --- a/src/H5Fint.c +++ b/src/H5Fint.c @@ -3654,9 +3654,9 @@ done: /*------------------------------------------------------------------------- - * Function: H5F__get_file_id + * Function: H5F_get_file_id * - * Purpose: The package version of H5Iget_file_id(), obtains the file + * Purpose: The private version of H5Iget_file_id(), obtains the file * ID given an object ID. * * Return: Success: The file ID associated with the object @@ -3665,22 +3665,31 @@ done: *------------------------------------------------------------------------- */ hid_t -H5F__get_file_id(H5F_t *file, hbool_t app_ref) +H5F_get_file_id(H5VL_object_t *vol_obj, H5I_type_t obj_type, hbool_t app_ref) { - hid_t file_id = H5I_INVALID_HID; /* File ID */ - hid_t ret_value = H5I_INVALID_HID; /* Return value */ + void *vol_obj_file = NULL; /* File object pointer */ + H5VL_loc_params_t loc_params; /* Location parameters */ + hid_t file_id = H5I_INVALID_HID; /* File ID for object */ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ - FUNC_ENTER_PACKAGE + FUNC_ENTER_NOAPI(H5I_INVALID_HID) + + /* Set location parameters */ + loc_params.type = H5VL_OBJECT_BY_SELF; + loc_params.obj_type = obj_type; + + /* Retrieve VOL file from object */ + if(H5VL_object_get(vol_obj, &loc_params, H5VL_OBJECT_GET_FILE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &vol_obj_file) < 0) + HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, H5I_INVALID_HID, "can't retrieve file from object") /* Check if the file's ID already exists */ - if(H5I_find_id(file, H5I_FILE, &file_id) < 0) + if(H5I_find_id(vol_obj_file, H5I_FILE, &file_id) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, H5I_INVALID_HID, "getting file ID failed") /* If the ID does not exist, register it with the VOL connector */ if(H5I_INVALID_HID == file_id) { - if((file_id = H5VL_wrap_register(H5I_FILE, file, app_ref)) < 0) + if((file_id = H5VL_register(H5I_FILE, vol_obj_file, vol_obj->connector, app_ref)) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize file handle") - file->id_exists = TRUE; } /* end if */ else { /* Increment ref count on existing ID */ @@ -3693,44 +3702,6 @@ H5F__get_file_id(H5F_t *file, hbool_t app_ref) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5F__get_file_id() */ - - -/*------------------------------------------------------------------------- - * Function: H5F_get_file_id - * - * Purpose: The private version of H5Iget_file_id(), obtains the file - * ID given an object ID. - * - * Return: Success: The file ID associated with the object - * Failure: H5I_INVALID_HID - * - *------------------------------------------------------------------------- - */ -hid_t -H5F_get_file_id(hid_t obj_id, H5I_type_t type, hbool_t app_ref) -{ - H5VL_object_t *vol_obj; /* File info */ - hid_t file_id = H5I_INVALID_HID; /* File ID for object */ - hid_t ret_value = H5I_INVALID_HID; /* Return value */ - - FUNC_ENTER_NOAPI(H5I_INVALID_HID) - - /* Get the object pointer */ - if(NULL == (vol_obj = H5VL_vol_object(obj_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid identifier") - - /* Get the file through the VOL */ - if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_FILE_GET_FILE_ID, (int)type, (int)app_ref, &file_id) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, H5I_INVALID_HID, "unable to get file ID") - if(H5I_INVALID_HID == file_id) - HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, H5I_INVALID_HID, "unable to get the file ID through the VOL") - - /* Set return value */ - ret_value = file_id; - -done: - FUNC_LEAVE_NOAPI(ret_value) } /* end H5F_get_file_id() */ diff --git a/src/H5Fpkg.h b/src/H5Fpkg.h index 7d9a090..6e2c994 100644 --- a/src/H5Fpkg.h +++ b/src/H5Fpkg.h @@ -412,7 +412,6 @@ H5_DLL herr_t H5F__start_swmr_write(H5F_t *f); 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 */ diff --git a/src/H5Fprivate.h b/src/H5Fprivate.h index e1a8a2f..cfb796c 100644 --- a/src/H5Fprivate.h +++ b/src/H5Fprivate.h @@ -732,7 +732,7 @@ typedef enum H5F_prefix_open_t { /* Private functions */ H5_DLL H5F_t *H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id); H5_DLL herr_t H5F_try_close(H5F_t *f, hbool_t *was_closed/*out*/); -H5_DLL hid_t H5F_get_file_id(hid_t obj_id, H5I_type_t id_type, hbool_t app_ref); +H5_DLL hid_t H5F_get_file_id(H5VL_object_t *vol_obj, H5I_type_t obj_type, hbool_t app_ref); /* Functions that retrieve values from the file struct */ H5_DLL H5F_libver_t H5F_get_low_bound(const H5F_t *f); diff --git a/src/H5I.c b/src/H5I.c index 76faab1..c3c2d46 100644 --- a/src/H5I.c +++ b/src/H5I.c @@ -2270,7 +2270,14 @@ H5Iget_file_id(hid_t obj_id) /* Call internal function */ if (H5I_FILE == type || H5I_DATATYPE == type || H5I_GROUP == type || H5I_DATASET == type || H5I_ATTR == type) { - if ((ret_value = H5F_get_file_id(obj_id, type, TRUE)) < 0) + H5VL_object_t *vol_obj = NULL; /* Object token of obj_id */ + + /* Get the VOL object */ + if(NULL == (vol_obj = H5VL_vol_object(obj_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier") + + /* Get the file ID */ + if ((ret_value = H5F_get_file_id(vol_obj, type, TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, H5I_INVALID_HID, "can't retrieve file ID") } /* end if */ else diff --git a/src/H5O.c b/src/H5O.c index b79914c..7e5694a 100644 --- a/src/H5O.c +++ b/src/H5O.c @@ -278,7 +278,7 @@ H5Oopen_by_addr(hid_t loc_id, haddr_t addr) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier") /* Get the file for the object */ - if((file_id = H5F_get_file_id(loc_id, vol_obj_type, FALSE)) < 0) + if((file_id = H5F_get_file_id(vol_obj, vol_obj_type, FALSE)) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a file or file object") /* Retrieve VOL object */ diff --git a/src/H5Ocopy_ref.c b/src/H5Ocopy_ref.c index d8efeb5..20b8454 100644 --- a/src/H5Ocopy_ref.c +++ b/src/H5Ocopy_ref.c @@ -24,7 +24,6 @@ /****************/ #include "H5Omodule.h" /* This source code file is part of the H5O module */ -#define H5F_FRIEND /* Suppress error about including H5Fpkg */ #define H5R_FRIEND /* Suppress error about including H5Rpkg */ @@ -32,7 +31,7 @@ /* Headers */ /***********/ #include "H5private.h" /* Generic Functions */ -#include "H5Fpkg.h" /* File */ +#include "H5Fprivate.h" /* File */ #include "H5Iprivate.h" /* IDs */ #include "H5Lprivate.h" /* Links */ #include "H5MMprivate.h" /* Memory management */ @@ -359,7 +358,7 @@ H5O__copy_expand_ref_object2(H5O_loc_t *src_oloc, hid_t tid_src, H5T_t *dt_src, HGOTO_ERROR(H5E_OHDR, H5E_CANTCONVERT, FAIL, "datatype conversion failed") /* Retrieve loc ID */ - if((dst_loc_id = H5F__get_file_id(dst_oloc->file, FALSE)) < 0) + if((dst_loc_id = H5F_get_id(dst_oloc->file)) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") /* Making equivalent references in the destination file */ diff --git a/src/H5R.c b/src/H5R.c index 11b75ca..31b2bcd 100644 --- a/src/H5R.c +++ b/src/H5R.c @@ -103,7 +103,7 @@ H5Rcreate_object(hid_t loc_id, const char *name, H5R_ref_t *ref_ptr) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") /* Get the file for the object */ - if((file_id = H5F_get_file_id(loc_id, obj_type, FALSE)) < 0) + if((file_id = H5F_get_file_id(vol_obj, obj_type, FALSE)) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") /* Retrieve VOL file object */ @@ -186,7 +186,7 @@ H5Rcreate_region(hid_t loc_id, const char *name, hid_t space_id, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") /* Get the file for the object */ - if((file_id = H5F_get_file_id(loc_id, obj_type, FALSE)) < 0) + if((file_id = H5F_get_file_id(vol_obj, obj_type, FALSE)) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") /* Retrieve VOL file object */ @@ -265,7 +265,7 @@ H5Rcreate_attr(hid_t loc_id, const char *name, const char *attr_name, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") /* Get the file for the object */ - if((file_id = H5F_get_file_id(loc_id, obj_type, FALSE)) < 0) + if((file_id = H5F_get_file_id(vol_obj, obj_type, FALSE)) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") /* Retrieve VOL file object */ diff --git a/src/H5Rdeprec.c b/src/H5Rdeprec.c index b9bdffa..0636da9 100644 --- a/src/H5Rdeprec.c +++ b/src/H5Rdeprec.c @@ -123,7 +123,7 @@ H5Rget_obj_type1(hid_t id, H5R_type_t ref_type, const void *ref) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5G_UNKNOWN, "invalid location identifier") /* Get object token */ - if(H5R__decode_token_compat(id, vol_obj_type, ref_type, buf, &obj_token) < 0) + if(H5R__decode_token_compat(vol_obj, vol_obj_type, ref_type, buf, &obj_token) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTDECODE, H5G_UNKNOWN, "unable to get object token") /* Set location parameters */ @@ -183,7 +183,7 @@ H5Rdereference1(hid_t obj_id, H5R_type_t ref_type, const void *ref) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier") /* Get object token */ - if(H5R__decode_token_compat(obj_id, vol_obj_type, ref_type, buf, &obj_token) < 0) + if(H5R__decode_token_compat(vol_obj, vol_obj_type, ref_type, buf, &obj_token) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTDECODE, H5I_INVALID_HID, "unable to get object token") /* Set location parameters */ @@ -265,7 +265,7 @@ H5Rcreate(void *ref, hid_t loc_id, const char *name, H5R_type_t ref_type, HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, FAIL, "unable to retrieve object token") /* Get the file for the object */ - if((file_id = H5F_get_file_id(loc_id, vol_obj_type, FALSE)) < 0) + if((file_id = H5F_get_file_id(vol_obj, vol_obj_type, FALSE)) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") /* Retrieve VOL object */ @@ -351,7 +351,7 @@ H5Rget_obj_type2(hid_t id, H5R_type_t ref_type, const void *ref, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") /* Get object token */ - if(H5R__decode_token_compat(id, vol_obj_type, ref_type, buf, &obj_token) < 0) + if(H5R__decode_token_compat(vol_obj, vol_obj_type, ref_type, buf, &obj_token) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTDECODE, FAIL, "unable to get object token") /* Set location parameters */ @@ -415,7 +415,7 @@ H5Rdereference2(hid_t obj_id, hid_t oapl_id, H5R_type_t ref_type, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier") /* Get object token */ - if(H5R__decode_token_compat(obj_id, vol_obj_type, ref_type, buf, &obj_token) < 0) + if(H5R__decode_token_compat(vol_obj, vol_obj_type, ref_type, buf, &obj_token) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTDECODE, H5I_INVALID_HID, "unable to get object token") /* Set location parameters */ @@ -479,7 +479,7 @@ H5Rget_region(hid_t id, H5R_type_t ref_type, const void *ref) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier") /* Get the file for the object */ - if((file_id = H5F_get_file_id(id, vol_obj_type, FALSE)) < 0) + if((file_id = H5F_get_file_id(vol_obj, vol_obj_type, FALSE)) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a file or file object") /* Retrieve VOL object */ @@ -548,7 +548,7 @@ H5Rget_name(hid_t id, H5R_type_t ref_type, const void *ref, char *name, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "invalid location identifier") /* Get object token */ - if(H5R__decode_token_compat(id, vol_obj_type, ref_type, buf, &obj_token) < 0) + if(H5R__decode_token_compat(vol_obj, vol_obj_type, ref_type, buf, &obj_token) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTDECODE, (-1), "unable to get object token") /* Set location parameters */ diff --git a/src/H5Rint.c b/src/H5Rint.c index 504ae06..adf6e4e 100644 --- a/src/H5Rint.c +++ b/src/H5Rint.c @@ -1479,18 +1479,18 @@ done: *------------------------------------------------------------------------- */ herr_t -H5R__decode_token_compat(hid_t id, H5I_type_t type, H5R_type_t ref_type, +H5R__decode_token_compat(H5VL_object_t *vol_obj, H5I_type_t type, H5R_type_t ref_type, const unsigned char *buf, H5VL_token_t *obj_token) { hid_t file_id = H5I_INVALID_HID; /* File ID for region reference */ - void *vol_obj_file = NULL; + H5VL_object_t *vol_obj_file = NULL; H5VL_file_cont_info_t cont_info = {H5VL_CONTAINER_INFO_VERSION, 0, 0, 0}; herr_t ret_value = SUCCEED; FUNC_ENTER_PACKAGE /* Get the file for the object */ - if((file_id = H5F_get_file_id(id, type, FALSE)) < 0) + if((file_id = H5F_get_file_id(vol_obj, type, FALSE)) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") /* Retrieve VOL object */ diff --git a/src/H5Rpkg.h b/src/H5Rpkg.h index 19f3115..7471487 100644 --- a/src/H5Rpkg.h +++ b/src/H5Rpkg.h @@ -118,7 +118,7 @@ H5_DLL herr_t H5R__encode_heap(H5F_t *f, unsigned char *buf, size_t *nalloc, c H5_DLL herr_t H5R__decode_heap(H5F_t *f, const unsigned char *buf, size_t *nbytes, unsigned char **data_ptr, size_t *data_size); H5_DLL herr_t H5R__free_heap(H5F_t *f, const unsigned char *buf, size_t nbytes); -H5_DLL herr_t H5R__decode_token_compat(hid_t id, H5I_type_t type, H5R_type_t ref_type, const unsigned char *buf, H5VL_token_t *obj_token); +H5_DLL herr_t H5R__decode_token_compat(H5VL_object_t *vol_obj, H5I_type_t type, H5R_type_t ref_type, const unsigned char *buf, H5VL_token_t *obj_token); H5_DLL herr_t H5R__encode_token_obj_compat(const H5VL_token_t *obj_token, size_t token_size, unsigned char *buf, size_t *nalloc); H5_DLL herr_t H5R__decode_token_obj_compat(const unsigned char *buf, size_t *nbytes, H5VL_token_t *obj_token, size_t token_size); diff --git a/src/H5Tref.c b/src/H5Tref.c index 2e52954..20c6e41 100644 --- a/src/H5Tref.c +++ b/src/H5Tref.c @@ -468,7 +468,7 @@ H5T__ref_mem_write(H5VL_object_t *src_file, const void *src_buf, size_t src_size /* If no filename set, this is not an external reference */ if(NULL == H5R_REF_FILENAME(dst_ref)) { /* TODO temporary hack to retrieve file object */ - if((file_id = H5F__get_file_id(src_f, FALSE)) < 0) + if((file_id = H5F_get_file_id(src_file, H5I_FILE, FALSE)) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") /* Attach loc ID to reference and hold reference to it */ diff --git a/src/H5VLconnector.h b/src/H5VLconnector.h index 46383bb..0fce7f4 100644 --- a/src/H5VLconnector.h +++ b/src/H5VLconnector.h @@ -160,6 +160,7 @@ typedef enum H5VL_link_specific_t { /* types for object GET callback */ typedef enum H5VL_object_get_t { + H5VL_OBJECT_GET_FILE, /* object file */ H5VL_OBJECT_GET_NAME, /* object name */ H5VL_OBJECT_GET_TYPE /* object type */ } H5VL_object_get_t; diff --git a/src/H5VLnative.h b/src/H5VLnative.h index 5b51e66..73cec8d 100644 --- a/src/H5VLnative.h +++ b/src/H5VLnative.h @@ -57,25 +57,24 @@ typedef int H5VL_native_file_optional_t; #define H5VL_NATIVE_FILE_GET_MDC_SIZE 7 /* H5Fget_mdc_size */ #define H5VL_NATIVE_FILE_GET_SIZE 8 /* H5Fget_filesize */ #define H5VL_NATIVE_FILE_GET_VFD_HANDLE 9 /* H5Fget_vfd_handle */ -#define H5VL_NATIVE_FILE_GET_FILE_ID 10 /* H5Fget_file_id */ -#define H5VL_NATIVE_FILE_RESET_MDC_HIT_RATE 11 /* H5Freset_mdc_hit_rate_stats */ -#define H5VL_NATIVE_FILE_SET_MDC_CONFIG 12 /* H5Fset_mdc_config */ -#define H5VL_NATIVE_FILE_GET_METADATA_READ_RETRY_INFO 13 /* H5Fget_metadata_read_retry_info */ -#define H5VL_NATIVE_FILE_START_SWMR_WRITE 14 /* H5Fstart_swmr_write */ -#define H5VL_NATIVE_FILE_START_MDC_LOGGING 15 /* H5Fstart_mdc_logging */ -#define H5VL_NATIVE_FILE_STOP_MDC_LOGGING 16 /* H5Fstop_mdc_logging */ -#define H5VL_NATIVE_FILE_GET_MDC_LOGGING_STATUS 17 /* H5Fget_mdc_logging_status */ -#define H5VL_NATIVE_FILE_FORMAT_CONVERT 18 /* H5Fformat_convert */ -#define H5VL_NATIVE_FILE_RESET_PAGE_BUFFERING_STATS 19 /* H5Freset_page_buffering_stats */ -#define H5VL_NATIVE_FILE_GET_PAGE_BUFFERING_STATS 20 /* H5Fget_page_buffering_stats */ -#define H5VL_NATIVE_FILE_GET_MDC_IMAGE_INFO 21 /* H5Fget_mdc_image_info */ -#define H5VL_NATIVE_FILE_GET_EOA 22 /* H5Fget_eoa */ -#define H5VL_NATIVE_FILE_INCR_FILESIZE 23 /* H5Fincrement_filesize */ -#define H5VL_NATIVE_FILE_SET_LIBVER_BOUNDS 24 /* H5Fset_latest_format/libver_bounds */ -#define H5VL_NATIVE_FILE_GET_MIN_DSET_OHDR_FLAG 25 /* H5Fget_dset_no_attrs_hint */ -#define H5VL_NATIVE_FILE_SET_MIN_DSET_OHDR_FLAG 26 /* H5Fset_dset_no_attrs_hint */ -#define H5VL_NATIVE_FILE_GET_MPI_ATOMICITY 27 /* H5Fget_mpi_atomicity */ -#define H5VL_NATIVE_FILE_SET_MPI_ATOMICITY 28 /* H5Fset_mpi_atomicity */ +#define H5VL_NATIVE_FILE_RESET_MDC_HIT_RATE 10 /* H5Freset_mdc_hit_rate_stats */ +#define H5VL_NATIVE_FILE_SET_MDC_CONFIG 11 /* H5Fset_mdc_config */ +#define H5VL_NATIVE_FILE_GET_METADATA_READ_RETRY_INFO 12 /* H5Fget_metadata_read_retry_info */ +#define H5VL_NATIVE_FILE_START_SWMR_WRITE 13 /* H5Fstart_swmr_write */ +#define H5VL_NATIVE_FILE_START_MDC_LOGGING 14 /* H5Fstart_mdc_logging */ +#define H5VL_NATIVE_FILE_STOP_MDC_LOGGING 15 /* H5Fstop_mdc_logging */ +#define H5VL_NATIVE_FILE_GET_MDC_LOGGING_STATUS 16 /* H5Fget_mdc_logging_status */ +#define H5VL_NATIVE_FILE_FORMAT_CONVERT 17 /* H5Fformat_convert */ +#define H5VL_NATIVE_FILE_RESET_PAGE_BUFFERING_STATS 18 /* H5Freset_page_buffering_stats */ +#define H5VL_NATIVE_FILE_GET_PAGE_BUFFERING_STATS 19 /* H5Fget_page_buffering_stats */ +#define H5VL_NATIVE_FILE_GET_MDC_IMAGE_INFO 20 /* H5Fget_mdc_image_info */ +#define H5VL_NATIVE_FILE_GET_EOA 21 /* H5Fget_eoa */ +#define H5VL_NATIVE_FILE_INCR_FILESIZE 22 /* H5Fincrement_filesize */ +#define H5VL_NATIVE_FILE_SET_LIBVER_BOUNDS 23 /* H5Fset_latest_format/libver_bounds */ +#define H5VL_NATIVE_FILE_GET_MIN_DSET_OHDR_FLAG 24 /* H5Fget_dset_no_attrs_hint */ +#define H5VL_NATIVE_FILE_SET_MIN_DSET_OHDR_FLAG 25 /* H5Fset_dset_no_attrs_hint */ +#define H5VL_NATIVE_FILE_GET_MPI_ATOMICITY 26 /* H5Fget_mpi_atomicity */ +#define H5VL_NATIVE_FILE_SET_MPI_ATOMICITY 27 /* H5Fset_mpi_atomicity */ /* Typedef and values for native VOL connector group optional VOL operations */ typedef int H5VL_native_group_optional_t; diff --git a/src/H5VLnative_file.c b/src/H5VLnative_file.c index 094722e..3bda0b8 100644 --- a/src/H5VLnative_file.c +++ b/src/H5VLnative_file.c @@ -578,20 +578,6 @@ H5VL__native_file_optional(void *obj, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR break; } - /* H5Iget_file_id */ - case H5VL_NATIVE_FILE_GET_FILE_ID: - { - H5I_type_t type = (H5I_type_t)HDva_arg(arguments, int); /* enum work-around */ - hbool_t app_ref = (hbool_t)HDva_arg(arguments, int); - hid_t *file_id = HDva_arg(arguments, hid_t *); - - if(NULL == (f = H5F__get_file(obj, type))) - HGOTO_ERROR(H5E_FILE, H5E_BADTYPE, FAIL, "not a file or file object") - if((*file_id = H5F__get_file_id(f, app_ref)) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't get file ID") - break; - } - /* H5Fclear_elink_file_cache */ case H5VL_NATIVE_FILE_CLEAR_ELINK_CACHE: { diff --git a/src/H5VLnative_object.c b/src/H5VLnative_object.c index 675d8cf..dfa4eab 100644 --- a/src/H5VLnative_object.c +++ b/src/H5VLnative_object.c @@ -16,10 +16,11 @@ */ #define H5O_FRIEND /* Suppress error about including H5Opkg */ +#define H5F_FRIEND /* Suppress error about including H5Fpkg */ #include "H5private.h" /* Generic Functions */ #include "H5Eprivate.h" /* Error handling */ -#include "H5Fprivate.h" /* Files */ +#include "H5Fpkg.h" /* Files (pkg needed for id_exists) */ #include "H5Gprivate.h" /* Groups */ #include "H5Iprivate.h" /* IDs */ #include "H5Opkg.h" /* Object headers */ @@ -150,6 +151,25 @@ H5VL__native_object_get(void *obj, const H5VL_loc_params_t *loc_params, H5VL_obj HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") switch(get_type) { + + /* Object file */ + case H5VL_OBJECT_GET_FILE: + { + void **ret = HDva_arg(arguments, void **); + + if(loc_params->type == H5VL_OBJECT_BY_SELF) { + *ret = (void *)loc.oloc->file; + + /* TODO we currently need to set id_exists to TRUE because + * the upper layer will create an ID from the returned + * object. In theory this should not be needed and id_exists + * should be removed once the H5Fmount code gets fixed. */ + loc.oloc->file->id_exists = TRUE; + } else + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "unknown get_file parameters") + break; + } + /* Object name */ case H5VL_OBJECT_GET_NAME: { diff --git a/src/H5trace.c b/src/H5trace.c index 79dfbc8..65e267e 100644 --- a/src/H5trace.c +++ b/src/H5trace.c @@ -3000,6 +3000,9 @@ H5_trace(const double *returning, const char *func, const char *type, ...) H5VL_object_get_t get = (H5VL_object_get_t)HDva_arg(ap, int); switch(get) { + case H5VL_OBJECT_GET_FILE: + HDfprintf(out, "H5VL_OBJECT_GET_FILE"); + break; case H5VL_OBJECT_GET_NAME: HDfprintf(out, "H5VL_OBJECT_GET_NAME"); break; -- cgit v0.12