diff options
-rw-r--r-- | src/H5B.c | 11 | ||||
-rw-r--r-- | src/H5Dseq.c | 4 | ||||
-rw-r--r-- | src/H5FD.c | 87 | ||||
-rw-r--r-- | src/H5FDcore.c | 47 | ||||
-rw-r--r-- | src/H5FDdpss.c | 16 | ||||
-rw-r--r-- | src/H5FDfamily.c | 112 | ||||
-rw-r--r-- | src/H5FDgass.c | 26 | ||||
-rw-r--r-- | src/H5FDlog.c | 23 | ||||
-rw-r--r-- | src/H5FDmpio.c | 65 | ||||
-rw-r--r-- | src/H5FDmulti.c | 3 | ||||
-rw-r--r-- | src/H5FDsec2.c | 9 | ||||
-rw-r--r-- | src/H5FDsrb.c | 33 | ||||
-rw-r--r-- | src/H5FDstdio.c | 10 | ||||
-rw-r--r-- | src/H5FDstream.c | 36 | ||||
-rw-r--r-- | src/H5FDstream.h | 2 | ||||
-rw-r--r-- | src/H5Farray.c | 4 | ||||
-rw-r--r-- | src/H5Fseq.c | 4 | ||||
-rw-r--r-- | src/H5G.c | 9 | ||||
-rw-r--r-- | src/H5Gnode.c | 9 | ||||
-rw-r--r-- | src/H5Ipublic.h | 9 | ||||
-rw-r--r-- | src/H5Oattr.c | 4 | ||||
-rw-r--r-- | src/H5Ppublic.h | 3 | ||||
-rw-r--r-- | src/H5Sall.c | 16 | ||||
-rw-r--r-- | src/H5Shyper.c | 37 | ||||
-rw-r--r-- | src/H5Smpio.c | 10 | ||||
-rw-r--r-- | src/H5Spoint.c | 10 | ||||
-rw-r--r-- | src/H5Tbit.c | 2 | ||||
-rw-r--r-- | src/H5Tvlen.c | 21 | ||||
-rw-r--r-- | src/Makefile.in | 4 |
29 files changed, 341 insertions, 285 deletions
@@ -96,6 +96,7 @@ #include "H5Eprivate.h" /*error handling */ #include "H5Fpkg.h" /*file access */ #include "H5FLprivate.h" /*Free Lists */ +#include "H5Iprivate.h" /*IDs */ #include "H5MFprivate.h" /*file memory management */ #include "H5MMprivate.h" /*core memory management */ #include "H5Pprivate.h" /*property lists */ @@ -310,15 +311,19 @@ int H5B_Kvalue(H5F_t *f, const H5B_class_t *type) { int btree_k[H5B_NUM_BTREE_ID]; + H5P_genplist_t *plist; FUNC_ENTER(H5B_Kvalue, FAIL); assert(f); assert(type); - if(H5P_get(f->shared->fcpl_id, H5F_CRT_BTREE_RANK_NAME, btree_k) < 0) - HRETURN_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, - "unable to get rank for btree internal nodes"); + /* Check arguments */ + if (NULL == (plist = H5I_object(f->shared->fcpl_id))) + HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "can't get property list"); + + if(H5P_get(plist, H5F_CRT_BTREE_RANK_NAME, btree_k) < 0) + HRETURN_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "unable to get rank for btree internal nodes"); FUNC_LEAVE(btree_k[type->id]); } /* end H5B_Kvalue() */ diff --git a/src/H5Dseq.c b/src/H5Dseq.c index 2a1a41e..bace23d 100644 --- a/src/H5Dseq.c +++ b/src/H5Dseq.c @@ -174,7 +174,7 @@ H5F_seq_readv(H5F_t *f, hid_t dxpl_id, const struct H5O_layout_t *layout, assert(real_buf); /* Make certain we have the correct type of property list */ assert(H5I_GENPROP_LST==H5I_get_type(dxpl_id)); - assert(TRUE==H5Pisa_class(dxpl_id,H5P_DATASET_XFER)); + assert(TRUE==H5P_isa_class(dxpl_id,H5P_DATASET_XFER)); #ifdef H5_HAVE_PARALLEL { @@ -558,7 +558,7 @@ H5F_seq_writev(H5F_t *f, hid_t dxpl_id, const struct H5O_layout_t *layout, assert(real_buf); /* Make certain we have the correct type of property list */ assert(H5I_GENPROP_LST==H5I_get_type(dxpl_id)); - assert(TRUE==H5Pisa_class(dxpl_id,H5P_DATASET_XFER)); + assert(TRUE==H5P_isa_class(dxpl_id,H5P_DATASET_XFER)); #ifdef H5_HAVE_PARALLEL { @@ -16,6 +16,7 @@ /* Packages needed by this file */ #include "H5private.h" /*library functions */ +#include "H5Dprivate.h" /*datasets */ #include "H5Eprivate.h" /*error handling */ #include "H5Fpkg.h" /*files */ #include "H5FDprivate.h" /*virtual file driver */ @@ -287,6 +288,7 @@ H5FDunregister(hid_t driver_id) H5FD_class_t * H5FD_get_class(hid_t id) { + H5P_genplist_t *plist; /* Property list pointer */ H5FD_class_t *ret_value=NULL; hid_t driver_id = -1; @@ -294,19 +296,24 @@ H5FD_get_class(hid_t id) if (H5I_VFL==H5I_get_type(id)) { ret_value = H5I_object(id); - } else if (H5I_GENPROP_LST == H5I_get_type(id) && - TRUE==H5Pisa_class(id,H5P_FILE_ACCESS)) { - if(H5P_get(id, H5F_ACS_FILE_DRV_ID_NAME, &driver_id) < 0) - HRETURN_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get driver ID"); - ret_value = H5FD_get_class(driver_id); - } else if (H5I_GENPROP_LST == H5I_get_type(id) && - TRUE==H5Pisa_class(id,H5P_DATASET_XFER)) { - ret_value = H5FD_get_class(H5P_peek_hid_t(id,H5D_XFER_VFL_ID_NAME)); } else { - HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, - "not a driver id, file access property list or " - "data transfer property list"); - } + /* Get the plist structure */ + if(NULL == (plist = H5I_object(id))) + HRETURN_ERROR(H5E_ATOM, H5E_BADATOM, NULL, "can't find object for ID"); + + if (TRUE==H5P_isa_class(id,H5P_FILE_ACCESS)) { + if(H5P_get(plist, H5F_ACS_FILE_DRV_ID_NAME, &driver_id) < 0) + HRETURN_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get driver ID"); + ret_value = H5FD_get_class(driver_id); + } else if (TRUE==H5P_isa_class(id,H5P_DATASET_XFER)) { + if(H5P_get(plist, H5D_XFER_VFL_ID_NAME, &driver_id) < 0) + HRETURN_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get driver ID"); + ret_value = H5FD_get_class(driver_id); + } else { + HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a driver id, file access property list or data transfer property list"); + } + } /* end if */ + FUNC_LEAVE(ret_value); } @@ -744,41 +751,33 @@ H5FD_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr) H5FD_t *file=NULL; hid_t driver_id = -1; size_t meta_block_size=0; + H5P_genplist_t *plist; /* Property list pointer */ FUNC_ENTER(H5FD_open, NULL); /* Check arguments */ if(H5P_DEFAULT == fapl_id) fapl_id = H5P_FILE_ACCESS_DEFAULT; - if(H5I_GENPROP_LST != H5I_get_type(fapl_id) || - TRUE != H5Pisa_class(fapl_id, H5P_FILE_ACCESS)) - HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, - "not a file access property list"); + if(TRUE != H5P_isa_class(fapl_id, H5P_FILE_ACCESS) || NULL == (plist = H5I_object(fapl_id))) + HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file access property list"); - if (0==maxaddr) { - HRETURN_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, - "zero format address range"); - } + if (0==maxaddr) + HRETURN_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "zero format address range"); - if(H5P_get(fapl_id, H5F_ACS_FILE_DRV_ID_NAME, &driver_id) < 0) + if(H5P_get(plist, H5F_ACS_FILE_DRV_ID_NAME, &driver_id) < 0) HRETURN_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get driver ID"); /* Get driver info */ - if (H5I_VFL!=H5I_get_type(driver_id) || - NULL==(driver=H5I_object(driver_id))) { - HRETURN_ERROR(H5E_VFL, H5E_BADVALUE, NULL, - "invalid driver ID in file access property list"); - } - if (NULL==driver->open) { - HRETURN_ERROR(H5E_VFL, H5E_UNSUPPORTED, NULL, - "file driver has no `open' method"); - } + if (H5I_VFL!=H5I_get_type(driver_id) || NULL==(driver=H5I_object(driver_id))) + HRETURN_ERROR(H5E_VFL, H5E_BADVALUE, NULL, "invalid driver ID in file access property list"); + if (NULL==driver->open) + HRETURN_ERROR(H5E_VFL, H5E_UNSUPPORTED, NULL, "file driver has no `open' method"); /* Dispatch to file driver */ - if (HADDR_UNDEF==maxaddr) maxaddr = driver->maxaddr; - if (NULL==(file=(driver->open)(name, flags, fapl_id, maxaddr))) { + if (HADDR_UNDEF==maxaddr) + maxaddr = driver->maxaddr; + if (NULL==(file=(driver->open)(name, flags, fapl_id, maxaddr))) HRETURN_ERROR(H5E_VFL, H5E_CANTINIT, NULL, "open failed"); - } /* * Fill in public fields. We must increment the reference count on the @@ -789,17 +788,15 @@ H5FD_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr) file->cls = driver; file->maxaddr = maxaddr; HDmemset(file->fl, 0, sizeof(file->fl)); - if(H5P_get(fapl_id, H5F_ACS_META_BLOCK_SIZE_NAME, - &(meta_block_size)) < 0) - HRETURN_ERROR(H5E_PLIST, H5E_CANTGET, NULL, - "can't get meta data block size"); + if(H5P_get(plist, H5F_ACS_META_BLOCK_SIZE_NAME, &(meta_block_size)) < 0) + HRETURN_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get meta data block size"); file->def_meta_block_size = meta_block_size; file->accum_loc = HADDR_UNDEF; - if(H5P_get(fapl_id, H5F_ACS_ALIGN_THRHD_NAME, &(file->threshold)) < 0) - HRETURN_ERROR(H5E_PLIST, H5E_CANTGET, NULL, - "can't get alignment threshold"); - if(H5P_get(fapl_id, H5F_ACS_ALIGN_NAME, &(file->alignment)) < 0) + if(H5P_get(plist, H5F_ACS_ALIGN_THRHD_NAME, &(file->threshold)) < 0) + HRETURN_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get alignment threshold"); + if(H5P_get(plist, H5F_ACS_ALIGN_NAME, &(file->alignment)) < 0) HRETURN_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get alignment"); + /* Retrieve the VFL driver feature flags */ if (H5FD_query(file, &(file->feature_flags))<0) HRETURN_ERROR(H5E_VFL, H5E_CANTINIT, NULL, "unable to query file driver"); @@ -1980,7 +1977,7 @@ H5FDread(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, size_t size if (H5P_DEFAULT == dxpl_id) dxpl_id= H5P_DATASET_XFER_DEFAULT; if (H5I_GENPROP_LST != H5I_get_type(dxpl_id) || - TRUE!=H5Pisa_class(dxpl_id,H5P_DATASET_XFER)) + TRUE!=H5P_isa_class(dxpl_id,H5P_DATASET_XFER)) HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data transfer property list"); if (!buf) HRETURN_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "null result buffer"); @@ -2020,7 +2017,7 @@ H5FD_read(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, size_t siz FUNC_ENTER(H5FD_read, FAIL); assert(file && file->cls); assert(H5I_GENPROP_LST==H5I_get_type(dxpl_id)); - assert(TRUE==H5Pisa_class(dxpl_id,H5P_DATASET_XFER)); + assert(TRUE==H5P_isa_class(dxpl_id,H5P_DATASET_XFER)); assert(buf); #ifndef H5_HAVE_PARALLEL @@ -2133,7 +2130,7 @@ H5FDwrite(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, size_t siz if (H5P_DEFAULT == dxpl_id) dxpl_id= H5P_DATASET_XFER_DEFAULT; if (H5I_GENPROP_LST != H5I_get_type(dxpl_id) || - TRUE!=H5Pisa_class(dxpl_id,H5P_DATASET_XFER)) + TRUE!=H5P_isa_class(dxpl_id,H5P_DATASET_XFER)) HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data transfer property list"); if (!buf) HRETURN_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "null buffer"); @@ -2176,7 +2173,7 @@ H5FD_write(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, size_t si FUNC_ENTER(H5FD_write, FAIL); assert(file && file->cls); assert(H5I_GENPROP_LST==H5I_get_type(dxpl_id)); - assert(TRUE==H5Pisa_class(dxpl_id,H5P_DATASET_XFER)); + assert(TRUE==H5P_isa_class(dxpl_id,H5P_DATASET_XFER)); assert(buf); #ifndef H5_HAVE_PARALLEL diff --git a/src/H5FDcore.c b/src/H5FDcore.c index f83cb74..6986a74 100644 --- a/src/H5FDcore.c +++ b/src/H5FDcore.c @@ -178,22 +178,21 @@ H5FD_core_init(void) herr_t H5Pset_fapl_core(hid_t fapl_id, size_t increment, hbool_t backing_store) { - herr_t ret_value=FAIL; H5FD_core_fapl_t fa; + H5P_genplist_t *plist; /* Property list pointer */ + herr_t ret_value=FAIL; FUNC_ENTER(H5FD_set_fapl_core, FAIL); H5TRACE3("e","izb",fapl_id,increment,backing_store); /* Check argument */ - if(H5I_GENPROP_LST != H5I_get_type(fapl_id) || - TRUE != H5Pisa_class(fapl_id, H5P_FILE_ACCESS)) - HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, - "not a file access property list"); + if(TRUE!=H5P_isa_class(fapl_id,H5P_FILE_ACCESS) || NULL == (plist = H5I_object(fapl_id))) + HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list"); fa.increment = increment; fa.backing_store = backing_store; - ret_value= H5Pset_driver(fapl_id, H5FD_CORE, &fa); + ret_value= H5P_set_driver(plist, H5FD_CORE, &fa); FUNC_LEAVE(ret_value); } @@ -226,21 +225,23 @@ H5Pget_fapl_core(hid_t fapl_id, size_t *increment/*out*/, hbool_t *backing_store/*out*/) { H5FD_core_fapl_t *fa; + H5P_genplist_t *plist; /* Property list pointer */ FUNC_ENTER(H5Pget_fapl_core, FAIL); H5TRACE3("e","ixx",fapl_id,increment,backing_store); - if(H5I_GENPROP_LST != H5I_get_type(fapl_id) || - TRUE != H5Pisa_class(fapl_id, H5P_FILE_ACCESS)) + if(TRUE!=H5P_isa_class(fapl_id,H5P_FILE_ACCESS) || NULL == (plist = H5I_object(fapl_id))) HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list"); - if (H5FD_CORE!=H5P_get_driver(fapl_id)) + if (H5FD_CORE!=H5P_get_driver(plist)) HRETURN_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "incorrect VFL driver"); - if (NULL==(fa=H5Pget_driver_info(fapl_id))) + if (NULL==(fa=H5P_get_driver_info(plist))) HRETURN_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "bad VFL driver info"); - if (increment) *increment = fa->increment; - if (backing_store) *backing_store = fa->backing_store; + if (increment) + *increment = fa->increment; + if (backing_store) + *backing_store = fa->backing_store; FUNC_LEAVE(SUCCEED); } @@ -306,6 +307,7 @@ H5FD_core_open(const char *name, unsigned UNUSED flags, hid_t fapl_id, { H5FD_core_t *file=NULL; H5FD_core_fapl_t *fa=NULL; + H5P_genplist_t *plist; /* Property list pointer */ int fd=-1; FUNC_ENTER(H5FD_init_interface, NULL); @@ -315,31 +317,30 @@ H5FD_core_open(const char *name, unsigned UNUSED flags, hid_t fapl_id, HRETURN_ERROR(H5E_ARGS, H5E_BADRANGE, NULL, "bogus maxaddr"); if (ADDR_OVERFLOW(maxaddr)) HRETURN_ERROR(H5E_ARGS, H5E_OVERFLOW, NULL, "maxaddr overflow"); - if (H5P_DEFAULT!=fapl_id) fa = H5Pget_driver_info(fapl_id); + if (H5P_DEFAULT!=fapl_id) { + if(NULL == (plist = H5I_object(fapl_id))) + HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file access property list"); + fa = H5P_get_driver_info(plist); + } /* end if */ /* Open backing store */ if (fa && fa->backing_store && name && - (fd=HDopen(name, O_CREAT|O_TRUNC|O_RDWR, 0666))<0) { - HRETURN_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, - "unable to open backing store"); - } + (fd=HDopen(name, O_CREAT|O_TRUNC|O_RDWR, 0666))<0) + HRETURN_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to open backing store"); /* Create the new file struct */ if (NULL==(file=H5MM_calloc(sizeof(H5FD_core_t)))) - HRETURN_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, - "unable to allocate file struct"); + HRETURN_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "unable to allocate file struct"); file->fd = fd; - if (name && *name) { + if (name && *name) file->name = HDstrdup(name); - } /* * The increment comes from either the file access property list or the * default value. But if the file access property list was zero then use * the default value instead. */ - file->increment = (fa && fa->increment>0) ? - fa->increment : H5FD_CORE_INCREMENT; + file->increment = (fa && fa->increment>0) ? fa->increment : H5FD_CORE_INCREMENT; FUNC_LEAVE((H5FD_t*)file); } diff --git a/src/H5FDdpss.c b/src/H5FDdpss.c index 13da176..539f9ec 100644 --- a/src/H5FDdpss.c +++ b/src/H5FDdpss.c @@ -16,6 +16,7 @@ #include "H5FDdpss.h" #include "H5Iprivate.h" /*object IDs */ #include "H5MMprivate.h" /* memory management */ +#include "H5Pprivate.h" /* property lists */ #ifdef COALESCE_READS /* Packages needed by this file.*/ @@ -235,18 +236,17 @@ H5FD_dpss_init (void) herr_t H5Pset_fapl_dpss(hid_t fapl_id) { + H5P_genplist_t *plist; /* Property list pointer */ herr_t ret_value=FAIL; FUNC_ENTER (H5Pset_fapl_dpss, FAIL); H5TRACE1("e","i",fapl_id); /* Check arguments */ - if(H5I_GENPROP_LST != H5I_get_type(fapl_id) || - TRUE != H5Pisa_class(fapl_id, H5P_FILE_ACCESS)) - HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, - "not a file access property list"); + if(TRUE!=H5P_isa_class(fapl_id,H5P_FILE_ACCESS) || NULL == (plist = H5I_object(fapl_id))) + HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list"); - ret_value = H5Pset_driver (fapl_id, H5FD_DPSS, NULL); + ret_value = H5P_set_driver (plist, H5FD_DPSS, NULL); FUNC_LEAVE (ret_value); } @@ -550,6 +550,7 @@ H5FD_dpss_read (H5FD_t *_file, H5FD_mem_t UNUSED type, hid_t dxpl_id, haddr_t ad size_t size, void *buf/*out*/) { H5FD_dpss_t *file = (H5FD_dpss_t *) _file; + H5P_genplist_t *plist; /* Property list pointer */ globus_result_t globus_result; #ifdef COALESCE_READS static int count = 0; /* counter for single reads */ @@ -580,11 +581,10 @@ H5FD_dpss_read (H5FD_t *_file, H5FD_mem_t UNUSED type, hid_t dxpl_id, haddr_t ad /* Get the dataset transfer property list */ if (H5P_DEFAULT == dxpl_id) { dxpl_id = H5P_DATASET_XFER_DEFAULT; - if(H5I_GENPROP_LST != H5I_get_type(plist_id) || - TRUE!=H5Pisa_class(dxpl_id,H5P_DATASET_XFER)) + if(TRUE!=H5P_isa_class(dxpl_id,H5P_DATASET_XFER) || NULL == (plist = H5I_object(dxpl_id))) HRETURN_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get gather read"); - if(!count || H5P_get(dxpl_id, H5D_XFER_GATHER_READS_NAME, &count) < 0) + if(!count || H5P_get(plist, H5D_XFER_GATHER_READS_NAME, &count) < 0) HRETURN_ERROR(H5E_S, H5E_BADTYPE, FAIL, "not xfer parms"); #ifdef DEBUG diff --git a/src/H5FDfamily.c b/src/H5FDfamily.c index 9a3160e..2069850 100644 --- a/src/H5FDfamily.c +++ b/src/H5FDfamily.c @@ -177,27 +177,27 @@ H5Pset_fapl_family(hid_t fapl_id, hsize_t memb_size, hid_t memb_fapl_id) { herr_t ret_value=FAIL; H5FD_family_fapl_t fa; + H5P_genplist_t *plist; /* Property list pointer */ FUNC_ENTER(H5Pset_fapl_family, FAIL); H5TRACE3("e","ihi",fapl_id,memb_size,memb_fapl_id); /* Check arguments */ - if(H5I_GENPROP_LST != H5Iget_type(fapl_id) || - TRUE != H5Pisa_class(fapl_id, H5P_FILE_ACCESS)) - HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, - "not a file access property list"); - if(H5P_DEFAULT != memb_fapl_id && - TRUE != H5Pisa_class(memb_fapl_id, H5P_FILE_ACCESS)) + if(TRUE != H5P_isa_class(fapl_id, H5P_FILE_ACCESS)) + HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list"); + if(memb_fapl_id!=H5P_DEFAULT && TRUE != H5P_isa_class(memb_fapl_id, H5P_FILE_ACCESS)) HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access list"); /* * Initialize driver specific information. No need to copy it into the FA - * struct since all members will be copied by H5Pset_driver(). + * struct since all members will be copied by H5P_set_driver(). */ fa.memb_size = memb_size; fa.memb_fapl_id = memb_fapl_id; - ret_value= H5Pset_driver(fapl_id, H5FD_FAMILY, &fa); + if(NULL == (plist = H5I_object(fapl_id))) + HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list"); + ret_value= H5P_set_driver(plist, H5FD_FAMILY, &fa); FUNC_LEAVE(ret_value); } @@ -230,19 +230,24 @@ H5Pget_fapl_family(hid_t fapl_id, hsize_t *memb_size/*out*/, hid_t *memb_fapl_id/*out*/) { H5FD_family_fapl_t *fa; + H5P_genplist_t *plist; /* Property list pointer */ FUNC_ENTER(H5Pget_fapl_family, FAIL); H5TRACE3("e","ixx",fapl_id,memb_size,memb_fapl_id); - if(H5I_GENPROP_LST != H5Iget_type(fapl_id) || - TRUE != H5Pisa_class(fapl_id, H5P_FILE_ACCESS)) + if(TRUE!=H5P_isa_class(fapl_id,H5P_FILE_ACCESS) || NULL == (plist = H5I_object(fapl_id))) HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access list"); - if (H5FD_FAMILY!=H5P_get_driver(fapl_id)) + if (H5FD_FAMILY!=H5P_get_driver(plist)) HRETURN_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "incorrect VFL driver"); - if (NULL==(fa=H5Pget_driver_info(fapl_id))) + if (NULL==(fa=H5P_get_driver_info(plist))) HRETURN_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "bad VFL driver info"); - if (memb_size) *memb_size = fa->memb_size; - if (memb_fapl_id) *memb_fapl_id = H5Pcopy(fa->memb_fapl_id); + if (memb_size) + *memb_size = fa->memb_size; + if (memb_fapl_id) { + if(NULL == (plist = H5I_object(fa->memb_fapl_id))) + HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access list"); + *memb_fapl_id = H5P_copy_plist(plist); + } /* end if */ FUNC_LEAVE(SUCCEED); } @@ -270,15 +275,17 @@ H5FD_family_fapl_get(H5FD_t *_file) { H5FD_family_t *file = (H5FD_family_t*)_file; H5FD_family_fapl_t *fa = NULL; + H5P_genplist_t *plist; /* Property list pointer */ FUNC_ENTER(H5FD_family_fapl_get, NULL); if (NULL==(fa=H5MM_calloc(sizeof(H5FD_family_fapl_t)))) - HRETURN_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, - "memory allocation failed"); + HRETURN_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); fa->memb_size = file->memb_size; - fa->memb_fapl_id = H5Pcopy(file->memb_fapl_id); + if(NULL == (plist = H5I_object(file->memb_fapl_id))) + HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file access property list"); + fa->memb_fapl_id = H5P_copy_plist(plist); FUNC_LEAVE(fa); } @@ -305,15 +312,17 @@ H5FD_family_fapl_copy(const void *_old_fa) { const H5FD_family_fapl_t *old_fa = (const H5FD_family_fapl_t*)_old_fa; H5FD_family_fapl_t *new_fa = NULL; + H5P_genplist_t *plist; /* Property list pointer */ FUNC_ENTER(H5FD_family_fapl_copy, NULL); if (NULL==(new_fa=H5MM_malloc(sizeof(H5FD_family_fapl_t)))) - HRETURN_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, - "memory allocation failed"); + HRETURN_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); memcpy(new_fa, old_fa, sizeof(H5FD_family_fapl_t)); - new_fa->memb_fapl_id = H5Pcopy(old_fa->memb_fapl_id); + if(NULL == (plist = H5I_object(old_fa->memb_fapl_id))) + HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file access property list"); + new_fa->memb_fapl_id = H5P_copy_plist(plist); FUNC_LEAVE(new_fa); } @@ -342,7 +351,7 @@ H5FD_family_fapl_free(void *_fa) FUNC_ENTER(H5FD_family_fapl_free, FAIL); - H5Pclose(fa->memb_fapl_id); + H5I_dec_ref(fa->memb_fapl_id); H5MM_xfree(fa); FUNC_LEAVE(SUCCEED); @@ -370,15 +379,17 @@ H5FD_family_dxpl_copy(const void *_old_dx) { const H5FD_family_dxpl_t *old_dx = (const H5FD_family_dxpl_t*)_old_dx; H5FD_family_dxpl_t *new_dx = NULL; + H5P_genplist_t *plist; /* Property list pointer */ FUNC_ENTER(H5FD_family_dxpl_copy, NULL); if (NULL==(new_dx=H5MM_malloc(sizeof(H5FD_family_dxpl_t)))) - HRETURN_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, - "memory allocation failed"); + HRETURN_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); memcpy(new_dx, old_dx, sizeof(H5FD_family_dxpl_t)); - new_dx->memb_dxpl_id = H5Pcopy(old_dx->memb_dxpl_id); + if(NULL == (plist = H5I_object(old_dx->memb_dxpl_id))) + HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file access property list"); + new_dx->memb_dxpl_id = H5P_copy_plist(plist); FUNC_LEAVE(new_dx); } @@ -407,7 +418,7 @@ H5FD_family_dxpl_free(void *_dx) FUNC_ENTER(H5FD_family_dxpl_free, FAIL); - H5Pclose(dx->memb_dxpl_id); + H5I_dec_ref(dx->memb_dxpl_id); H5MM_xfree(dx); FUNC_LEAVE(SUCCEED); @@ -441,26 +452,31 @@ 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 */ FUNC_ENTER(H5FD_family_open, NULL); /* Check arguments */ if (!name || !*name) - HRETURN_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid file name"); + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid file name"); if (0==maxaddr || HADDR_UNDEF==maxaddr) - HRETURN_ERROR(H5E_ARGS, H5E_BADRANGE, NULL, "bogus maxaddr"); + HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, NULL, "bogus maxaddr"); /* Initialize file from file access properties */ if (NULL==(file=H5MM_calloc(sizeof(H5FD_family_t)))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, - "unable to allocate file struct"); + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "unable to allocate file struct"); if (H5P_DEFAULT==fapl_id) { file->memb_fapl_id = H5P_DEFAULT; file->memb_size = 1024*1024*1024; /*1GB*/ } else { - H5FD_family_fapl_t *fa = H5Pget_driver_info(fapl_id); - - file->memb_fapl_id = H5Pcopy(fa->memb_fapl_id); + H5FD_family_fapl_t *fa; + + if(NULL == (plist = H5I_object(fapl_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file access property list"); + fa = H5P_get_driver_info(plist); + if(NULL == (plist = H5I_object(fa->memb_fapl_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file access property list"); + file->memb_fapl_id = H5P_copy_plist(plist); file->memb_size = fa->memb_size; } file->name = H5MM_strdup(name); @@ -480,9 +496,9 @@ H5FD_family_open(const char *name, unsigned flags, hid_t fapl_id, if (file->nmembs>=file->amembs) { int n = MAX(64, 2*file->amembs); H5FD_t **x = H5MM_realloc(file->memb, n*sizeof(H5FD_t*)); + if (!x) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, - "unable to reallocate members"); + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "unable to reallocate members"); file->amembs = n; file->memb = x; } @@ -500,8 +516,7 @@ H5FD_family_open(const char *name, unsigned flags, hid_t fapl_id, } H5E_END_TRY; if (!file->memb[file->nmembs]) { if (0==file->nmembs) - HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, - "unable to open member file"); + HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to open member file"); H5Eclear(); break; } @@ -513,7 +528,8 @@ H5FD_family_open(const char *name, unsigned flags, hid_t fapl_id, * but if the size of the first member is zero then use the member size * from the file access property list. */ - if ((eof=H5FDget_eof(file->memb[0]))) file->memb_size = eof; + if ((eof=H5FDget_eof(file->memb[0]))) + file->memb_size = eof; ret_value=(H5FD_t *)file; @@ -527,7 +543,7 @@ done: H5FDclose(file->memb[i]); if (file->memb) H5MM_xfree(file->memb); - H5Pclose(file->memb_fapl_id); + H5I_dec_ref(file->memb_fapl_id); if (file->name) H5MM_xfree(file->name); H5MM_xfree(file); @@ -577,7 +593,7 @@ H5FD_family_close(H5FD_t *_file) "unable to close member files"); /* Clean up other stuff */ - H5Pclose(file->memb_fapl_id); + H5I_dec_ref(file->memb_fapl_id); if (file->memb) H5MM_xfree(file->memb); if (file->name) @@ -836,6 +852,7 @@ H5FD_family_read(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, si int i; haddr_t sub; size_t req; + H5P_genplist_t *plist; /* Property list pointer */ FUNC_ENTER(H5FD_family_read, FAIL); @@ -843,10 +860,12 @@ H5FD_family_read(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, si * Get the member data transfer property list. If the transfer property * list does not belong to this driver then assume defaults */ - if (H5P_DEFAULT!=dxpl_id && H5FD_FAMILY==H5P_get_driver(dxpl_id)) { - H5FD_family_dxpl_t *dx = H5Pget_driver_info(dxpl_id); + if(NULL == (plist = H5I_object(dxpl_id))) + HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file access property list"); + if (H5P_DEFAULT!=dxpl_id && H5FD_FAMILY==H5P_get_driver(plist)) { + H5FD_family_dxpl_t *dx = H5P_get_driver_info(plist); - assert(H5Pisa_class(dxpl_id, H5P_DATASET_XFER)); + assert(H5P_isa_class(dxpl_id, H5P_DATASET_XFER)); assert(dx); memb_dxpl_id = dx->memb_dxpl_id; } @@ -899,6 +918,7 @@ H5FD_family_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, s int i; haddr_t sub; size_t req; + H5P_genplist_t *plist; /* Property list pointer */ FUNC_ENTER(H5FD_family_write, FAIL); @@ -906,10 +926,12 @@ H5FD_family_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, s * Get the member data transfer property list. If the transfer property * list does not belong to this driver then assume defaults. */ - if (H5P_DEFAULT!=dxpl_id && H5FD_FAMILY==H5P_get_driver(dxpl_id)) { - H5FD_family_dxpl_t *dx = H5Pget_driver_info(dxpl_id); + if(NULL == (plist = H5I_object(dxpl_id))) + HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file access property list"); + if (H5P_DEFAULT!=dxpl_id && H5FD_FAMILY==H5P_get_driver(plist)) { + H5FD_family_dxpl_t *dx = H5P_get_driver_info(plist); - assert(H5Pisa_class(dxpl_id, H5P_DATASET_XFER)); + assert(H5P_isa_class(dxpl_id, H5P_DATASET_XFER)); assert(dx); memb_dxpl_id = dx->memb_dxpl_id; } diff --git a/src/H5FDgass.c b/src/H5FDgass.c index 7d334bd..3ffe24d 100644 --- a/src/H5FDgass.c +++ b/src/H5FDgass.c @@ -227,14 +227,14 @@ H5FD_gass_init(void) herr_t H5Pset_fapl_gass(hid_t fapl_id, GASS_Info info) { - herr_t ret_value=FAIL; H5FD_gass_fapl_t fa; + H5P_genplist_t *plist; /* Property list pointer */ + herr_t ret_value=FAIL; FUNC_ENTER(H5Pset_fapl_gass, FAIL); /* Check arguments */ - if(H5I_GENPROP_LST != H5I_get_type(fapl_id) || - TRUE != H5Pisa_class(fapl_id, H5P_FILE_ACCESS)) + if(TRUE!=H5P_isa_class(fapl_id,H5P_FILE_ACCESS) || NULL == (plist = H5I_object(fapl_id))) HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list"); #ifdef LATER @@ -244,7 +244,7 @@ H5Pset_fapl_gass(hid_t fapl_id, GASS_Info info) /* Initialize driver specific properties */ fa.info = info; - ret_value= H5Pset_driver(fapl_id, H5FD_GASS, &fa); + ret_value= H5P_set_driver(plist, H5FD_GASS, &fa); FUNC_LEAVE(ret_value); } @@ -279,17 +279,16 @@ herr_t H5Pget_fapl_gass(hid_t fapl_id, GASS_Info *info/*out*/) { H5FD_gass_fapl_t *fa; + H5P_genplist_t *plist; /* Property list pointer */ FUNC_ENTER(H5Pget_fapl_gass, FAIL); H5TRACE2("e","ix",fapl_id,info); - if(H5I_GENPROP_LST != H5I_get_type(fapl_id) || - TRUE != H5Pisa_class(fapl_id, H5P_FILE_ACCESS)) - HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, - "not a file access property list"); - if (H5FD_GASS!=H5P_get_driver(fapl_id)) + if(TRUE!=H5P_isa_class(fapl_id,H5P_FILE_ACCESS) || NULL == (plist = H5I_object(fapl_id))) + HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list"); + if (H5FD_GASS!=H5P_get_driver(plist)) HRETURN_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "incorrect VFL driver"); - if (NULL==(fa=H5Pget_driver_info(fapl_id))) + if (NULL==(fa=H5P_get_driver_info(plist))) HRETURN_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "bad VFL driver info"); if (info) @@ -332,6 +331,7 @@ H5FD_gass_open(const char *name, unsigned flags, hid_t fapl_id, const H5FD_gass_fapl_t *fa=NULL; H5FD_gass_fapl_t _fa; char *filename = (char *) H5MM_malloc(80 * sizeof(char)); + H5P_genplist_t *plist; /* Property list pointer */ FUNC_ENTER(H5FD_gass_open, NULL); @@ -348,13 +348,15 @@ H5FD_gass_open(const char *name, unsigned flags, hid_t fapl_id, strcpy (filename, name); /* Obtain a pointer to gass-specific file access properties */ - if (H5P_DEFAULT==fapl_id || H5FD_GASS!=H5P_get_driver(fapl_id)) { + if(TRUE!=H5P_isa_class(fapl_id,H5P_FILE_ACCESS) || NULL == (plist = H5I_object(fapl_id))) + HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list"); + if (H5P_DEFAULT==fapl_id || H5FD_GASS!=H5P_get_driver(plist)) { GASS_INFO_NULL (_fa.info); /* _fa.info = GASS_INFO_NULL; */ /* _fa.info = {0,0}; */ /*default*/ fa = &_fa; } else { - fa = H5Pget_driver_info(fapl_id); + fa = H5P_get_driver_info(plist); assert(fa); } diff --git a/src/H5FDlog.c b/src/H5FDlog.c index 29bfc51..aa2bcb2 100644 --- a/src/H5FDlog.c +++ b/src/H5FDlog.c @@ -280,19 +280,18 @@ herr_t H5Pset_fapl_log(hid_t fapl_id, char *logfile, int verbosity) { H5FD_log_fapl_t fa; /* File access property list information */ + H5P_genplist_t *plist; /* Property list pointer */ herr_t ret_value=FAIL; FUNC_ENTER(H5Pset_fapl_log, FAIL); H5TRACE3("e","isIs",fapl_id,logfile,verbosity); - if(H5I_GENPROP_LST != H5I_get_type(fapl_id) || - TRUE != H5Pisa_class(fapl_id, H5P_FILE_ACCESS)) - HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, - "not a file access property list"); + if(TRUE!=H5P_isa_class(fapl_id,H5P_FILE_ACCESS) || NULL == (plist = H5I_object(fapl_id))) + HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list"); fa.logfile = logfile; fa.verbosity=verbosity; - ret_value= H5Pset_driver(fapl_id, H5FD_LOG, &fa); + ret_value= H5P_set_driver(plist, H5FD_LOG, &fa); FUNC_LEAVE(ret_value); } @@ -427,10 +426,11 @@ H5FD_log_open(const char *name, unsigned flags, hid_t fapl_id, H5FD_log_t *file=NULL; H5FD_log_fapl_t *fa; /* File access property list information */ #ifdef WIN32 - HFILE filehandle; - struct _BY_HANDLE_FILE_INFORMATION fileinfo; - int results; + HFILE filehandle; + struct _BY_HANDLE_FILE_INFORMATION fileinfo; + int results; #endif + H5P_genplist_t *plist; /* Property list */ FUNC_ENTER(H5FD_log_open, NULL); @@ -458,11 +458,12 @@ H5FD_log_open(const char *name, unsigned flags, hid_t fapl_id, /* Create the new file struct */ if (NULL==(file=H5MM_calloc(sizeof(H5FD_log_t)))) - HRETURN_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, - "unable to allocate file struct"); + HRETURN_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "unable to allocate file struct"); /* Get the driver specific information */ - fa = H5Pget_driver_info(fapl_id); + if(TRUE!=H5P_isa_class(fapl_id,H5P_FILE_ACCESS) || NULL == (plist = H5I_object(fapl_id))) + HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file access property list"); + fa = H5P_get_driver_info(plist); file->fd = fd; file->eof = sb.st_size; diff --git a/src/H5FDmpio.c b/src/H5FDmpio.c index 4419b84..e521f33 100644 --- a/src/H5FDmpio.c +++ b/src/H5FDmpio.c @@ -238,15 +238,15 @@ H5FD_mpio_init(void) herr_t H5Pset_fapl_mpio(hid_t fapl_id, MPI_Comm comm, MPI_Info info) { - herr_t ret_value=FAIL; H5FD_mpio_fapl_t fa; + H5P_genplist_t *plist; /* Property list pointer */ + herr_t ret_value=FAIL; FUNC_ENTER(H5Pset_fapl_mpio, FAIL); H5TRACE3("e","iMcMi",fapl_id,comm,info); /* Check arguments */ - if(H5I_GENPROP_LST != H5I_get_type(fapl_id) || - TRUE != H5Pisa_class(fapl_id, H5P_FILE_ACCESS)) + if(TRUE!=H5P_isa_class(fapl_id,H5P_FILE_ACCESS) || NULL == (plist = H5I_object(fapl_id))) HRETURN_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a file access list"); @@ -258,7 +258,7 @@ H5Pset_fapl_mpio(hid_t fapl_id, MPI_Comm comm, MPI_Info info) fa.comm = comm; fa.info = info; - ret_value= H5Pset_driver(fapl_id, H5FD_MPIO, &fa); + ret_value= H5P_set_driver(plist, H5FD_MPIO, &fa); FUNC_LEAVE(ret_value); } @@ -301,20 +301,22 @@ herr_t H5Pget_fapl_mpio(hid_t fapl_id, MPI_Comm *comm/*out*/, MPI_Info *info/*out*/) { H5FD_mpio_fapl_t *fa; + H5P_genplist_t *plist; /* Property list pointer */ FUNC_ENTER(H5Pget_fapl_mpio, FAIL); H5TRACE3("e","ixx",fapl_id,comm,info); - if(H5I_GENPROP_LST != H5I_get_type(fapl_id) || - TRUE != H5Pisa_class(fapl_id, H5P_FILE_ACCESS)) + if(TRUE!=H5P_isa_class(fapl_id,H5P_FILE_ACCESS) || NULL == (plist = H5I_object(fapl_id))) HRETURN_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a file access list"); if (H5FD_MPIO!=H5P_get_driver(fapl_id)) HRETURN_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "incorrect VFL driver"); - if (NULL==(fa=H5Pget_driver_info(fapl_id))) + if (NULL==(fa=H5P_get_driver_info(plist))) HRETURN_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "bad VFL driver info"); - if (comm) *comm = fa->comm; - if (info) *info = fa->info; + if (comm) + *comm = fa->comm; + if (info) + *info = fa->info; FUNC_LEAVE(SUCCEED); } @@ -349,24 +351,23 @@ H5Pget_fapl_mpio(hid_t fapl_id, MPI_Comm *comm/*out*/, MPI_Info *info/*out*/) herr_t H5Pset_dxpl_mpio(hid_t dxpl_id, H5FD_mpio_xfer_t xfer_mode) { - herr_t ret_value=FAIL; H5FD_mpio_dxpl_t dx; + H5P_genplist_t *plist; /* Property list pointer */ + herr_t ret_value=FAIL; FUNC_ENTER(H5Pset_dxpl_mpio, FAIL); H5TRACE2("e","iDt",dxpl_id,xfer_mode); /* Check arguments */ - if (H5I_GENPROP_LST != H5I_get_type(dxpl_id) || - TRUE!=H5Pisa_class(dxpl_id,H5P_DATASET_XFER)) + if(TRUE!=H5P_isa_class(dxpl_id,H5P_DATASET_XFER) || NULL == (plist = H5I_object(dxpl_id))) HRETURN_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a dxpl"); - if (H5FD_MPIO_INDEPENDENT!=xfer_mode && - H5FD_MPIO_COLLECTIVE!=xfer_mode) + if (H5FD_MPIO_INDEPENDENT!=xfer_mode && H5FD_MPIO_COLLECTIVE!=xfer_mode) HRETURN_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "incorrect xfer_mode"); /* Initialize driver-specific properties */ dx.xfer_mode = xfer_mode; - ret_value= H5Pset_driver(dxpl_id, H5FD_MPIO, &dx); + ret_value= H5P_set_driver(plist, H5FD_MPIO, &dx); FUNC_LEAVE(ret_value); } @@ -396,16 +397,16 @@ herr_t H5Pget_dxpl_mpio(hid_t dxpl_id, H5FD_mpio_xfer_t *xfer_mode/*out*/) { H5FD_mpio_dxpl_t *dx; + H5P_genplist_t *plist; /* Property list pointer */ FUNC_ENTER(H5Pget_dxpl_mpio, FAIL); H5TRACE2("e","ix",dxpl_id,xfer_mode); - if (H5I_GENPROP_LST != H5I_get_type(dxpl_id) || - TRUE!=H5Pisa_class(dxpl_id,H5P_DATASET_XFER)) + if(TRUE!=H5P_isa_class(dxpl_id,H5P_DATASET_XFER) || NULL == (plist = H5I_object(dxpl_id))) HRETURN_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a dxpl"); - if (H5FD_MPIO!=H5P_get_driver(dxpl_id)) + if (H5FD_MPIO!=H5P_get_driver(plist)) HRETURN_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "incorrect VFL driver"); - if (NULL==(dx=H5Pget_driver_info(dxpl_id))) + if (NULL==(dx=H5P_get_driver_info(plist))) HRETURN_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "bad VFL driver info"); if (xfer_mode) @@ -720,7 +721,7 @@ H5FD_mpio_open(const char *name, unsigned flags, hid_t fapl_id, MPI_Offset size; const H5FD_mpio_fapl_t *fa=NULL; H5FD_mpio_fapl_t _fa; - + H5P_genplist_t *plist; /* Property list pointer */ FUNC_ENTER(H5FD_mpio_open, NULL); @@ -732,12 +733,14 @@ H5FD_mpio_open(const char *name, unsigned flags, hid_t fapl_id, #endif /* Obtain a pointer to mpio-specific file access properties */ - if (H5P_DEFAULT==fapl_id || H5FD_MPIO!=H5P_get_driver(fapl_id)) { + if(TRUE!=H5P_isa_class(fapl_id,H5P_FILE_ACCESS) || NULL == (plist = H5I_object(fapl_id))) + HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list"); + if (H5P_DEFAULT==fapl_id || H5FD_MPIO!=H5P_get_driver(plist)) { _fa.comm = MPI_COMM_SELF; /*default*/ _fa.info = MPI_INFO_NULL; /*default*/ fa = &_fa; } else { - fa = H5Pget_driver_info(fapl_id); + fa = H5P_get_driver_info(plist); assert(fa); } @@ -1091,6 +1094,7 @@ H5FD_mpio_read(H5FD_t *_file, H5FD_mem_t UNUSED type, hid_t dxpl_id, haddr_t add MPI_Datatype buf_type, file_type; int size_i, bytes_read, n; int use_types_this_time, used_types_last_time; + H5P_genplist_t *plist; /* Property list pointer */ FUNC_ENTER(H5FD_mpio_read, FAIL); @@ -1102,7 +1106,7 @@ H5FD_mpio_read(H5FD_t *_file, H5FD_mem_t UNUSED type, hid_t dxpl_id, haddr_t add assert(H5FD_MPIO==file->pub.driver_id); /* Make certain we have the correct type of property list */ assert(H5I_GENPROP_LST==H5I_get_type(dxpl_id)); - assert(TRUE==H5Pisa_class(dxpl_id,H5P_DATASET_XFER)); + assert(TRUE==H5P_isa_class(dxpl_id,H5P_DATASET_XFER)); /* some numeric conversions */ if (haddr_to_MPIOff(addr, &mpi_off/*out*/)<0) @@ -1118,11 +1122,13 @@ H5FD_mpio_read(H5FD_t *_file, H5FD_mem_t UNUSED type, hid_t dxpl_id, haddr_t add #endif /* Obtain the data transfer properties */ - if (H5FD_MPIO!=H5P_get_driver(dxpl_id)) { + if(NULL == (plist = H5I_object(dxpl_id))) + HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list"); + if (H5FD_MPIO!=H5P_get_driver(plist)) { _dx.xfer_mode = H5FD_MPIO_INDEPENDENT; /*the default*/ dx = &_dx; } else { - dx = H5Pget_driver_info(dxpl_id); + dx = H5P_get_driver_info(plist); assert(dx); } @@ -1346,6 +1352,7 @@ H5FD_mpio_write(H5FD_t *_file, H5FD_mem_t UNUSED type, hid_t dxpl_id, haddr_t ad int mpi_rank=-1; int use_types_this_time, used_types_last_time; hbool_t allsame; + H5P_genplist_t *plist; /* Property list pointer */ herr_t ret_value=SUCCEED; FUNC_ENTER(H5FD_mpio_write, FAIL); @@ -1358,7 +1365,7 @@ H5FD_mpio_write(H5FD_t *_file, H5FD_mem_t UNUSED type, hid_t dxpl_id, haddr_t ad assert(H5FD_MPIO==file->pub.driver_id); /* Make certain we have the correct type of property list */ assert(H5I_GENPROP_LST==H5I_get_type(dxpl_id)); - assert(TRUE==H5Pisa_class(dxpl_id,H5P_DATASET_XFER)); + assert(TRUE==H5P_isa_class(dxpl_id,H5P_DATASET_XFER)); /* some numeric conversions */ if (haddr_to_MPIOff(addr, &mpi_off)<0) @@ -1376,11 +1383,13 @@ H5FD_mpio_write(H5FD_t *_file, H5FD_mem_t UNUSED type, hid_t dxpl_id, haddr_t ad #endif /* Obtain the data transfer properties */ - if (H5FD_MPIO!=H5P_get_driver(dxpl_id)) { + if(NULL == (plist = H5I_object(dxpl_id))) + HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list"); + if (H5FD_MPIO!=H5P_get_driver(plist)) { _dx.xfer_mode = H5FD_MPIO_INDEPENDENT; /*the default*/ dx = &_dx; } else { - dx = H5Pget_driver_info(dxpl_id); + dx = H5P_get_driver_info(plist); assert(dx); } diff --git a/src/H5FDmulti.c b/src/H5FDmulti.c index 8d4d886..d7d67b1 100644 --- a/src/H5FDmulti.c +++ b/src/H5FDmulti.c @@ -14,9 +14,6 @@ #include <stdlib.h> #include "hdf5.h" -#ifdef QAK -#include "H5private.h" /* library function */ -#endif /* QAK */ /* * Define H5FD_MULTI_DEBUG if you want the ability to print debugging diff --git a/src/H5FDsec2.c b/src/H5FDsec2.c index fcf1ab6..04bcb16 100644 --- a/src/H5FDsec2.c +++ b/src/H5FDsec2.c @@ -231,17 +231,16 @@ H5FD_sec2_init(void) herr_t H5Pset_fapl_sec2(hid_t fapl_id) { + H5P_genplist_t *plist; /* Property list pointer */ herr_t ret_value=FAIL; FUNC_ENTER(H5Pset_fapl_sec2, FAIL); H5TRACE1("e","i",fapl_id); - if(H5I_GENPROP_LST != H5I_get_type(fapl_id) || - TRUE != H5Pisa_class(fapl_id, H5P_FILE_ACCESS)) - HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, - "not a file access property list"); + if(TRUE!=H5P_isa_class(fapl_id,H5P_FILE_ACCESS) || NULL == (plist = H5I_object(fapl_id))) + HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list"); - ret_value= H5Pset_driver(fapl_id, H5FD_SEC2, NULL); + ret_value= H5P_set_driver(plist, H5FD_SEC2, NULL); FUNC_LEAVE(ret_value); } diff --git a/src/H5FDsrb.c b/src/H5FDsrb.c index fb15d88..6031b5c 100644 --- a/src/H5FDsrb.c +++ b/src/H5FDsrb.c @@ -195,29 +195,28 @@ H5FD_srb_init(void) herr_t H5Pset_fapl_srb(hid_t fapl_id, SRB_Info info) { - herr_t ret_value = FAIL; H5FD_srb_fapl_t fa; int srb_status; + H5P_genplist_t *plist; /* Property list pointer */ + herr_t ret_value = FAIL; FUNC_ENTER(H5Pset_fapl_srb, FAIL); - if(H5I_GENPROP_LST != H5I_get_type(fapl_id) || - TRUE != H5Pisa_class(fapl_id, H5P_FILE_ACCESS)) - HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, - "not a file access property list"); + if(TRUE!=H5P_isa_class(fapl_id,H5P_FILE_ACCESS) || NULL == (plist = H5I_object(fapl_id))) + HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list"); /*connect to SRB server */ fa.srb_conn = clConnect(info.srbHost, info.srbPort, info.srbAuth); if((srb_status = clStatus(fa.srb_conn)) != CLI_CONNECTION_OK) { fprintf(stderr,"%s",clErrorMessage(fa.srb_conn)); clFinish(fa.srb_conn); + /*not sure about first 2 parameters. */ - HRETURN_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, - "Connection to srbMaster failed."); + HRETURN_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "Connection to srbMaster failed."); } fa.info = info; - ret_value = H5Pset_driver(fapl_id, H5FD_SRB, &fa); + ret_value = H5P_set_driver(plist, H5FD_SRB, &fa); FUNC_LEAVE(ret_value); } @@ -245,18 +244,17 @@ H5Pset_fapl_srb(hid_t fapl_id, SRB_Info info) herr_t H5Pget_fapl_srb(hid_t fapl_id, SRB_Info *info/*out*/) { + H5P_genplist_t *plist; /* Property list pointer */ H5FD_srb_fapl_t *fa; FUNC_ENTER(H5Pget_fapl_srb, FAIL); H5TRACE2("e","ix",fapl_id,info); - if(H5I_GENPROP_LST != H5I_get_type(fapl_id) || - TRUE != H5Pisa_class(fapl_id, H5P_FILE_ACCESS)) - HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, - "not a file access property list"); - if(H5FD_SRB != H5P_get_driver(fapl_id)) + if(TRUE!=H5P_isa_class(fapl_id,H5P_FILE_ACCESS) || NULL == (plist = H5I_object(fapl_id))) + HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list"); + if(H5FD_SRB != H5P_get_driver(plist)) HRETURN_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "incorrect VFL driver"); - if(NULL==(fa=H5Pget_driver_info(fapl_id))) + if(NULL==(fa=H5P_get_driver_info(plist))) HRETURN_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "bad VFL driver info"); if(info) @@ -292,6 +290,7 @@ H5FD_srb_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr) H5FD_srb_fapl_t _fa; H5FD_srb_t *file; int srb_fid; + H5P_genplist_t *plist; /* Property list pointer */ FUNC_ENTER(H5FD_srb_open, FAIL); @@ -303,12 +302,14 @@ H5FD_srb_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr) if (ADDR_OVERFLOW(maxaddr)) HRETURN_ERROR(H5E_ARGS, H5E_BADRANGE, NULL, "bogus maxaddr"); - if(H5P_DEFAULT==fapl_id || H5FD_SRB!=H5P_get_driver(fapl_id)) { + if(TRUE!=H5P_isa_class(fapl_id,H5P_FILE_ACCESS) || NULL == (plist = H5I_object(fapl_id))) + HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list"); + if(H5P_DEFAULT==fapl_id || H5FD_SRB!=H5P_get_driver(plist)) { memset((void*)&_fa, 0, sizeof(H5FD_srb_fapl_t)); fa = &_fa; } else { - fa = H5Pget_driver_info(fapl_id); + fa = H5P_get_driver_info(plist); assert(fa); } diff --git a/src/H5FDstdio.c b/src/H5FDstdio.c index 50828c6..d86dbac 100644 --- a/src/H5FDstdio.c +++ b/src/H5FDstdio.c @@ -15,9 +15,6 @@ #include <sys/stat.h> #include "hdf5.h" -#ifdef QAK -#include "H5private.h" /* library function */ -#endif /* QAK */ #ifdef H5_HAVE_STDIO_H #include <stdio.h> @@ -230,11 +227,8 @@ H5Pset_fapl_stdio(hid_t fapl_id) /* Clear the error stack */ H5Eclear(); - if(H5I_GENPROP_LST != H5Iget_type(fapl_id) || - 0 == H5Pisa_class(fapl_id, H5P_FILE_ACCESS)) { - H5Epush_ret(func, H5E_PLIST, H5E_BADTYPE, - "not a file access property list", -1); - } + if(0 == H5Pisa_class(fapl_id, H5P_FILE_ACCESS)) + H5Epush_ret(func, H5E_PLIST, H5E_BADTYPE, "not a file access property list", -1); return H5Pset_driver(fapl_id, H5FD_STDIO, NULL); } diff --git a/src/H5FDstream.c b/src/H5FDstream.c index ea29030..f8753ae 100644 --- a/src/H5FDstream.c +++ b/src/H5FDstream.c @@ -21,18 +21,17 @@ * */ -#include "H5public.h" /* H5_HAVE_STREAM */ #include "H5private.h" /* library function */ /* Only build this driver if it was configured with --with-Stream-VFD */ #ifdef H5_HAVE_STREAM #include "H5Eprivate.h" /* error handling */ -#include "H5FDpublic.h" /* VFD structures */ -#include "H5MMprivate.h" /* memory allocation */ -#include "H5Ppublic.h" /* files */ -#include "H5Pprivate.h" /* VFD prototypes */ +#include "H5FDpublic.h" /* Public VFD header */ #include "H5FDstream.h" /* Stream VFD header */ +#include "H5Iprivate.h" /* IDs */ +#include "H5MMprivate.h" /* memory allocation */ +#include "H5Pprivate.h" /* property prototypes */ #ifdef H5FD_STREAM_HAVE_UNIX_SOCKETS #ifdef H5_HAVE_SYS_TYPES_H @@ -262,17 +261,15 @@ hid_t H5FD_stream_init (void) */ herr_t H5Pset_fapl_stream (hid_t fapl_id, H5FD_stream_fapl_t *fapl) { - herr_t result; H5FD_stream_fapl_t user_fapl; - + H5P_genplist_t *plist; /* Property list pointer */ + herr_t result; FUNC_ENTER (H5Pset_fapl_stream, FAIL); H5TRACE2 ("e", "ix", fapl_id, fapl); - if ( TRUE!=H5Pisa_class(fapl_id, H5P_FILE_ACCESS) ) - { + if(TRUE!=H5P_isa_class(fapl_id,H5P_FILE_ACCESS) || NULL == (plist = H5I_object(fapl_id))) HRETURN_ERROR (H5E_PLIST, H5E_BADTYPE, FAIL, "not a fapl"); - } if (fapl) { @@ -288,11 +285,11 @@ herr_t H5Pset_fapl_stream (hid_t fapl_id, H5FD_stream_fapl_t *fapl) user_fapl.increment = H5FD_STREAM_INCREMENT; } user_fapl.port = 0; - result = H5Pset_driver (fapl_id, H5FD_STREAM, &user_fapl); + result = H5P_set_driver (plist, H5FD_STREAM, &user_fapl); } else { - result = H5Pset_driver (fapl_id, H5FD_STREAM, &default_fapl); + result = H5P_set_driver (plist, H5FD_STREAM, &default_fapl); } FUNC_LEAVE (result); @@ -317,20 +314,20 @@ herr_t H5Pset_fapl_stream (hid_t fapl_id, H5FD_stream_fapl_t *fapl) herr_t H5Pget_fapl_stream(hid_t fapl_id, H5FD_stream_fapl_t *fapl /* out */) { H5FD_stream_fapl_t *this_fapl; - + H5P_genplist_t *plist; /* Property list pointer */ FUNC_ENTER (H5Pget_fapl_stream, FAIL); H5TRACE2("e","ix",fapl_id,fapl); - if (TRUE!=H5Pisa_class(fapl_id, H5P_FILE_ACCESS)) + if(TRUE!=H5P_isa_class(fapl_id,H5P_FILE_ACCESS) || NULL == (plist = H5I_object(fapl_id))) { HRETURN_ERROR (H5E_PLIST, H5E_BADTYPE, FAIL, "not a fapl"); } - if (H5FD_STREAM != H5P_get_driver (fapl_id)) + if (H5FD_STREAM != H5P_get_driver (plist)) { HRETURN_ERROR (H5E_PLIST, H5E_BADVALUE, FAIL, "incorrect VFL driver"); } - if (NULL == (this_fapl = H5Pget_driver_info (fapl_id))) + if (NULL == (this_fapl = H5P_get_driver_info (plist))) { HRETURN_ERROR (H5E_PLIST, H5E_BADVALUE, FAIL, "bad VFL driver info"); } @@ -636,6 +633,7 @@ static H5FD_t *H5FD_stream_open (const char *filename, #ifdef WIN32 WSADATA wsadata; #endif + H5P_genplist_t *plist; /* Property list pointer */ FUNC_ENTER (H5FD_stream_open, NULL); @@ -677,7 +675,9 @@ static H5FD_t *H5FD_stream_open (const char *filename, fapl = NULL; if (H5P_DEFAULT != fapl_id) { - fapl = H5Pget_driver_info (fapl_id); + if(TRUE!=H5P_isa_class(fapl_id,H5P_FILE_ACCESS) || NULL == (plist = H5I_object(fapl_id))) + HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list"); + fapl = H5P_get_driver_info (plist); } if (fapl == NULL) { @@ -709,7 +709,7 @@ static H5FD_t *H5FD_stream_open (const char *filename, { /* update the port ID in the file access property so that it can be queried via H5P_get_fapl_stream() later on */ - H5Pset_driver (fapl_id, H5FD_STREAM, &_stream.fapl); + H5P_set_driver (plist, H5FD_STREAM, &_stream.fapl); } } } diff --git a/src/H5FDstream.h b/src/H5FDstream.h index f6c70ca..50d0686 100644 --- a/src/H5FDstream.h +++ b/src/H5FDstream.h @@ -20,8 +20,6 @@ #ifdef H5_HAVE_STREAM -#include "H5Ipublic.h" - /* check what sockets type we have (Unix or Windows sockets) Note that only MS compilers require to use Windows sockets but gcc under Windows does not. */ diff --git a/src/H5Farray.c b/src/H5Farray.c index 54dd376..58c6239 100644 --- a/src/H5Farray.c +++ b/src/H5Farray.c @@ -167,7 +167,7 @@ H5F_arr_read(H5F_t *f, hid_t dxpl_id, const struct H5O_layout_t *layout, assert(buf); /* Make certain we have the correct type of property list */ assert(H5I_GENPROP_LST==H5I_get_type(dxpl_id)); - assert(TRUE==H5Pisa_class(dxpl_id,H5P_DATASET_XFER)); + assert(TRUE==H5P_isa_class(dxpl_id,H5P_DATASET_XFER)); /* Make a local copy of size so we can modify it */ H5V_vector_cpy(layout->ndims, hslab_size, _hslab_size); @@ -454,7 +454,7 @@ H5F_arr_write(H5F_t *f, hid_t dxpl_id, const struct H5O_layout_t *layout, assert(buf); /* Make certain we have the correct type of property list */ assert(H5I_GENPROP_LST==H5I_get_type(dxpl_id)); - assert(TRUE==H5Pisa_class(dxpl_id,H5P_DATASET_XFER)); + assert(TRUE==H5P_isa_class(dxpl_id,H5P_DATASET_XFER)); /* Make a local copy of _size so we can modify it */ H5V_vector_cpy(layout->ndims, hslab_size, _hslab_size); diff --git a/src/H5Fseq.c b/src/H5Fseq.c index 2a1a41e..bace23d 100644 --- a/src/H5Fseq.c +++ b/src/H5Fseq.c @@ -174,7 +174,7 @@ H5F_seq_readv(H5F_t *f, hid_t dxpl_id, const struct H5O_layout_t *layout, assert(real_buf); /* Make certain we have the correct type of property list */ assert(H5I_GENPROP_LST==H5I_get_type(dxpl_id)); - assert(TRUE==H5Pisa_class(dxpl_id,H5P_DATASET_XFER)); + assert(TRUE==H5P_isa_class(dxpl_id,H5P_DATASET_XFER)); #ifdef H5_HAVE_PARALLEL { @@ -558,7 +558,7 @@ H5F_seq_writev(H5F_t *f, hid_t dxpl_id, const struct H5O_layout_t *layout, assert(real_buf); /* Make certain we have the correct type of property list */ assert(H5I_GENPROP_LST==H5I_get_type(dxpl_id)); - assert(TRUE==H5Pisa_class(dxpl_id,H5P_DATASET_XFER)); + assert(TRUE==H5P_isa_class(dxpl_id,H5P_DATASET_XFER)); #ifdef H5_HAVE_PARALLEL { @@ -1765,15 +1765,6 @@ H5G_loc (hid_t loc_id) } break; - case H5I_TEMPLATE_0: - case H5I_TEMPLATE_1: - case H5I_TEMPLATE_2: - case H5I_TEMPLATE_3: - case H5I_TEMPLATE_4: - case H5I_TEMPLATE_5: - case H5I_TEMPLATE_6: - case H5I_TEMPLATE_7: - case H5I_TEMPLATE_MAX: case H5I_GENPROP_CLS: case H5I_GENPROP_LST: HRETURN_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, diff --git a/src/H5Gnode.c b/src/H5Gnode.c index d698504..99f0211 100644 --- a/src/H5Gnode.c +++ b/src/H5Gnode.c @@ -29,6 +29,7 @@ #include "H5FLprivate.h" /*Free Lists */ #include "H5Gpkg.h" /*me */ #include "H5HLprivate.h" /*local heap */ +#include "H5Iprivate.h" /* IDs */ #include "H5MFprivate.h" /*file memory management */ #include "H5MMprivate.h" /*core memory management */ #include "H5Oprivate.h" /*header messages */ @@ -1238,14 +1239,16 @@ H5G_node_debug(H5F_t *f, haddr_t addr, FILE * stream, int indent, unsigned H5G_node_k(const H5F_t *f) { unsigned sym_leaf_k; + H5P_genplist_t *plist; /* Property list pointer */ FUNC_ENTER(H5G_node_k, UFAIL); assert(f); - if(H5P_get(f->shared->fcpl_id, H5F_CRT_SYM_LEAF_NAME, &sym_leaf_k) < 0) - HRETURN_ERROR(H5E_PLIST, H5E_CANTGET, UFAIL, - "can't get rank for symbol table leaf node"); + if(NULL == (plist = H5I_object(f->shared->fcpl_id))) + HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, UFAIL, "not a file access property list"); + if(H5P_get(plist, H5F_CRT_SYM_LEAF_NAME, &sym_leaf_k) < 0) + HRETURN_ERROR(H5E_PLIST, H5E_CANTGET, UFAIL, "can't get rank for symbol table leaf node"); FUNC_LEAVE(sym_leaf_k); } diff --git a/src/H5Ipublic.h b/src/H5Ipublic.h index 2c82cfa..85db6fd 100644 --- a/src/H5Ipublic.h +++ b/src/H5Ipublic.h @@ -30,15 +30,6 @@ typedef enum { H5I_BADID = (-1), /*invalid Group */ H5I_FILE = 1, /*group ID for File objects */ H5I_FILE_CLOSING, /*files pending close due to open objhdrs */ - H5I_TEMPLATE_0, /*group ID for Template objects */ - H5I_TEMPLATE_1, /*group ID for Template objects */ - H5I_TEMPLATE_2, /*group ID for Template objects */ - H5I_TEMPLATE_3, /*group ID for Template objects */ - H5I_TEMPLATE_4, /*group ID for Template objects */ - H5I_TEMPLATE_5, /*group ID for Template objects */ - H5I_TEMPLATE_6, /*group ID for Template objects */ - H5I_TEMPLATE_7, /*group ID for Template objects */ - H5I_TEMPLATE_MAX, /*not really a group ID */ H5I_GROUP, /*group ID for Group objects */ H5I_DATATYPE, /*group ID for Datatype objects */ H5I_DATASPACE, /*group ID for Dataspace objects */ diff --git a/src/H5Oattr.c b/src/H5Oattr.c index fb4ec17..c96a2ce 100644 --- a/src/H5Oattr.c +++ b/src/H5Oattr.c @@ -12,8 +12,8 @@ /* $Id$ */ -#define H5A_PACKAGE /*prevent warning from including H5Tpkg.h */ -#define H5S_PACKAGE /*suppress error about including H5Spkg */ +#define H5A_PACKAGE /*prevent warning from including H5Apkg.h */ +#define H5S_PACKAGE /*suppress error about including H5Spkg */ #include "H5private.h" #include "H5Eprivate.h" diff --git a/src/H5Ppublic.h b/src/H5Ppublic.h index 9385859..416d9b7 100644 --- a/src/H5Ppublic.h +++ b/src/H5Ppublic.h @@ -39,7 +39,6 @@ typedef long off_t; #ifdef H5_WANT_H5_V1_4_COMPAT /* Backward compatibility typedef... */ typedef hid_t H5P_class_t; /* Alias H5P_class_t to hid_t */ -#endif /* H5_WANT_H5_V1_4_COMPAT */ /* H5P_DATASET_XFER was the name from the beginning through 1.2. It was * changed to H5P_DATA_XFER on v1.3.0. Then it was changed back to @@ -48,6 +47,7 @@ typedef hid_t H5P_class_t; /* Alias H5P_class_t to hid_t */ * Should be removed in later version. */ #define H5P_DATA_XFER H5P_DATASET_XFER +#endif /* H5_WANT_H5_V1_4_COMPAT */ /* Define property list class callback function pointer types */ typedef herr_t (*H5P_cls_create_func_t)(hid_t prop_id, void *create_data); @@ -91,6 +91,7 @@ __DLLVAR__ hid_t H5P_CLS_FILE_ACCESS_g; __DLLVAR__ hid_t H5P_CLS_DATASET_CREATE_g; __DLLVAR__ hid_t H5P_CLS_DATASET_XFER_g; __DLLVAR__ hid_t H5P_CLS_MOUNT_g; + /* * The library created default property lists */ diff --git a/src/H5Sall.c b/src/H5Sall.c index 26b4abd..0e896d9 100644 --- a/src/H5Sall.c +++ b/src/H5Sall.c @@ -11,11 +11,12 @@ #define H5S_PACKAGE /*suppress error about including H5Spkg */ #include "H5private.h" +#include "H5Dprivate.h" #include "H5Eprivate.h" #include "H5Iprivate.h" #include "H5Spkg.h" +#include "H5Tprivate.h" /* Datatypes */ #include "H5Vprivate.h" -#include "H5Dprivate.h" /* Interface initialization */ #define PABLO_MASK H5Sall_mask @@ -1201,9 +1202,10 @@ H5S_all_select_iterate(void *buf, hid_t type_id, H5S_t *space, H5D_operator_t op hsize_t offset; /* offset of region in buffer */ hsize_t nelemts; /* Number of elements to iterate through */ void *tmp_buf; /* temporary location of the element in the buffer */ - unsigned rank; /* Dataspace rank */ - int indx; /* Index to increment */ - herr_t ret_value=0; /* return value */ + unsigned rank; /* Dataspace rank */ + int indx; /* Index to increment */ + H5T_t *dt; /* Datatype structure */ + herr_t ret_value=0; /* return value */ FUNC_ENTER (H5S_all_select_iterate, 0); @@ -1217,7 +1219,11 @@ H5S_all_select_iterate(void *buf, hid_t type_id, H5S_t *space, H5D_operator_t op /* Set up the size of the memory space */ HDmemcpy(mem_size, space->extent.u.simple.size, rank*sizeof(hsize_t)); - mem_size[rank]=H5Tget_size(type_id); + + /* Set the size of the datatype */ + if (NULL==(dt=H5I_object(type_id))) + HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an valid base datatype"); + mem_size[rank]=H5T_get_size(dt); /* Set the coordinates to zero */ HDmemset(mem_offset, 0, (rank+1)*sizeof(hsize_t)); diff --git a/src/H5Shyper.c b/src/H5Shyper.c index 37bc247..83121ae 100644 --- a/src/H5Shyper.c +++ b/src/H5Shyper.c @@ -17,8 +17,9 @@ #include "H5FLprivate.h" /*Free Lists */ #include "H5Iprivate.h" #include "H5MMprivate.h" -#include "H5Pprivate.h" +#include "H5Pprivate.h" /* Property Lists */ #include "H5Spkg.h" +#include "H5Tprivate.h" /* Datatypes */ #include "H5Vprivate.h" /* Interface initialization */ @@ -417,6 +418,7 @@ H5S_hyper_fread (H5F_t *f, const struct H5O_layout_t *layout, size_t last_io_bytes_left=0; /* Last I/O bytes left before readv() called */ size_t nseq=0; /* Number of sequence/offsets stored in the arrays */ size_t vector_size; /* Value for vector size */ + H5P_genplist_t *plist; /* Property list */ hssize_t ret_value=FAIL; FUNC_ENTER (H5S_hyper_fread, 0); @@ -462,7 +464,9 @@ printf("%s: Called!\n",FUNC); loc_off+=(abs_arr[i]+space->select.offset[i])*slab[i]; /* Get the hyperslab vector size */ - if (H5P_get(dxpl_id,H5D_XFER_HYPER_VECTOR_SIZE_NAME,&vector_size)<0) + if(TRUE!=H5P_isa_class(dxpl_id,H5P_DATASET_XFER) || NULL == (plist = H5I_object(dxpl_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list"); + if (H5P_get(plist,H5D_XFER_HYPER_VECTOR_SIZE_NAME,&vector_size)<0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, 0, "unable to get value"); /* Allocate the vector I/O arrays */ @@ -885,6 +889,7 @@ H5S_hyper_fread_opt (H5F_t *f, const struct H5O_layout_t *layout, size_t duffs_index; /* Counting index for Duff's device */ #endif /* NO_DUFFS_DEVICE */ size_t vector_size; /* Value for vector size */ + H5P_genplist_t *plist; /* Property list */ hsize_t ret_value=0; /* Return value */ FUNC_ENTER (H5S_hyper_fread_opt, 0); @@ -904,8 +909,10 @@ for(i=0; i<file_space->extent.u.simple.rank; i++) #endif /* QAK */ /* Get the hyperslab vector size */ - if (H5P_get(dxpl_id,H5D_XFER_HYPER_VECTOR_SIZE_NAME,&vector_size)<0) - HRETURN_ERROR(H5E_PLIST, H5E_CANTGET, 0, "unable to get value"); + if(TRUE!=H5P_isa_class(dxpl_id,H5P_DATASET_XFER) || NULL == (plist = H5I_object(dxpl_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, 0, "not a file access property list"); + if (H5P_get(plist,H5D_XFER_HYPER_VECTOR_SIZE_NAME,&vector_size)<0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, 0, "unable to get value"); /* Allocate the vector I/O arrays */ if((seq_len_arr = H5FL_ARR_ALLOC(size_t,vector_size,0))==NULL) @@ -1513,6 +1520,7 @@ H5S_hyper_fwrite (H5F_t *f, const struct H5O_layout_t *layout, size_t last_io_bytes_left=0; /* Last I/O bytes left before readv() called */ size_t nseq=0; /* Number of sequence/offsets stored in the arrays */ size_t vector_size; /* Value for vector size */ + H5P_genplist_t *plist; /* Property list */ hssize_t ret_value=FAIL; FUNC_ENTER (H5S_hyper_fwrite, 0); @@ -1561,7 +1569,9 @@ printf("%s: Called!\n",FUNC); assert(io_bytes_left<=(iter->hyp.elmt_left*elmt_size)); /* Get the hyperslab vector size */ - if (H5P_get(dxpl_id,H5D_XFER_HYPER_VECTOR_SIZE_NAME,&vector_size)<0) + if(TRUE!=H5P_isa_class(dxpl_id,H5P_DATASET_XFER) || NULL == (plist = H5I_object(dxpl_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, 0, "not a file access property list"); + if (H5P_get(plist,H5D_XFER_HYPER_VECTOR_SIZE_NAME,&vector_size)<0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, 0, "unable to get value"); /* Allocate the vector I/O arrays */ @@ -1981,6 +1991,7 @@ H5S_hyper_fwrite_opt (H5F_t *f, const struct H5O_layout_t *layout, size_t duffs_index; /* Counting index for Duff's device */ #endif /* NO_DUFFS_DEVICE */ size_t vector_size; /* Value for vector size */ + H5P_genplist_t *plist; /* Property list */ hsize_t ret_value=0; /* Return value */ FUNC_ENTER (H5S_hyper_fwrite_opt, 0); @@ -2000,8 +2011,10 @@ for(i=0; i<file_space->extent.u.simple.rank; i++) #endif /* QAK */ /* Get the hyperslab vector size */ - if (H5P_get(dxpl_id,H5D_XFER_HYPER_VECTOR_SIZE_NAME,&vector_size)<0) - HRETURN_ERROR(H5E_PLIST, H5E_CANTGET, 0, "unable to get value"); + if(TRUE!=H5P_isa_class(dxpl_id,H5P_DATASET_XFER) || NULL == (plist = H5I_object(dxpl_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, 0, "not a file access property list"); + if (H5P_get(plist,H5D_XFER_HYPER_VECTOR_SIZE_NAME,&vector_size)<0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, 0, "unable to get value"); /* Allocate the vector I/O arrays */ if((seq_len_arr = H5FL_ARR_ALLOC(size_t,vector_size,0))==NULL) @@ -6098,6 +6111,7 @@ H5S_hyper_select_iterate_mem_opt(H5S_sel_iter_t * UNUSED iter, void *buf, hid_t int fast_dim; /* Rank of the fastest changing dimension for the dataspace */ int temp_dim; /* Temporary rank holder */ unsigned ndims; /* Rank of the dataspace */ + H5T_t *dt; /* Datatype structure */ herr_t user_ret=0; /* User's return value */ FUNC_ENTER (H5S_hyper_select_iterate_mem_opt, FAIL); @@ -6108,7 +6122,9 @@ H5S_hyper_select_iterate_mem_opt(H5S_sel_iter_t * UNUSED iter, void *buf, hid_t diminfo=space->select.sel_info.hslab.diminfo; /* Get the data element size */ - elem_size=H5Tget_size(type_id); + if (NULL==(dt=H5I_object(type_id))) + HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an valid base datatype"); + elem_size=H5T_get_size(dt); /* Elements in the fastest dimension are 'elem_size' */ slab[ndims-1]=elem_size; @@ -6260,6 +6276,7 @@ H5S_hyper_select_iterate(void *buf, hid_t type_id, H5S_t *space, H5D_operator_t H5S_hyper_iter_info_t iter_info; /* Block of parameters to pass into recursive calls */ H5S_sel_iter_t iter; /* selection iteration info*/ size_t elmt_size; /* Datatype size */ + H5T_t *dt; /* Datatype structure */ herr_t ret_value=FAIL; /* return value */ FUNC_ENTER (H5S_hyper_select_iterate, FAIL); @@ -6273,7 +6290,9 @@ H5S_hyper_select_iterate(void *buf, hid_t type_id, H5S_t *space, H5D_operator_t HDmemset(&iter,0,sizeof(H5S_sel_iter_t)); /* Get the datatype size */ - elmt_size=H5Tget_size(type_id); + if (NULL==(dt=H5I_object(type_id))) + HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an valid base datatype"); + elem_size=H5T_get_size(dt); /* Construct iterator for hyperslab selection */ if (H5S_hyper_init(space, elmt_size, &iter)<0) diff --git a/src/H5Smpio.c b/src/H5Smpio.c index 9829744..73afb72 100644 --- a/src/H5Smpio.c +++ b/src/H5Smpio.c @@ -564,6 +564,7 @@ H5S_mpio_spaces_xfer(H5F_t *f, const struct H5O_layout_t *layout, MPI_Datatype mpi_buf_type, mpi_file_type; hbool_t mbt_is_derived=0, mft_is_derived=0; + H5P_genplist_t *plist; /* Property list pointer */ FUNC_ENTER (H5S_mpio_spaces_xfer, FAIL); @@ -578,7 +579,7 @@ H5S_mpio_spaces_xfer(H5F_t *f, const struct H5O_layout_t *layout, assert (IS_H5FD_MPIO(f)); /* Make certain we have the correct type of property list */ assert(H5I_GENPROP_LST==H5I_get_type(dxpl_id)); - assert(TRUE==H5Pisa_class(dxpl_id,H5P_DATASET_XFER)); + assert(TRUE==H5P_isa_class(dxpl_id,H5P_DATASET_XFER)); /* INCOMPLETE!!! rky 980816 */ /* Currently can only handle H5D_CONTIGUOUS layout */ @@ -610,12 +611,15 @@ H5S_mpio_spaces_xfer(H5F_t *f, const struct H5O_layout_t *layout, H5FD_mpio_dxpl_t *dx; hid_t driver_id; /* VFL driver ID */ + if(NULL == (plist = H5I_object(dxpl_id))) + HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list"); + /* Get the driver ID */ - if(H5P_get(dxpl_id, H5D_XFER_VFL_ID_NAME, &driver_id)<0) + if(H5P_get(plist, H5D_XFER_VFL_ID_NAME, &driver_id)<0) HGOTO_ERROR (H5E_PLIST, H5E_CANTGET, FAIL, "Can't retrieve VFL driver ID"); /* Get the driver information */ - if(H5P_get(dxpl_id, H5D_XFER_VFL_INFO_NAME, &dx)<0) + if(H5P_get(plist, H5D_XFER_VFL_INFO_NAME, &dx)<0) HGOTO_ERROR (H5E_PLIST, H5E_CANTGET, FAIL, "Can't retrieve VFL driver info"); /* Check if we are using the MPIO driver */ diff --git a/src/H5Spoint.c b/src/H5Spoint.c index 5f89957..06f198d 100644 --- a/src/H5Spoint.c +++ b/src/H5Spoint.c @@ -11,12 +11,13 @@ #define H5S_PACKAGE /*suppress error about including H5Spkg */ #include "H5private.h" +#include "H5Dprivate.h" #include "H5Eprivate.h" #include "H5Iprivate.h" #include "H5MMprivate.h" #include "H5Spkg.h" +#include "H5Tprivate.h" /* Datatypes */ #include "H5Vprivate.h" -#include "H5Dprivate.h" /* Interface initialization */ #define PABLO_MASK H5Spoint_mask @@ -1314,6 +1315,7 @@ H5S_point_select_iterate(void *buf, hid_t type_id, H5S_t *space, H5D_operator_t void *tmp_buf; /* temporary location of the element in the buffer */ H5S_pnt_node_t *node; /* Point node */ unsigned rank; /* Dataspace rank */ + H5T_t *dt; /* Datatype structure */ herr_t ret_value=0; /* return value */ FUNC_ENTER (H5S_point_select_iterate, 0); @@ -1328,7 +1330,11 @@ H5S_point_select_iterate(void *buf, hid_t type_id, H5S_t *space, H5D_operator_t /* Set up the size of the memory space */ HDmemcpy(mem_size, space->extent.u.simple.size, rank*sizeof(hsize_t)); - mem_size[rank]=H5Tget_size(type_id); + + /* Set the size of the datatype */ + if (NULL==(dt=H5I_object(type_id))) + HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an valid base datatype"); + mem_size[rank]=H5T_get_size(dt); /* Iterate through the node, checking the bounds on each element */ node=space->select.sel_info.pnt_lst->head; diff --git a/src/H5Tbit.c b/src/H5Tbit.c index 55541a1..b868fa5 100644 --- a/src/H5Tbit.c +++ b/src/H5Tbit.c @@ -9,7 +9,7 @@ * with the least-significant bits in the first byte. That is, * the bytes are in little-endian order. */ -#define H5T_PACKAGE +#define H5T_PACKAGE /*suppress error about including H5Tpkg */ #include "H5private.h" #include "H5Eprivate.h" diff --git a/src/H5Tvlen.c b/src/H5Tvlen.c index d355c47..2c305b7 100644 --- a/src/H5Tvlen.c +++ b/src/H5Tvlen.c @@ -209,6 +209,7 @@ herr_t H5T_vlen_seq_mem_write(hid_t plist_id, H5F_t UNUSED *f, void *vl_addr, vo void *alloc_info; /* Vlen allocation information */ hvl_t *vl=(hvl_t *)vl_addr; /* Pointer to the user's hvl_t information */ size_t len=seq_len*base_size; + H5P_genplist_t *plist; /* Property list */ FUNC_ENTER (H5T_vlen_seq_mem_write, FAIL); @@ -221,9 +222,11 @@ herr_t H5T_vlen_seq_mem_write(hid_t plist_id, H5F_t UNUSED *f, void *vl_addr, vo assert((seq_len*base_size)==(hsize_t)((size_t)(seq_len*base_size))); /*check for overflow*/ /* Get the allocation function & info */ - if (H5P_get(plist_id,H5D_XFER_VLEN_ALLOC_NAME,&alloc_func)<0) + if(TRUE!=H5P_isa_class(plist_id,H5P_DATASET_XFER) || NULL == (plist = H5I_object(plist_id))) + HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list"); + if (H5P_get(plist,H5D_XFER_VLEN_ALLOC_NAME,&alloc_func)<0) HRETURN_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "unable to get value"); - if (H5P_get(plist_id,H5D_XFER_VLEN_ALLOC_INFO_NAME,&alloc_info)<0) + if (H5P_get(plist,H5D_XFER_VLEN_ALLOC_INFO_NAME,&alloc_info)<0) HRETURN_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "unable to get value"); if(alloc_func!=NULL) { @@ -329,6 +332,7 @@ herr_t H5T_vlen_str_mem_write(hid_t plist_id, H5F_t UNUSED *f, void *vl_addr, vo void *alloc_info; /* Vlen allocation information */ char **s=(char **)vl_addr; /* Pointer to the user's hvl_t information */ size_t len=seq_len*base_size; + H5P_genplist_t *plist; /* Property list */ FUNC_ENTER (H5T_vlen_str_mem_write, FAIL); @@ -339,9 +343,11 @@ herr_t H5T_vlen_str_mem_write(hid_t plist_id, H5F_t UNUSED *f, void *vl_addr, vo assert(((seq_len+1)*base_size)==(hsize_t)((size_t)((seq_len+1)*base_size))); /*check for overflow*/ /* Get the allocation function & info */ - if (H5P_get(plist_id,H5D_XFER_VLEN_ALLOC_NAME,&alloc_func)<0) + if(TRUE!=H5P_isa_class(plist_id,H5P_DATASET_XFER) || NULL == (plist = H5I_object(plist_id))) + HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list"); + if (H5P_get(plist,H5D_XFER_VLEN_ALLOC_NAME,&alloc_func)<0) HRETURN_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "unable to get value"); - if (H5P_get(plist_id,H5D_XFER_VLEN_ALLOC_INFO_NAME,&alloc_info)<0) + if (H5P_get(plist,H5D_XFER_VLEN_ALLOC_INFO_NAME,&alloc_info)<0) HRETURN_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "unable to get value"); if(alloc_func!=NULL) { @@ -623,6 +629,7 @@ H5T_vlen_reclaim(void *elem, hid_t type_id, hsize_t UNUSED ndim, hssize_t UNUSED H5MM_free_t free_func; /* Vlen free function */ void *free_info=NULL; /* Vlen free information */ H5T_t *dt = NULL; + H5P_genplist_t *plist; /* Property list */ herr_t ret_value = FAIL; FUNC_ENTER(H5T_vlen_reclaim, FAIL); @@ -635,9 +642,11 @@ H5T_vlen_reclaim(void *elem, hid_t type_id, hsize_t UNUSED ndim, hssize_t UNUSED HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type"); /* Get the free func & information */ - if (H5P_get(plist_id,H5D_XFER_VLEN_FREE_NAME,&free_func)<0) + if(TRUE!=H5P_isa_class(plist_id,H5P_DATASET_XFER) || NULL == (plist = H5I_object(plist_id))) + HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list"); + if (H5P_get(plist,H5D_XFER_VLEN_FREE_NAME,&free_func)<0) HRETURN_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "unable to get value"); - if (H5P_get(plist_id,H5D_XFER_VLEN_FREE_INFO_NAME,&free_info)<0) + if (H5P_get(plist,H5D_XFER_VLEN_FREE_INFO_NAME,&free_info)<0) HRETURN_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "unable to get value"); /* Pull the free function and free info pointer out of the op_data and call the recurse datatype free function */ diff --git a/src/Makefile.in b/src/Makefile.in index 069a9a0..cfd99c2 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -47,8 +47,8 @@ PUB_HDR=H5public.h H5Apublic.h H5ACpublic.h H5Bpublic.h H5Dpublic.h H5Epublic.h PRIVATE_HDR=H5private.h H5Aprivate.h H5Apkg.h H5ACprivate.h H5Bprivate.h \ H5Dprivate.h H5Eprivate.h H5Fprivate.h H5FDprivate.h H5FLprivate.h \ H5Gprivate.h H5Gpkg.h H5HGprivate.h H5HLprivate.h H5Iprivate.h \ - H5MFprivate.h H5MMprivate.h H5Oprivate.h H5Pprivate.h H5Rprivate.h \ - H5Sprivate.h H5Tprivate.h H5TBprivate.h H5Tpkg.h \ + H5MFprivate.h H5MMprivate.h H5Oprivate.h H5Pprivate.h H5Ppkg.h \ + H5Rprivate.h H5Sprivate.h H5Tprivate.h H5TBprivate.h H5Tpkg.h \ H5TSprivate.h H5Vprivate.h H5Zprivate.h H5config.h ## Number format detection |