diff options
author | Raymond Lu <songyulu@hdfgroup.org> | 2002-09-30 16:31:55 (GMT) |
---|---|---|
committer | Raymond Lu <songyulu@hdfgroup.org> | 2002-09-30 16:31:55 (GMT) |
commit | d1e26ae3280320dcc7cd286b4ef77be552bfc244 (patch) | |
tree | b0b85f9e029956209be19e9b28f342a59294c260 /src | |
parent | 4cfb158c292f7707a8a87edfd4b525c6ad7bb4b8 (diff) | |
download | hdf5-d1e26ae3280320dcc7cd286b4ef77be552bfc244.zip hdf5-d1e26ae3280320dcc7cd286b4ef77be552bfc244.tar.gz hdf5-d1e26ae3280320dcc7cd286b4ef77be552bfc244.tar.bz2 |
[svn-r5951]
Purpose:
New API functions
Description:
Added API functions to return pointer to low-level file handle
(H5Fget_vfd_handle and H5FDget_vfd_handle) and related property list
setting functions(H5Pset_family_offset and H5Pset_multi_type).
Platforms tested:
Linux 2.2(eirene), Solaris 2.7(arabica), IRIX64 6.5(modi4)
Diffstat (limited to 'src')
-rw-r--r-- | src/H5F.c | 77 | ||||
-rw-r--r-- | src/H5FD.c | 59 | ||||
-rw-r--r-- | src/H5FDcore.c | 38 | ||||
-rw-r--r-- | src/H5FDfamily.c | 52 | ||||
-rw-r--r-- | src/H5FDgass.c | 34 | ||||
-rw-r--r-- | src/H5FDlog.c | 34 | ||||
-rw-r--r-- | src/H5FDmpio.c | 34 | ||||
-rw-r--r-- | src/H5FDmpiposix.c | 34 | ||||
-rw-r--r-- | src/H5FDmulti.c | 35 | ||||
-rw-r--r-- | src/H5FDmulti.h | 2 | ||||
-rw-r--r-- | src/H5FDprivate.h | 1 | ||||
-rw-r--r-- | src/H5FDpublic.h | 2 | ||||
-rw-r--r-- | src/H5FDsec2.c | 33 | ||||
-rw-r--r-- | src/H5FDsrb.c | 34 | ||||
-rw-r--r-- | src/H5FDstdio.c | 32 | ||||
-rw-r--r-- | src/H5FDstream.c | 34 | ||||
-rw-r--r-- | src/H5Fprivate.h | 11 | ||||
-rw-r--r-- | src/H5Fpublic.h | 1 | ||||
-rw-r--r-- | src/H5Pfapl.c | 298 | ||||
-rw-r--r-- | src/H5Pprivate.h | 4 | ||||
-rw-r--r-- | src/H5Ppublic.h | 5 |
21 files changed, 848 insertions, 6 deletions
@@ -205,6 +205,8 @@ H5F_init_interface(void) hid_t driver_id = H5F_ACS_FILE_DRV_ID_DEF; void *driver_info = H5F_ACS_FILE_DRV_INFO_DEF; H5F_close_degree_t close_degree = H5F_CLOSE_DEGREE_DEF; + hsize_t family_offset = H5F_ACS_FAMILY_OFFSET_DEF; + H5FD_mem_t mem_type = H5F_ACS_MULTI_TYPE_DEF; /* File mount property class variable. * - Mount property class to modify @@ -385,6 +387,13 @@ H5F_init_interface(void) if(H5P_register(acs_pclass,H5F_CLOSE_DEGREE_NAME,H5F_CLOSE_DEGREE_SIZE, &close_degree,NULL,NULL,NULL,NULL,NULL,NULL)<0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class"); + /* Register the offset of family driver info */ + if(H5P_register(acs_pclass,H5F_ACS_FAMILY_OFFSET_NAME,H5F_ACS_FAMILY_OFFSET_SIZE, &family_offset,NULL,NULL,NULL,NULL,NULL,NULL)<0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class"); + + /* Register the data type of multi driver info */ + if(H5P_register(acs_pclass,H5F_ACS_MULTI_TYPE_NAME,H5F_ACS_MULTI_TYPE_SIZE, &mem_type,NULL,NULL,NULL,NULL,NULL,NULL)<0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class"); } /* end if */ /* Only register the default property list if it hasn't been created yet */ @@ -1165,6 +1174,74 @@ done: /*------------------------------------------------------------------------- + * Function: H5Fget_vfd_handle + * + * Purpose: Returns a pointer to the file handle of the low-level file + * driver. + * + * Return: Success: non-negative value. + * + * Failture: negative. + * + * Programmer: Raymond Lu + * Sep. 16, 2002 + * + * Modification: + * + *------------------------------------------------------------------------- + */ +herr_t H5Fget_vfd_handle(hid_t file_id, hid_t fapl, void** file_handle) +{ + H5F_t *file=NULL; + herr_t ret_value; + + FUNC_ENTER_API(H5Fget_vfd_handle, NULL); + + /* Check args */ + assert(file_handle); + if(NULL==(file=H5I_object_verify(file_id, H5I_FILE))) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file id"); + + ret_value=H5F_get_vfd_handle(file, fapl, file_handle); + +done: + FUNC_LEAVE(ret_value); +} + + +/*------------------------------------------------------------------------- + * Function: H5F_get_vfd_handle + * + * Purpose: Returns a pointer to the file handle of the low-level file + * driver. This is the private function for H5Fget_vfd_handle. + * + * Return: Success: Non-negative. + * + * Failture: negative. + * + * Programmer: Raymond Lu + * Sep. 16, 2002 + * + * Modification: + * + *------------------------------------------------------------------------- + */ +herr_t H5F_get_vfd_handle(H5F_t *file, hid_t fapl, void**file_handle) +{ + herr_t ret_value; + + FUNC_ENTER_NOINIT(H5F_get_vfd_handle); + + assert(file_handle); + if((ret_value=H5FD_get_vfd_handle(file->shared->lf, fapl, file_handle)) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't get file handle for file driver"); + +done: + FUNC_LEAVE(ret_value); +} + + +/*------------------------------------------------------------------------- * Function: H5F_equal * * Purpose: Compares NEEDLE to a file from the HAYSTACK. @@ -2872,3 +2872,62 @@ done: FUNC_LEAVE(ret_value); } /* end H5F_get_fileno() */ + +/*-------------------------------------------------------------------------- + * Function: H5FDget_vfd_handle + * + * Purpose: Returns a pointer to the file handle of low-level virtual + * file driver. + * + * Return: Non-negative if succeed; negative otherwise. + * + * Programmer: Raymond Lu + * Sep. 16, 2002 + * + * Modifications: + * + *-------------------------------------------------------------------------- + */ +herr_t H5FDget_vfd_handle(H5FD_t *file, hid_t fapl, void** file_handle) +{ + herr_t ret_value; + + FUNC_ENTER_API(H5FDget_vfd_handle, FAIL); + + /* Check arguments */ + assert(file); + assert(file_handle); + ret_value=H5FD_get_vfd_handle(file, fapl, file_handle); + +done: + FUNC_LEAVE(ret_value); +} + + +/*-------------------------------------------------------------------------- + * Function: H5FD_get_vfd_handle + * + * Purpose: Retrieve the file handle for file driver. + * + * Return: Non-negative if succeed; negative if fails. + * + * Programmer: Raymond Lu + * Sep. 16, 2002 + * + * Modifications: + * + *-------------------------------------------------------------------------- + */ +herr_t H5FD_get_vfd_handle(H5FD_t *file, hid_t fapl, void** file_handle) +{ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_NOAPI(H5FD_get_vfd_handle, FAIL); + + assert(file_handle); + if(file->cls->get_handle && ((ret_value=file->cls->get_handle(file, fapl, file_handle)) < 0)) + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't get file handle for file driver"); + +done: + FUNC_LEAVE(ret_value); +} diff --git a/src/H5FDcore.c b/src/H5FDcore.c index f15120d..cb36223 100644 --- a/src/H5FDcore.c +++ b/src/H5FDcore.c @@ -66,7 +66,7 @@ typedef struct H5FD_core_fapl_t { * REGION_OVERFLOW: Checks whether an address and size pair describe data * which can be addressed entirely in memory. */ -#define MAXADDR ((haddr_t)~(size_t)0) +#define MAXADDR ((haddr_t)((~(size_t)0)-1)) #define ADDR_OVERFLOW(A) (HADDR_UNDEF==(A) || \ ((A) & ~(haddr_t)MAXADDR)) #define SIZE_OVERFLOW(Z) ((Z) & ~(hsize_t)MAXADDR) @@ -84,6 +84,7 @@ static int H5FD_core_cmp(const H5FD_t *_f1, const H5FD_t *_f2); static haddr_t H5FD_core_get_eoa(H5FD_t *_file); static herr_t H5FD_core_set_eoa(H5FD_t *_file, haddr_t addr); static haddr_t H5FD_core_get_eof(H5FD_t *_file); +static herr_t H5FD_core_get_handle(H5FD_t *_file, hid_t fapl, void** file_handle); static herr_t H5FD_core_read(H5FD_t *_file, H5FD_mem_t type, hid_t fapl_id, haddr_t addr, size_t size, void *buf); static herr_t H5FD_core_write(H5FD_t *_file, H5FD_mem_t type, hid_t fapl_id, haddr_t addr, @@ -112,6 +113,7 @@ static const H5FD_class_t H5FD_core_g = { H5FD_core_get_eoa, /*get_eoa */ H5FD_core_set_eoa, /*set_eoa */ H5FD_core_get_eof, /*get_eof */ + H5FD_core_get_handle, /*get_handle */ H5FD_core_read, /*read */ H5FD_core_write, /*write */ H5FD_core_flush, /*flush */ @@ -189,7 +191,7 @@ H5Pset_fapl_core(hid_t fapl_id, size_t increment, hbool_t backing_store) H5P_genplist_t *plist; /* Property list pointer */ herr_t ret_value; - FUNC_ENTER_API(H5FD_set_fapl_core, FAIL); + FUNC_ENTER_API(H5Pset_fapl_core, FAIL); H5TRACE3("e","izb",fapl_id,increment,backing_store); /* Check argument */ @@ -621,6 +623,38 @@ done: /*------------------------------------------------------------------------- + * Function: H5FD_core_get_handle + * + * Purpose: Returns the file handle of CORE file driver. + * + * Returns: Non-negative if succeed or negative if fails. + * + * Programmer: Raymond Lu + * Sept. 16, 2002 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +static herr_t +H5FD_core_get_handle(H5FD_t *_file, hid_t UNUSED fapl, void** file_handle) +{ + H5FD_core_t *file = (H5FD_core_t *)_file; + herr_t ret_value = SUCCEED; + + FUNC_ENTER_NOAPI(H5FD_core_get_handle, FAIL); + + if(!file_handle) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file handle not valid"); + + *file_handle = &(file->mem); + +done: + FUNC_LEAVE(ret_value); +} + + +/*------------------------------------------------------------------------- * Function: H5FD_core_read * * Purpose: Reads SIZE bytes of data from FILE beginning at address ADDR diff --git a/src/H5FDfamily.c b/src/H5FDfamily.c index a71fd64..00a98db 100644 --- a/src/H5FDfamily.c +++ b/src/H5FDfamily.c @@ -77,6 +77,7 @@ static herr_t H5FD_family_query(const H5FD_t *_f1, unsigned long *flags); static haddr_t H5FD_family_get_eoa(H5FD_t *_file); static herr_t H5FD_family_set_eoa(H5FD_t *_file, haddr_t eoa); static haddr_t H5FD_family_get_eof(H5FD_t *_file); +static herr_t H5FD_family_get_handle(H5FD_t *_file, hid_t fapl, void** file_handle); static herr_t H5FD_family_read(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, size_t size, void *_buf/*out*/); static herr_t H5FD_family_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, @@ -107,6 +108,7 @@ static const H5FD_class_t H5FD_family_g = { H5FD_family_get_eoa, /*get_eoa */ H5FD_family_set_eoa, /*set_eoa */ H5FD_family_get_eof, /*get_eof */ + H5FD_family_get_handle, /*get_handle */ H5FD_family_read, /*read */ H5FD_family_write, /*write */ H5FD_family_flush, /*flush */ @@ -500,7 +502,7 @@ H5FD_family_open(const char *name, unsigned flags, hid_t fapl_id, char memb_name[4096], temp[4096]; hsize_t eof; unsigned t_flags = flags & ~H5F_ACC_CREAT; - H5P_genplist_t *plist; /* Property list pointer */ + H5P_genplist_t *plist; /* Property list pointer */ FUNC_ENTER_NOAPI(H5FD_family_open, NULL); @@ -893,6 +895,50 @@ done: /*------------------------------------------------------------------------- + * Function: H5FD_family_get_handle + * + * Purpose: Returns the file handle of FAMILY file driver. + * + * Returns: Non-negative if succeed or negative if fails. + * + * Programmer: Raymond Lu + * Sept. 16, 2002 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +static herr_t +H5FD_family_get_handle(H5FD_t *_file, hid_t fapl, void** file_handle) +{ + H5FD_family_t *file = (H5FD_family_t *)_file; + H5P_genplist_t *plist; + hsize_t offset; + int memb; + herr_t ret_value; + + FUNC_ENTER_NOAPI(H5FD_family_get_handle, FAIL); + + /* Get the plist structure and family offset */ + if(H5P_DEFAULT == fapl) + fapl = H5Pcreate(H5P_FILE_ACCESS); + if(NULL == (plist = H5P_object_verify(fapl, H5P_FILE_ACCESS))) + HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID"); + if(H5P_get(plist, H5F_ACS_FAMILY_OFFSET_NAME, &offset) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get offset for family driver"); + + if(offset>(file->memb_size*file->nmembs)) + HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "offset is bigger than file size"); + memb = (int)(offset/file->memb_size); + + ret_value = H5FD_get_vfd_handle(file->memb[memb], fapl, file_handle); + +done: + FUNC_LEAVE(ret_value); +} + + +/*------------------------------------------------------------------------- * Function: H5FD_family_read * * Purpose: Reads SIZE bytes of data from FILE beginning at address ADDR @@ -922,8 +968,8 @@ H5FD_family_read(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, si haddr_t sub; size_t req; hsize_t tempreq; - H5P_genplist_t *plist; /* Property list pointer */ - herr_t ret_value=SUCCEED; /* Return value */ + H5P_genplist_t *plist; /* Property list pointer */ + herr_t ret_value=SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(H5FD_family_read, FAIL); diff --git a/src/H5FDgass.c b/src/H5FDgass.c index 6f761a7..1f01240 100644 --- a/src/H5FDgass.c +++ b/src/H5FDgass.c @@ -118,6 +118,7 @@ static herr_t H5FD_gass_query(const H5FD_t *_f1, unsigned long *flags); static haddr_t H5FD_gass_get_eoa(H5FD_t *_file); static herr_t H5FD_gass_set_eoa(H5FD_t *_file, haddr_t addr); static haddr_t H5FD_gass_get_eof(H5FD_t *_file); +static herr_t H5FD_gass_get_handle(H5FD_t *_file, hid_t fapl, void** file_handle); static herr_t H5FD_gass_read(H5FD_t *_file, H5FD_mem_t type, hid_t fapl_id, haddr_t addr, size_t size, void *buf); static herr_t H5FD_gass_write(H5FD_t *_file, H5FD_mem_t type, hid_t fapl_id, haddr_t addr, @@ -152,6 +153,7 @@ static const H5FD_class_t H5FD_gass_g = { H5FD_gass_get_eoa, /*get_eoa */ H5FD_gass_set_eoa, /*set_eoa */ H5FD_gass_get_eof, /*get_eof */ + H5FD_gass_get_handle, /*get_handle */ H5FD_gass_read, /*read */ H5FD_gass_write, /*write */ NULL, /*flush */ @@ -613,6 +615,38 @@ done: /*------------------------------------------------------------------------- + * Function: H5FD_gass_get_handle + * + * Purpose: Returns the file handle of GASS file driver. + * + * Returns: Non-negative if succeed or negative if fails. + * + * Programmer: Raymond Lu + * Sept. 16, 2002 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +static herr_t +H5FD_gass_get_handle(H5FD_t *_file, hid_t UNUSED fapl, void** file_handle) +{ + H5FD_gass_t *file = (H5FD_gass_t *)_file; + herr_t ret_value = SUCCEED; + + FUNC_ENTER_NOAPI(H5FD_gass_get_handle, FAIL); + + if(!file_handle) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file handle not valid"); + + *file_handle = &(file->fd); + +done: + FUNC_LEAVE(ret_value); +} + + +/*------------------------------------------------------------------------- * Function: H5FD_gass_read * * Purpose: Reads SIZE bytes of data from FILE beginning at address ADDR diff --git a/src/H5FDlog.c b/src/H5FDlog.c index 33d57c5..5e81260 100644 --- a/src/H5FDlog.c +++ b/src/H5FDlog.c @@ -170,6 +170,7 @@ static haddr_t H5FD_log_alloc(H5FD_t *_file, H5FD_mem_t type, hsize_t size); static haddr_t H5FD_log_get_eoa(H5FD_t *_file); static herr_t H5FD_log_set_eoa(H5FD_t *_file, haddr_t addr); static haddr_t H5FD_log_get_eof(H5FD_t *_file); +static herr_t H5FD_log_get_handle(H5FD_t *_file, hid_t fapl, void** file_handle); static herr_t H5FD_log_read(H5FD_t *_file, H5FD_mem_t type, hid_t fapl_id, haddr_t addr, size_t size, void *buf); static herr_t H5FD_log_write(H5FD_t *_file, H5FD_mem_t type, hid_t fapl_id, haddr_t addr, @@ -212,6 +213,7 @@ static const H5FD_class_t H5FD_log_g = { H5FD_log_get_eoa, /*get_eoa */ H5FD_log_set_eoa, /*set_eoa */ H5FD_log_get_eof, /*get_eof */ + H5FD_log_get_handle, /*get_handle */ H5FD_log_read, /*read */ H5FD_log_write, /*write */ H5FD_log_flush, /*flush */ @@ -965,6 +967,38 @@ done: /*------------------------------------------------------------------------- + * Function: H5FD_log_get_handle + * + * Purpose: Returns the file handle of LOG file driver. + * + * Returns: Non-negative if succeed or negative if fails. + * + * Programmer: Raymond Lu + * Sept. 16, 2002 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +static herr_t +H5FD_log_get_handle(H5FD_t *_file, hid_t UNUSED fapl, void** file_handle) +{ + H5FD_log_t *file = (H5FD_log_t *)_file; + herr_t ret_value = SUCCEED; + + FUNC_ENTER_NOAPI(H5FD_log_get_handle, FAIL); + + if(!file_handle) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file handle not valid"); + + *file_handle = &(file->fd); + +done: + FUNC_LEAVE(ret_value); +} + + +/*------------------------------------------------------------------------- * Function: H5FD_log_read * * Purpose: Reads SIZE bytes of data from FILE beginning at address ADDR diff --git a/src/H5FDmpio.c b/src/H5FDmpio.c index 25f530e..3453a3b 100644 --- a/src/H5FDmpio.c +++ b/src/H5FDmpio.c @@ -67,6 +67,7 @@ static herr_t H5FD_mpio_query(const H5FD_t *_f1, unsigned long *flags); static haddr_t H5FD_mpio_get_eoa(H5FD_t *_file); static herr_t H5FD_mpio_set_eoa(H5FD_t *_file, haddr_t addr); static haddr_t H5FD_mpio_get_eof(H5FD_t *_file); +static herr_t H5FD_mpio_get_handle(H5FD_t *_file, hid_t fapl, void** file_handle); static herr_t H5FD_mpio_read(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, size_t size, void *buf); static herr_t H5FD_mpio_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, @@ -103,6 +104,7 @@ static const H5FD_class_t H5FD_mpio_g = { H5FD_mpio_get_eoa, /*get_eoa */ H5FD_mpio_set_eoa, /*set_eoa */ H5FD_mpio_get_eof, /*get_eof */ + H5FD_mpio_get_handle, /*get_handle */ H5FD_mpio_read, /*read */ H5FD_mpio_write, /*write */ H5FD_mpio_flush, /*flush */ @@ -1176,6 +1178,38 @@ done: /*------------------------------------------------------------------------- + * Function: H5FD_mpio_get_handle + * + * Purpose: Returns the file handle of MPIO file driver. + * + * Returns: Non-negative if succeed or negative if fails. + * + * Programmer: Raymond Lu + * Sept. 16, 2002 + * + * Modifications: + * + *------------------------------------------------------------------------- +*/ +static herr_t +H5FD_mpio_get_handle(H5FD_t *_file, hid_t fapl, void** file_handle) +{ + H5FD_mpio_t *file = (H5FD_mpio_t *)_file; + herr_t ret_value = SUCCEED; + + FUNC_ENTER_NOAPI(H5FD_mpio_get_handle, FAIL); + + if(!file_handle) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file handle not valid"); + + *file_handle = &(file->f); + +done: + FUNC_LEAVE(ret_value); +} + + +/*------------------------------------------------------------------------- * Function: H5FD_mpio_read * * Purpose: Reads SIZE bytes of data from FILE beginning at address ADDR diff --git a/src/H5FDmpiposix.c b/src/H5FDmpiposix.c index 4a37775..4b5a26c 100644 --- a/src/H5FDmpiposix.c +++ b/src/H5FDmpiposix.c @@ -164,6 +164,7 @@ static herr_t H5FD_mpiposix_query(const H5FD_t *_f1, unsigned long *flags); static haddr_t H5FD_mpiposix_get_eoa(H5FD_t *_file); static herr_t H5FD_mpiposix_set_eoa(H5FD_t *_file, haddr_t addr); static haddr_t H5FD_mpiposix_get_eof(H5FD_t *_file); +static herr_t H5FD_mpiposix_get_handle(H5FD_t *_file, hid_t fapl, void** file_handle); static herr_t H5FD_mpiposix_read(H5FD_t *_file, H5FD_mem_t type, hid_t fapl_id, haddr_t addr, size_t size, void *buf); static herr_t H5FD_mpiposix_write(H5FD_t *_file, H5FD_mem_t type, hid_t fapl_id, haddr_t addr, @@ -199,6 +200,7 @@ static const H5FD_class_t H5FD_mpiposix_g = { H5FD_mpiposix_get_eoa, /*get_eoa */ H5FD_mpiposix_set_eoa, /*set_eoa */ H5FD_mpiposix_get_eof, /*get_eof */ + H5FD_mpiposix_get_handle, /*get_handle */ H5FD_mpiposix_read, /*read */ H5FD_mpiposix_write, /*write */ H5FD_mpiposix_flush, /*flush */ @@ -953,6 +955,38 @@ done: /*------------------------------------------------------------------------- + * Function: H5FD_mpiposix_get_handle + * + * Purpose: Returns the file handle of MPI-POSIX file driver. + * + * Returns: Non-negative if succeed or negative if fails. + * + * Programmer: Raymond Lu + * Sept. 16, 2002 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +static herr_t +H5FD_mpiposix_get_handle(H5FD_t *_file, hid_t UNUSED fapl, void** file_handle) +{ + H5FD_mpiposix_t *file = (H5FD_mpiposix_t *)_file; + herr_t ret_value = SUCCEED; + + FUNC_ENTER_NOAPI(H5FD_mpiposix_get_handle, FAIL); + + if(!file_handle) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file handle not valid"); + + *file_handle = &(file->fd); + +done: + FUNC_LEAVE(ret_value); +} + + +/*------------------------------------------------------------------------- * Function: H5FD_mpiposix_read * * Purpose: Reads SIZE bytes of data from FILE beginning at address ADDR diff --git a/src/H5FDmulti.c b/src/H5FDmulti.c index 3d56cc9..9a9667e 100644 --- a/src/H5FDmulti.c +++ b/src/H5FDmulti.c @@ -122,6 +122,7 @@ static herr_t H5FD_multi_query(const H5FD_t *_f1, unsigned long *flags); static haddr_t H5FD_multi_get_eoa(H5FD_t *_file); static herr_t H5FD_multi_set_eoa(H5FD_t *_file, haddr_t eoa); static haddr_t H5FD_multi_get_eof(H5FD_t *_file); +static herr_t H5FD_multi_get_handle(H5FD_t *_file, hid_t fapl, void** file_handle); static haddr_t H5FD_multi_alloc(H5FD_t *_file, H5FD_mem_t type, hsize_t size); static herr_t H5FD_multi_free(H5FD_t *_file, H5FD_mem_t type, haddr_t addr, hsize_t size); @@ -155,6 +156,7 @@ static const H5FD_class_t H5FD_multi_g = { H5FD_multi_get_eoa, /*get_eoa */ H5FD_multi_set_eoa, /*set_eoa */ H5FD_multi_get_eof, /*get_eof */ + H5FD_multi_get_handle, /*get_handle */ H5FD_multi_read, /*read */ H5FD_multi_write, /*write */ H5FD_multi_flush, /*flush */ @@ -1516,6 +1518,39 @@ H5FD_multi_get_eof(H5FD_t *_file) /*------------------------------------------------------------------------- + * Function: H5FD_multi_get_handle + * + * Purpose: Returns the file handle of MULTI file driver. + * + * Returns: Non-negative if succeed or negative if fails. + * + * Programmer: Raymond Lu + * Sept. 16, 2002 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +static herr_t +H5FD_multi_get_handle(H5FD_t *_file, hid_t fapl, void** file_handle) +{ + H5FD_multi_t *file = (H5FD_multi_t *)_file; + H5FD_mem_t type, mmt; + static const char *func="H5FD_multi_get_handle"; /* Function Name for error reporting */ + + /* Get data type for multi driver */ + if(H5Pget_multi_type(fapl, &type) < 0) + H5Epush_ret(func, H5E_INTERNAL, H5E_BADVALUE, "can't get data type for multi driver", -1); + if(type<H5FD_MEM_DEFAULT || type>=H5FD_MEM_NTYPES) + H5Epush_ret(func, H5E_INTERNAL, H5E_BADVALUE, "data type is out of range", -1); + mmt = file->fa.memb_map[type]; + if(H5FD_MEM_DEFAULT==mmt) mmt = type; + + return (H5FDget_vfd_handle(file->memb[mmt], fapl, file_handle)); +} + + +/*------------------------------------------------------------------------- * Function: H5FD_multi_alloc * * Purpose: Allocate file memory. diff --git a/src/H5FDmulti.h b/src/H5FDmulti.h index 3e06c59..36f3d67 100644 --- a/src/H5FDmulti.h +++ b/src/H5FDmulti.h @@ -11,6 +11,8 @@ #define H5FDmulti_H #include "H5Ipublic.h" +#include "H5Ppublic.h" /* Property lists */ +#include "H5Fpublic.h" #define H5FD_MULTI (H5FD_multi_init()) diff --git a/src/H5FDprivate.h b/src/H5FDprivate.h index 6e57189..187af34 100644 --- a/src/H5FDprivate.h +++ b/src/H5FDprivate.h @@ -40,5 +40,6 @@ H5_DLL herr_t H5FD_write(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t a const void *buf); H5_DLL herr_t H5FD_flush(H5FD_t *file, unsigned closing); H5_DLL herr_t H5FD_get_fileno(const H5FD_t *file, unsigned long *filenum); +H5_DLL herr_t H5FD_get_vfd_handle(H5FD_t *file, hid_t fapl, void** file_handle); #endif /* !_H5FDprivate_H */ diff --git a/src/H5FDpublic.h b/src/H5FDpublic.h index fa4c5ad..b81eed7 100644 --- a/src/H5FDpublic.h +++ b/src/H5FDpublic.h @@ -145,6 +145,7 @@ typedef struct H5FD_class_t { haddr_t (*get_eoa)(H5FD_t *file); herr_t (*set_eoa)(H5FD_t *file, haddr_t addr); haddr_t (*get_eof)(H5FD_t *file); + herr_t (*get_handle)(H5FD_t *file, hid_t fapl, void**file_handle); herr_t (*read)(H5FD_t *file, H5FD_mem_t type, hid_t dxpl, haddr_t addr, size_t size, void *buffer); herr_t (*write)(H5FD_t *file, H5FD_mem_t type, hid_t dxpl, haddr_t addr, size_t size, @@ -214,6 +215,7 @@ H5_DLL haddr_t H5FDrealloc(H5FD_t *file, H5FD_mem_t type, haddr_t addr, H5_DLL haddr_t H5FDget_eoa(H5FD_t *file); H5_DLL herr_t H5FDset_eoa(H5FD_t *file, haddr_t eof); H5_DLL haddr_t H5FDget_eof(H5FD_t *file); +H5_DLL herr_t H5FDget_vfd_handle(H5FD_t *file, hid_t fapl, void**file_handle); H5_DLL herr_t H5FDread(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, size_t size, void *buf/*out*/); H5_DLL herr_t H5FDwrite(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, size_t size, diff --git a/src/H5FDsec2.c b/src/H5FDsec2.c index 4e2b1e2..f65bcbe 100644 --- a/src/H5FDsec2.c +++ b/src/H5FDsec2.c @@ -138,6 +138,7 @@ static herr_t H5FD_sec2_query(const H5FD_t *_f1, unsigned long *flags); static haddr_t H5FD_sec2_get_eoa(H5FD_t *_file); static herr_t H5FD_sec2_set_eoa(H5FD_t *_file, haddr_t addr); static haddr_t H5FD_sec2_get_eof(H5FD_t *_file); +static herr_t H5FD_sec2_get_handle(H5FD_t *_file, hid_t fapl, void** file_handle); static herr_t H5FD_sec2_read(H5FD_t *_file, H5FD_mem_t type, hid_t fapl_id, haddr_t addr, size_t size, void *buf); static herr_t H5FD_sec2_write(H5FD_t *_file, H5FD_mem_t type, hid_t fapl_id, haddr_t addr, @@ -167,6 +168,7 @@ static const H5FD_class_t H5FD_sec2_g = { H5FD_sec2_get_eoa, /*get_eoa */ H5FD_sec2_set_eoa, /*set_eoa */ H5FD_sec2_get_eof, /*get_eof */ + H5FD_sec2_get_handle, /*get_handle */ H5FD_sec2_read, /*read */ H5FD_sec2_write, /*write */ H5FD_sec2_flush, /*flush */ @@ -570,6 +572,37 @@ done: /*------------------------------------------------------------------------- + * Function: H5FD_sec2_get_handle + * + * Purpose: Returns the file handle of sec2 file driver. + * + * Returns: Non-negative if succeed or negative if fails. + * + * Programmer: Raymond Lu + * Sept. 16, 2002 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +static herr_t +H5FD_sec2_get_handle(H5FD_t *_file, hid_t UNUSED fapl, void** file_handle) +{ + H5FD_sec2_t *file = (H5FD_sec2_t *)_file; + herr_t ret_value = SUCCEED; + + FUNC_ENTER_NOAPI(H5FD_sec2_get_handle, FAIL); + + if(!file_handle) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file handle not valid"); + *file_handle = &(file->fd); + +done: + FUNC_LEAVE(ret_value); +} + + +/*------------------------------------------------------------------------- * Function: H5FD_sec2_read * * Purpose: Reads SIZE bytes of data from FILE beginning at address ADDR diff --git a/src/H5FDsrb.c b/src/H5FDsrb.c index 4dde148..bd44382 100644 --- a/src/H5FDsrb.c +++ b/src/H5FDsrb.c @@ -85,6 +85,7 @@ static herr_t H5FD_srb_query(const H5FD_t *_f1, unsigned long *flags); static haddr_t H5FD_srb_get_eoa(H5FD_t *_file); static herr_t H5FD_srb_set_eoa(H5FD_t *_file, haddr_t addr); static haddr_t H5FD_srb_get_eof(H5FD_t *_file); +static herr_t H5FD_srb_get_handle(H5FD_t *_file, hid_t fapl, void** file_handle); static herr_t H5FD_srb_read(H5FD_t *_file, H5FD_mem_t type, hid_t fapl_id, haddr_t addr, size_t size, void *buf); static herr_t H5FD_srb_write(H5FD_t *_file, H5FD_mem_t type, hid_t fapl_id, haddr_t addr, @@ -131,6 +132,7 @@ static const H5FD_class_t H5FD_srb_g = { H5FD_srb_get_eoa, /*get_eoa */ H5FD_srb_set_eoa, /*set_eoa */ H5FD_srb_get_eof, /*get_eof */ + H5FD_srb_get_handle, /*get_handle */ H5FD_srb_read, /*read */ H5FD_srb_write, /*write */ H5FD_srb_flush, /*flush */ @@ -577,6 +579,38 @@ done: /*------------------------------------------------------------------------- + * Function: H5FD_srb_get_handle + * + * Purpose: Returns the file handle of SRB file driver. + * + * Returns: Non-negative if succeed or negative if fails. + * + * Programmer: Raymond Lu + * Sept. 16, 2002 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +static herr_t +H5FD_srb_get_handle(H5FD_t *_file, hid_t UNUSED fapl, void** file_handle) +{ + H5FD_srb_t *file = (H5FD_srb_t *)_file; + herr_t ret_value = SUCCEED; + + FUNC_ENTER_NOAPI(H5FD_srb_get_eof, FAIL); + + if(!file_handle) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file handle not valid"); + + *file_handle = &(file->fd); + +done: + FUNC_LEAVE(ret_value); +} + + +/*------------------------------------------------------------------------- * Function: H5FD_srb_read * * Purpose: Reads SIZE bytes of data from FILE beginning at address ADDR diff --git a/src/H5FDstdio.c b/src/H5FDstdio.c index 2ae8398..a94812e 100644 --- a/src/H5FDstdio.c +++ b/src/H5FDstdio.c @@ -137,6 +137,7 @@ static herr_t H5FD_stdio_query(const H5FD_t *_f1, unsigned long *flags); static haddr_t H5FD_stdio_get_eoa(H5FD_t *_file); static herr_t H5FD_stdio_set_eoa(H5FD_t *_file, haddr_t addr); static haddr_t H5FD_stdio_get_eof(H5FD_t *_file); +static herr_t H5FD_stdio_get_handle(H5FD_t *_file, hid_t fapl, void** file_handle); static herr_t H5FD_stdio_read(H5FD_t *lf, H5FD_mem_t type, hid_t fapl_id, haddr_t addr, size_t size, void *buf); static herr_t H5FD_stdio_write(H5FD_t *lf, H5FD_mem_t type, hid_t fapl_id, haddr_t addr, @@ -166,6 +167,7 @@ static const H5FD_class_t H5FD_stdio_g = { H5FD_stdio_get_eoa, /*get_eoa */ H5FD_stdio_set_eoa, /*set_eoa */ H5FD_stdio_get_eof, /*get_eof */ + H5FD_stdio_get_handle, /*get_handle */ H5FD_stdio_read, /*read */ H5FD_stdio_write, /*write */ H5FD_stdio_flush, /*flush */ @@ -576,6 +578,36 @@ H5FD_stdio_get_eof(H5FD_t *_file) /*------------------------------------------------------------------------- + * Function: H5FD_stdio_get_handle + * + * Purpose: Returns the file handle of stdio file driver. + * + * Returns: Non-negative if succeed or negative if fails. + * + * Programmer: Raymond Lu + * Sept. 16, 2002 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +static herr_t +H5FD_stdio_get_handle(H5FD_t *_file, hid_t fapl, void** file_handle) +{ + H5FD_stdio_t *file = (H5FD_stdio_t *)_file; + static const char *func="H5FD_stdio_get_handle"; /* Function Name for error reporting */ + + /* Clear the error stack */ + H5Eclear(); + + *file_handle = &(file->fp); + if(*file_handle==NULL) + H5Epush_ret(func, H5E_IO, H5E_WRITEERROR, "get handle failed", -1); + return(0); +} + + +/*------------------------------------------------------------------------- * Function: H5F_stdio_read * * Purpose: Reads SIZE bytes beginning at address ADDR in file LF and diff --git a/src/H5FDstream.c b/src/H5FDstream.c index 2883d13..ee3ca99 100644 --- a/src/H5FDstream.c +++ b/src/H5FDstream.c @@ -159,6 +159,7 @@ static herr_t H5FD_stream_query(const H5FD_t *_f1, unsigned long *flags); static haddr_t H5FD_stream_get_eoa (H5FD_t *_stream); static herr_t H5FD_stream_set_eoa (H5FD_t *_stream, haddr_t addr); static haddr_t H5FD_stream_get_eof (H5FD_t *_stream); +static herr_t H5FD_stream_get_handle(H5FD_t *_file, hid_t fapl, void** file_handle); static herr_t H5FD_stream_read (H5FD_t *_stream, H5FD_mem_t type, hid_t fapl_id, haddr_t addr, size_t size, void *buf); @@ -191,6 +192,7 @@ static const H5FD_class_t H5FD_stream_g = H5FD_stream_get_eoa, /* get_eoa */ H5FD_stream_set_eoa, /* set_eoa */ H5FD_stream_get_eof, /* get_eof */ + H5FD_stream_get_handle, /* get_handle */ H5FD_stream_read, /* read */ H5FD_stream_write, /* write */ H5FD_stream_flush, /* flush */ @@ -929,6 +931,38 @@ done: /*------------------------------------------------------------------------- + * Function: H5FD_stream_get_handle + * + * Purpose: Returns the file handle of stream file driver. + * + * Returns: Non-negative if succeed or negative if fails. + * + * Programmer: Raymond Lu + * Sept. 16, 2002 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +static herr_t +H5FD_stream_get_handle(H5FD_t *_file, hid_t UNUSED fapl, void** file_handle) +{ + H5FD_stream_t *file = (H5FD_stream_t *)_file; + herr_t ret_value = SUCCEED; + + FUNC_ENTER_NOAPI(H5FD_stream_get_handle, FAIL); + + if(!file_handle) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file handle not valid"); + + *file_handle = &(file->socket); + +done: + FUNC_LEAVE(ret_value); +} + + +/*------------------------------------------------------------------------- * Function: H5FD_stream_read * * Purpose: Reads SIZE bytes of data from FILE beginning at address ADDR diff --git a/src/H5Fprivate.h b/src/H5Fprivate.h index 32c9759..3f5de41 100644 --- a/src/H5Fprivate.h +++ b/src/H5Fprivate.h @@ -320,6 +320,16 @@ H5_DLL size_t H5F_sizeof_size(const H5F_t *f); #define H5F_CLOSE_DEGREE_SIZE sizeof(H5F_close_degree_t) #define H5F_CLOSE_DEGREE_DEF H5F_CLOSE_DEFAULT +/* Definition for offset position in file for family file driver */ +#define H5F_ACS_FAMILY_OFFSET_NAME "family_offset" +#define H5F_ACS_FAMILY_OFFSET_SIZE sizeof(hsize_t) +#define H5F_ACS_FAMILY_OFFSET_DEF 0 + +/* Definition for data type in multi file driver */ +#define H5F_ACS_MULTI_TYPE_NAME "multi_type" +#define H5F_ACS_MULTI_TYPE_SIZE sizeof(H5FD_mem_t) +#define H5F_ACS_MULTI_TYPE_DEF H5FD_MEM_DEFAULT + /* ======================== File Mount properties ====================*/ /* Definition for whether absolute symlinks local to file. */ #define H5F_MNT_SYM_LOCAL_NAME "local" @@ -343,6 +353,7 @@ H5_DLL herr_t H5F_get_fileno(const H5F_t *f, unsigned long *filenum); H5_DLL herr_t H5F_get_obj_count(H5F_t *f, unsigned types, unsigned *obj_id_count); H5_DLL herr_t H5F_get_obj_ids(H5F_t *f, unsigned types, hid_t *obj_id_list); +H5_DLL herr_t H5F_get_vfd_handle(H5F_t *file, hid_t fapl, void** file_handle); /* Functions that operate on array storage */ H5_DLL herr_t H5F_arr_read (H5F_t *f, hid_t dxpl_id, diff --git a/src/H5Fpublic.h b/src/H5Fpublic.h index fc23620..adddd83 100644 --- a/src/H5Fpublic.h +++ b/src/H5Fpublic.h @@ -94,6 +94,7 @@ 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_obj_count(hid_t file_id, unsigned types, unsigned *obj_id_count); +H5_DLL herr_t H5Fget_vfd_handle(hid_t file_id, hid_t fapl, void** file_handle); H5_DLL herr_t H5Fget_obj_ids(hid_t file_id, unsigned types, hid_t *obj_id_list); H5_DLL herr_t H5Fmount(hid_t loc, const char *name, hid_t child, hid_t plist); H5_DLL herr_t H5Funmount(hid_t loc, const char *name); diff --git a/src/H5Pfapl.c b/src/H5Pfapl.c index c58711e..2e32e0a 100644 --- a/src/H5Pfapl.c +++ b/src/H5Pfapl.c @@ -498,9 +498,305 @@ done: FUNC_LEAVE(ret_value); } /* end H5Pget_driver_info() */ -#ifdef H5_WANT_H5_V1_4_COMPAT /*------------------------------------------------------------------------- + * Function: H5Pset_family_offset + * + * Purpose: Set offset for family driver. This file access property + * list will be passed to H5Fget_vfd_handle or H5FDget_vfd_handle + * to retrieve VFD file handle. + * + * Return: Success: Non-negative value. + * + * Failure: Negative value. + * + * Programmer: Raymond Lu + * Sep 17, 2002 + * + * Modifications: + * + *------------------------------------------------------------------------- +*/ +herr_t H5Pset_family_offset(hid_t fapl_id, hsize_t offset) +{ + H5P_genplist_t *plist; /* Property list pointer */ + herr_t ret_value=SUCCEED; /* return value */ + + FUNC_ENTER_API(H5Pset_family_offset, FAIL); + + /* Get the plist structure */ + if(H5P_DEFAULT == fapl_id) + fapl_id = H5Pcreate(H5P_FILE_ACCESS); + if(NULL == (plist = H5P_object_verify(fapl_id,H5P_FILE_ACCESS))) + HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID"); + /* Set values */ + if((ret_value=H5P_set_family_offset(plist, offset)) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set family offset"); + +done: + FUNC_LEAVE(ret_value); +} + + +/*------------------------------------------------------------------------- + * Function: H5P_set_family_offset + * + * Purpose: Set offset for family driver. Private function for + * H5Pset_family_offset + * + * Return: Success: Non-negative value. + * + * Failure: Negative value. + * + * Programmer: Raymond Lu + * Sep 17, 2002 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +herr_t H5P_set_family_offset(H5P_genplist_t *plist, hsize_t offset) +{ + herr_t ret_value=SUCCEED; + + FUNC_ENTER_NOAPI(H5P_set_family_offset, FAIL); + + if( TRUE == H5P_isa_class(plist->plist_id, H5P_FILE_ACCESS) ) { + if(H5P_set(plist, H5F_ACS_FAMILY_OFFSET_NAME, &offset) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET,FAIL,"can't set offset for family file"); + } else { + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access or data transfer property list"); + } + +done: + FUNC_LEAVE(ret_value); +} + + +/*------------------------------------------------------------------------- + * Function: H5Pget_family_offset + * + * Purpose: Get offset for family driver. This file access property + * list will be passed to H5Fget_vfd_handle or H5FDget_vfd_handle + * to retrieve VFD file handle. + * + * Return: Success: Non-negative value. + * + * Failure: Negative value. + * + * Programmer: Raymond Lu + * Sep 17, 2002 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +herr_t H5Pget_family_offset(hid_t fapl_id, hsize_t *offset) +{ + H5P_genplist_t *plist; /* Property list pointer */ + herr_t ret_value=SUCCEED; /* return value */ + + FUNC_ENTER_API(H5Pget_family_offset, FAIL); + + /* Get the plist structure */ + if(H5P_DEFAULT == fapl_id) + fapl_id = H5Pcreate(H5P_FILE_ACCESS); + if(NULL == (plist = H5P_object_verify(fapl_id,H5P_FILE_ACCESS))) + HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID"); + /* Set values */ + if((ret_value=H5P_get_family_offset(plist, offset)) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't get family offset"); + +done: + FUNC_LEAVE(ret_value); +} + + +/*------------------------------------------------------------------------- + * Function: H5P_get_family_offset + * + * Purpose: Get offset for family driver. Private function for + * H5Pget_family_offset + * + * Return: Success: Non-negative value. + * + * Failure: Negative value. + * + * Programmer: Raymond Lu + * Sep 17, 2002 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +herr_t H5P_get_family_offset(H5P_genplist_t *plist, hsize_t *offset) +{ + herr_t ret_value=SUCCEED; + + FUNC_ENTER_NOAPI(H5P_get_family_offset, FAIL); + + if( TRUE == H5P_isa_class(plist->plist_id, H5P_FILE_ACCESS) ) { + if(H5P_get(plist, H5F_ACS_FAMILY_OFFSET_NAME, offset) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET,FAIL,"can't set offset for family file"); + } else { + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access or data transfer property list"); + } + +done: + FUNC_LEAVE(ret_value); +} + + +/*------------------------------------------------------------------------- + * Function: H5Pset_multi_type + * + * Purpose: Set data type for multi driver. This file access property + * list will be passed to H5Fget_vfd_handle or H5FDget_vfd_handle + * to retrieve VFD file handle. + * + * Return: Success: Non-negative value. + * + * Failure: Negative value. + * + * Programmer: Raymond Lu + * Sep 17, 2002 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +herr_t H5Pset_multi_type(hid_t fapl_id, H5FD_mem_t type) +{ + H5P_genplist_t *plist; /* Property list pointer */ + herr_t ret_value=SUCCEED; /* return value */ + + FUNC_ENTER_API(H5Pset_multi_type, FAIL); + + /* Get the plist structure */ + if(H5P_DEFAULT == fapl_id) + fapl_id = H5Pcreate(H5P_FILE_ACCESS); + if(NULL == (plist = H5P_object_verify(fapl_id,H5P_FILE_ACCESS))) + HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID"); + /* Set values */ + if((ret_value=H5P_set_multi_type(plist, type)) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set data type for multi driver"); + +done: + FUNC_LEAVE(ret_value); +} + + +/*------------------------------------------------------------------------- + * Function: H5P_set_multi_type + * + * Purpose: Set data type for multi file driver. Private function for + * H5Pset_multi_type. + * + * Return: Success: Non-negative value. + * + * Failure: Negative value. + * + * Programmer: Raymond Lu + * Sep 17, 2002 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +herr_t H5P_set_multi_type(H5P_genplist_t *plist, H5FD_mem_t type) +{ + herr_t ret_value=SUCCEED; + + FUNC_ENTER_NOAPI(H5P_set_multi_type, FAIL); + + if( TRUE == H5P_isa_class(plist->plist_id, H5P_FILE_ACCESS) ) { + if(H5P_set(plist, H5F_ACS_MULTI_TYPE_NAME, &type) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET,FAIL,"can't set type for multi driver"); + } else { + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access or data transfer property list"); + } + +done: + FUNC_LEAVE(ret_value); +} + + +/*------------------------------------------------------------------------- + * Function: H5Pget_multi_type + * + * Purpose: Get data type for multi driver. This file access property + * list will be passed to H5Fget_vfd_handle or H5FDget_vfd_handle + * to retrieve VFD file handle. + * + * Return: Success: Non-negative value. + * + * Failure: Negative value. + * + * Programmer: Raymond Lu + * Sep 17, 2002 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +herr_t H5Pget_multi_type(hid_t fapl_id, H5FD_mem_t *type) +{ + H5P_genplist_t *plist; /* Property list pointer */ + herr_t ret_value=SUCCEED; /* return value */ + + FUNC_ENTER_API(H5Pget_multi_type, FAIL); + + /* Get the plist structure */ + if(H5P_DEFAULT == fapl_id) + fapl_id = H5Pcreate(H5P_FILE_ACCESS); + if(NULL == (plist = H5P_object_verify(fapl_id,H5P_FILE_ACCESS))) + HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID"); + /* Set values */ + if((ret_value=H5P_get_multi_type(plist, type)) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't get data type for multi driver"); + +done: + FUNC_LEAVE(ret_value); +} + + +/*------------------------------------------------------------------------- + * Function: H5P_get_multi_type + * + * Purpose: Get data type for multi file driver. Private function for + * H5Pget_multi_type. + * + * Return: Success: Non-negative value. + * + * Failure: Negative value. + * + * Programmer: Raymond Lu + * Sep 17, 2002 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +herr_t H5P_get_multi_type(H5P_genplist_t *plist, H5FD_mem_t *type) +{ + herr_t ret_value=SUCCEED; + + FUNC_ENTER_NOAPI(H5P_get_multi_type, FAIL); + + if( TRUE == H5P_isa_class(plist->plist_id, H5P_FILE_ACCESS) ) { + if(H5P_get(plist, H5F_ACS_MULTI_TYPE_NAME, type) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET,FAIL,"can't get type for multi driver"); + } else { + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list"); + } + +done: + FUNC_LEAVE(ret_value); +} + + +#ifdef H5_WANT_H5_V1_4_COMPAT +/*------------------------------------------------------------------------- * Function: H5Pset_cache * * Purpose: Set the number of objects in the meta data cache and the diff --git a/src/H5Pprivate.h b/src/H5Pprivate.h index 03ab355..156943c 100644 --- a/src/H5Pprivate.h +++ b/src/H5Pprivate.h @@ -49,6 +49,10 @@ H5_DLL hid_t H5P_get_driver(H5P_genplist_t *plist); H5_DLL void * H5P_get_driver_info(H5P_genplist_t *plist); H5_DLL herr_t H5P_set_driver(H5P_genplist_t *plist, hid_t new_driver_id, const void *new_driver_info); +H5_DLL herr_t H5P_set_family_offset(H5P_genplist_t *plist, hsize_t offset); +H5_DLL herr_t H5P_get_family_offset(H5P_genplist_t *plist, hsize_t *offset); +H5_DLL herr_t H5P_set_multi_type(H5P_genplist_t *plist, H5FD_mem_t type); +H5_DLL herr_t H5P_get_multi_type(H5P_genplist_t *plist, H5FD_mem_t *type); H5_DLL herr_t H5P_set_vlen_mem_manager(H5P_genplist_t *plist, H5MM_allocate_t alloc_func, void *alloc_info, H5MM_free_t free_func, void *free_info); diff --git a/src/H5Ppublic.h b/src/H5Ppublic.h index f09356d..07cbec2 100644 --- a/src/H5Ppublic.h +++ b/src/H5Ppublic.h @@ -25,6 +25,7 @@ #include "H5Ipublic.h" #include "H5Dpublic.h" #include "H5Fpublic.h" +#include "H5FDpublic.h" #include "H5MMpublic.h" #include "H5Zpublic.h" @@ -179,6 +180,10 @@ H5_DLL herr_t H5Pset_driver(hid_t plist_id, hid_t driver_id, const void *driver_info); H5_DLL hid_t H5Pget_driver(hid_t plist_id); H5_DLL void *H5Pget_driver_info(hid_t plist_id); +H5_DLL herr_t H5Pset_family_offset(hid_t fapl_id, hsize_t offset); +H5_DLL herr_t H5Pget_family_offset(hid_t fapl_id, hsize_t *offset); +H5_DLL herr_t H5Pset_multi_type(hid_t fapl_id, H5FD_mem_t type); +H5_DLL herr_t H5Pget_multi_type(hid_t fapl_id, H5FD_mem_t *type); #ifdef H5_WANT_H5_V1_4_COMPAT H5_DLL herr_t H5Pset_buffer(hid_t plist_id, hsize_t size, void *tconv, void *bkg); |