mirror of
https://github.com/HDFGroup/hdf5.git
synced 2025-01-18 15:15:56 +08:00
Merge branch 'develop' into vol_optional_enum_to_macros
This commit is contained in:
commit
b55e5efc1c
48
src/H5Fint.c
48
src/H5Fint.c
@ -74,6 +74,7 @@ typedef struct H5F_olist_t {
|
||||
/* Local Prototypes */
|
||||
/********************/
|
||||
|
||||
static herr_t H5F__set_vol_conn(H5F_t *file, hid_t vol_id, const void *vol_info);
|
||||
static herr_t H5F__get_objects(const H5F_t *f, unsigned types, size_t max_index, hid_t *obj_id_list, hbool_t app_ref, size_t *obj_id_count_ptr);
|
||||
static int H5F__get_objects_cb(void *obj_ptr, hid_t obj_id, void *key);
|
||||
static herr_t H5F__build_name(const char *prefix, const char *file_name, char **full_name/*out*/);
|
||||
@ -115,39 +116,36 @@ H5FL_DEFINE(H5F_file_t);
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
herr_t
|
||||
static herr_t
|
||||
H5F__set_vol_conn(H5F_t *file, hid_t vol_id, const void *vol_info)
|
||||
{
|
||||
void *new_connector_info = NULL; /* Copy of connector info */
|
||||
herr_t ret_value = SUCCEED; /* Return value */
|
||||
|
||||
FUNC_ENTER_PACKAGE
|
||||
FUNC_ENTER_STATIC
|
||||
|
||||
/* Sanity check */
|
||||
HDassert(file);
|
||||
|
||||
/* Only cache VOL connector ID & info the first time the file is opened */
|
||||
if(file->shared->nrefs == 1) {
|
||||
/* Copy connector info, if it exists */
|
||||
if(vol_info) {
|
||||
H5VL_class_t *connector; /* Pointer to connector */
|
||||
/* Copy connector info, if it exists */
|
||||
if(vol_info) {
|
||||
H5VL_class_t *connector; /* Pointer to connector */
|
||||
|
||||
/* Retrieve the connector for the ID */
|
||||
if(NULL == (connector = (H5VL_class_t *)H5I_object(vol_id)))
|
||||
HGOTO_ERROR(H5E_FILE, H5E_BADTYPE, FAIL, "not a VOL connector ID")
|
||||
/* Retrieve the connector for the ID */
|
||||
if(NULL == (connector = (H5VL_class_t *)H5I_object(vol_id)))
|
||||
HGOTO_ERROR(H5E_FILE, H5E_BADTYPE, FAIL, "not a VOL connector ID")
|
||||
|
||||
/* Allocate and copy connector info */
|
||||
if(H5VL_copy_connector_info(connector, &new_connector_info, vol_info) < 0)
|
||||
HGOTO_ERROR(H5E_FILE, H5E_CANTCOPY, FAIL, "connector info copy failed")
|
||||
} /* end if */
|
||||
|
||||
/* Cache the connector ID & info for the container */
|
||||
file->shared->vol_id = vol_id;
|
||||
file->shared->vol_info = new_connector_info;
|
||||
if(H5I_inc_ref(file->shared->vol_id, FALSE) < 0)
|
||||
HGOTO_ERROR(H5E_FILE, H5E_CANTINC, FAIL, "incrementing VOL connector ID failed")
|
||||
/* Allocate and copy connector info */
|
||||
if(H5VL_copy_connector_info(connector, &new_connector_info, vol_info) < 0)
|
||||
HGOTO_ERROR(H5E_FILE, H5E_CANTCOPY, FAIL, "connector info copy failed")
|
||||
} /* end if */
|
||||
|
||||
/* Cache the connector ID & info for the container */
|
||||
file->shared->vol_id = vol_id;
|
||||
file->shared->vol_info = new_connector_info;
|
||||
if(H5I_inc_ref(file->shared->vol_id, FALSE) < 0)
|
||||
HGOTO_ERROR(H5E_FILE, H5E_CANTINC, FAIL, "incrementing VOL connector ID failed")
|
||||
|
||||
done:
|
||||
FUNC_LEAVE_NOAPI(ret_value)
|
||||
} /* end H5F__set_vol_conn() */
|
||||
@ -1089,6 +1087,16 @@ H5F__new(H5F_file_t *shared, unsigned flags, hid_t fcpl_id, hid_t fapl_id, H5FD_
|
||||
if(H5P_get(plist, H5F_ACS_OBJECT_FLUSH_CB_NAME, &(f->shared->object_flush)) < 0)
|
||||
HGOTO_ERROR(H5E_FILE, H5E_CANTGET, NULL, "can't get object flush cb info")
|
||||
|
||||
/* Get the VOL connector info */
|
||||
{
|
||||
H5VL_connector_prop_t connector_prop; /* Property for VOL connector ID & info */
|
||||
|
||||
if(H5P_peek(plist, H5F_ACS_VOL_CONN_NAME, &connector_prop) < 0)
|
||||
HGOTO_ERROR(H5E_FILE, H5E_CANTGET, NULL, "can't get VOL connector info")
|
||||
if(H5F__set_vol_conn(f, connector_prop.connector_id, connector_prop.connector_info) < 0)
|
||||
HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, "can't cache VOL connector info")
|
||||
} /* end block */
|
||||
|
||||
/* Create a metadata cache with the specified number of elements.
|
||||
* The cache might be created with a different number of elements and
|
||||
* the access property list should be updated to reflect that.
|
||||
|
@ -411,7 +411,6 @@ 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);
|
||||
H5_DLL herr_t H5F__set_vol_conn(H5F_t *file, hid_t vol_id, const void *vol_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);
|
||||
|
@ -95,8 +95,6 @@ static herr_t H5VL__dataset_optional(void *obj, const H5VL_class_t *cls,
|
||||
hid_t dxpl_id, void **req, va_list arguments);
|
||||
static herr_t H5VL__dataset_close(void *obj, const H5VL_class_t *cls, hid_t dxpl_id,
|
||||
void **req);
|
||||
static herr_t H5VL__file_cache_connector(void *obj, const H5VL_class_t *cls,
|
||||
hid_t dxpl_id, void **req, ...);
|
||||
static void * H5VL__file_create(const H5VL_class_t *cls, const char *name,
|
||||
unsigned flags, hid_t fcpl_id, hid_t fapl_id, hid_t dxpl_id, void **req);
|
||||
static void * H5VL__file_open(const H5VL_class_t *cls, const char *name,
|
||||
@ -2594,42 +2592,6 @@ done:
|
||||
FUNC_LEAVE_API_NOINIT(ret_value)
|
||||
} /* end H5VLdataset_close() */
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5VL__file_cache_connector
|
||||
*
|
||||
* Purpose: Wrap varargs and reissue 'cache VOL connector' operation
|
||||
* to file specific call
|
||||
*
|
||||
* Return: Success: Non-negative
|
||||
* Failure: Negative
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
static herr_t
|
||||
H5VL__file_cache_connector(void *obj, const H5VL_class_t *cls, hid_t dxpl_id,
|
||||
void **req, ...)
|
||||
{
|
||||
va_list arguments; /* Argument list passed from the API call */
|
||||
hbool_t arg_started = FALSE; /* Whether the va_list has been started */
|
||||
herr_t ret_value = SUCCEED; /* Return value */
|
||||
|
||||
FUNC_ENTER_STATIC
|
||||
|
||||
/* Re-issue call to internal file specific callback routine */
|
||||
HDva_start(arguments, req);
|
||||
arg_started = TRUE;
|
||||
if(H5VL__file_specific(obj, cls, H5VL_FILE_CACHE_VOL_CONN, dxpl_id, req, arguments) < 0)
|
||||
HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "file specific failed")
|
||||
|
||||
done:
|
||||
/* End access to the va_list, if we started it */
|
||||
if(arg_started)
|
||||
HDva_end(arguments);
|
||||
|
||||
FUNC_LEAVE_NOAPI(ret_value)
|
||||
} /* end H5VL__file_cache_connector() */
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5VL__file_create
|
||||
@ -2695,10 +2657,6 @@ H5VL_file_create(const H5VL_connector_prop_t *connector_prop, const char *name,
|
||||
if(NULL == (ret_value = H5VL__file_create(cls, name, flags, fcpl_id, fapl_id, dxpl_id, req)))
|
||||
HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, NULL, "file create failed")
|
||||
|
||||
/* Cache the connector ID & info */
|
||||
if(H5VL__file_cache_connector(ret_value, cls, dxpl_id, req, connector_prop->connector_id, connector_prop->connector_info) < 0)
|
||||
HGOTO_ERROR(H5E_VOL, H5E_CANTSET, NULL, "caching VOL connector ID & info failed")
|
||||
|
||||
done:
|
||||
FUNC_LEAVE_NOAPI(ret_value)
|
||||
} /* end H5VL_file_create() */
|
||||
@ -2806,10 +2764,6 @@ H5VL_file_open(const H5VL_connector_prop_t *connector_prop, const char *name,
|
||||
if(NULL == (ret_value = H5VL__file_open(cls, name, flags, fapl_id, dxpl_id, req)))
|
||||
HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL, "open failed")
|
||||
|
||||
/* Cache the connector ID & info */
|
||||
if(H5VL__file_cache_connector(ret_value, cls, dxpl_id, req, connector_prop->connector_id, connector_prop->connector_info) < 0)
|
||||
HGOTO_ERROR(H5E_VOL, H5E_CANTSET, NULL, "caching VOL connector ID & info failed")
|
||||
|
||||
done:
|
||||
FUNC_LEAVE_NOAPI(ret_value)
|
||||
} /* end H5VL_file_open() */
|
||||
|
@ -1738,18 +1738,6 @@ H5VL__native_file_specific(void *obj, H5VL_file_specific_t specific_type,
|
||||
break;
|
||||
}
|
||||
|
||||
/* H5Fcreate / H5Fopen */
|
||||
case H5VL_FILE_CACHE_VOL_CONN:
|
||||
{
|
||||
hid_t vol_id = HDva_arg(arguments, hid_t);
|
||||
void *vol_info = HDva_arg(arguments, void *);
|
||||
|
||||
/* Call private routine */
|
||||
if(H5F__set_vol_conn((H5F_t *)obj, vol_id, vol_info) < 0)
|
||||
HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "cache VOL connector ID & info failed")
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "invalid specific operation")
|
||||
} /* end switch */
|
||||
|
@ -124,8 +124,7 @@ typedef enum H5VL_file_specific_t {
|
||||
H5VL_FILE_REOPEN, /* Reopen the file */
|
||||
H5VL_FILE_MOUNT, /* Mount a file */
|
||||
H5VL_FILE_UNMOUNT, /* Unmount a file */
|
||||
H5VL_FILE_IS_ACCESSIBLE, /* Check if a file is accessible */
|
||||
H5VL_FILE_CACHE_VOL_CONN /* Cache VOL connector ID & info */
|
||||
H5VL_FILE_IS_ACCESSIBLE /* Check if a file is accessible */
|
||||
} H5VL_file_specific_t;
|
||||
|
||||
/* types for group GET callback */
|
||||
|
@ -2751,9 +2751,6 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
|
||||
case H5VL_FILE_IS_ACCESSIBLE:
|
||||
HDfprintf(out, "H5VL_FILE_IS_ACCESSIBLE");
|
||||
break;
|
||||
case H5VL_FILE_CACHE_VOL_CONN:
|
||||
HDfprintf(out, "H5VL_FILE_CACHE_VOL_CONN");
|
||||
break;
|
||||
default:
|
||||
HDfprintf(out, "%ld", (long)specific);
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user