//-------------------------------------------------------------------------- // Function: FileAccPropList::getCore ///\brief Queries core file driver properties. ///\param increment - OUT: Size of memory increment, in bytes ///\param backing_store - OUT: Indicating whether to write the file /// contents to disk when the file is closed ///\exception H5::PropListIException // Programmer: Binh-Minh Ribler - April, 2004 //-------------------------------------------------------------------------- void FileAccPropList::getCore (size_t& increment, hbool_t& backing_store) const { herr_t ret_value = H5Pget_fapl_core(id, &increment, &backing_store); if( ret_value < 0 ) { throw PropListIException("FileAccPropList::getCore", "H5Pget_fapl_core failed"); } }
/*------------------------------------------------------------------------- * Function: h5_cleanup * * Purpose: Cleanup temporary test files. * base_name contains the list of test file names. * The file access property list is also closed. * * Return: Non-zero if cleanup actions were performed; zero otherwise. * * Programmer: Albert Cheng * May 28, 1998 * *------------------------------------------------------------------------- */ int h5_cleanup(const char *base_name[], hid_t fapl) { int retval = 0; if(GetTestCleanup()) { int i; for(i = 0; base_name[i]; i++) { char filename[1024]; char temp[2048]; hid_t driver; if(NULL == h5_fixname(base_name[i], fapl, filename, sizeof(filename))) continue; driver = H5Pget_driver(fapl); if(driver == H5FD_FAMILY) { int j; for(j = 0; /*void*/; j++) { HDsnprintf(temp, sizeof temp, filename, j); if(HDaccess(temp, F_OK) < 0) break; HDremove(temp); } /* end for */ } else if(driver == H5FD_CORE) { hbool_t backing; /* Whether the core file has backing store */ H5Pget_fapl_core(fapl, NULL, &backing); /* If the file was stored to disk with bacing store, remove it */ if(backing) HDremove(filename); } else if (driver == H5FD_MULTI) { H5FD_mem_t mt; HDassert(HDstrlen(multi_letters)==H5FD_MEM_NTYPES); for(mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t,mt)) { HDsnprintf(temp, sizeof temp, "%s-%c.h5", filename, multi_letters[mt]); HDremove(temp); /*don't care if it fails*/ } /* end for */ } else { HDremove(filename); } } /* end for */ retval = 1; } /* end if */ H5Pclose(fapl); return retval; }
/* * Function: do_cleanupfile * Purpose: Cleanup temporary file unless HDF5_NOCLEANUP is set. * Return: void * Programmer: Albert Cheng 2001/12/12 * Modifications: Support for file drivers. Christian Chilan, April, 2008 */ static void do_cleanupfile(iotype iot, char *filename) { char temp[2048]; int j; hid_t driver; if (clean_file_g == -1) clean_file_g = (HDgetenv("HDF5_NOCLEANUP")==NULL) ? 1 : 0; if (clean_file_g){ switch (iot) { case POSIXIO: HDremove(filename); break; case HDF5: driver = H5Pget_driver(fapl); if (driver == H5FD_FAMILY) { for (j = 0; /*void*/; j++) { HDsnprintf(temp, sizeof temp, filename, j); if (HDaccess(temp, F_OK) < 0) break; HDremove(temp); } } else if (driver == H5FD_CORE) { hbool_t backing; /* Whether the core file has backing store */ H5Pget_fapl_core(fapl,NULL,&backing); /* If the file was stored to disk with bacing store, remove it */ if(backing) HDremove(filename); } else if (driver == H5FD_MULTI) { H5FD_mem_t mt; assert(HDstrlen(multi_letters)==H5FD_MEM_NTYPES); for (mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t,mt)) { HDsnprintf(temp, sizeof temp, "%s-%c.h5", filename, multi_letters[mt]); HDremove(temp); /*don't care if it fails*/ } } else { HDremove(filename); } H5Pclose(fapl); break; default: /* unknown request */ HDfprintf(stderr, "Unknown IO type request (%d)\n", (int)iot); HDassert(0 && "Unknown IO type"); break; } } }