diff options
author | Quincey Koziol <koziol@koziol.gov> | 2019-04-12 03:22:21 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@koziol.gov> | 2019-04-12 03:22:21 (GMT) |
commit | 2eac0fccbc0fa1a38364ab5cb818483379a2668b (patch) | |
tree | e542cd31e7e4dba03c9e81e7923c6cfa1959032d /src | |
parent | 52276f3713eec584044bc72d4724507848cfeba0 (diff) | |
download | hdf5-2eac0fccbc0fa1a38364ab5cb818483379a2668b.zip hdf5-2eac0fccbc0fa1a38364ab5cb818483379a2668b.tar.gz hdf5-2eac0fccbc0fa1a38364ab5cb818483379a2668b.tar.bz2 |
Add H5Fget_fileno() API routine.
Diffstat (limited to 'src')
-rw-r--r-- | src/H5F.c | 35 | ||||
-rw-r--r-- | src/H5Fpublic.h | 1 | ||||
-rw-r--r-- | src/H5VLnative_file.c | 13 | ||||
-rw-r--r-- | src/H5VLpublic.h | 1 |
4 files changed, 50 insertions, 0 deletions
@@ -921,6 +921,41 @@ done: /*------------------------------------------------------------------------- + * Function: H5Fget_fileno + * + * Purpose: Public API to retrieve the file's 'file number' that uniquely + * identifies each open file. + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +herr_t +H5Fget_fileno(hid_t file_id, unsigned long *fileno) +{ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_API(FAIL) + + /* If no fileno pointer was passed in, exit quietly */ + if(fileno) { + H5VL_object_t *vol_obj; /* File info */ + + /* Get the internal file structure */ + if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(file_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier") + + /* Get the flags */ + if((ret_value = H5VL_file_get(vol_obj, H5VL_FILE_GET_FILENO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, fileno)) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get file's 'file number'") + } /* end if */ + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5Fget_fileno() */ + + +/*------------------------------------------------------------------------- * Function: H5Fget_freespace * * Purpose: Retrieves the amount of free space in the file. diff --git a/src/H5Fpublic.h b/src/H5Fpublic.h index 8274654..52f1ee2 100644 --- a/src/H5Fpublic.h +++ b/src/H5Fpublic.h @@ -236,6 +236,7 @@ H5_DLL herr_t H5Fclose(hid_t file_id); H5_DLL hid_t H5Fget_create_plist(hid_t file_id); H5_DLL hid_t H5Fget_access_plist(hid_t file_id); H5_DLL herr_t H5Fget_intent(hid_t file_id, unsigned *intent); +H5_DLL herr_t H5Fget_fileno(hid_t file_id, unsigned long *fileno); H5_DLL ssize_t H5Fget_obj_count(hid_t file_id, unsigned types); H5_DLL ssize_t H5Fget_obj_ids(hid_t file_id, unsigned types, size_t max_objs, hid_t *obj_id_list); H5_DLL herr_t H5Fget_vfd_handle(hid_t file_id, hid_t fapl, void **file_handle); diff --git a/src/H5VLnative_file.c b/src/H5VLnative_file.c index 624cd30..8903911 100644 --- a/src/H5VLnative_file.c +++ b/src/H5VLnative_file.c @@ -228,6 +228,19 @@ H5VL__native_file_get(void *obj, H5VL_file_get_t get_type, break; } + /* H5Fget_fileno */ + case H5VL_FILE_GET_FILENO: + { + unsigned long *fileno = HDva_arg(arguments, unsigned long *); + unsigned long my_fileno = 0; + + f = (H5F_t *)obj; + H5F_GET_FILENO(f, my_fileno); + *fileno = my_fileno; /* sigh */ + + break; + } + /* H5Fget_name */ case H5VL_FILE_GET_NAME: { diff --git a/src/H5VLpublic.h b/src/H5VLpublic.h index cf6246b..da31a97 100644 --- a/src/H5VLpublic.h +++ b/src/H5VLpublic.h @@ -114,6 +114,7 @@ typedef enum H5VL_file_get_t { H5VL_FILE_GET_FAPL, /* file access property list */ H5VL_FILE_GET_FCPL, /* file creation property list */ H5VL_FILE_GET_INTENT, /* file intent */ + H5VL_FILE_GET_FILENO, /* file number */ H5VL_FILE_GET_NAME, /* file name */ H5VL_FILE_GET_OBJ_COUNT, /* object count in file */ H5VL_FILE_GET_OBJ_IDS /* object ids in file */ |