diff options
Diffstat (limited to 'src/H5FDint.c')
-rw-r--r-- | src/H5FDint.c | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/src/H5FDint.c b/src/H5FDint.c index 25d77d1..f13f222 100644 --- a/src/H5FDint.c +++ b/src/H5FDint.c @@ -381,3 +381,47 @@ H5FD_driver_query(const H5FD_class_t *driver, unsigned long *flags /*out*/) FUNC_LEAVE_NOAPI(ret_value) } /* end H5FD_driver_query() */ + +/*------------------------------------------------------------------------- + * Function: H5FD_delete + * + * Purpose: Private version of H5FDdelete() + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +herr_t +H5FD_delete(const char *filename, hid_t fapl_id) +{ + H5FD_class_t * driver; /* VFD for file */ + H5FD_driver_prop_t driver_prop; /* Property for driver ID & info */ + H5P_genplist_t * plist; /* Property list pointer */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Sanity checks */ + HDassert(filename); + + /* Get file access property list */ + if (NULL == (plist = (H5P_genplist_t *)H5I_object(fapl_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list") + + /* Get the VFD to open the file with */ + if (H5P_peek(plist, H5F_ACS_FILE_DRV_NAME, &driver_prop) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get driver ID & info") + + /* Get driver info */ + if (NULL == (driver = (H5FD_class_t *)H5I_object(driver_prop.driver_id))) + HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, FAIL, "invalid driver ID in file access property list") + if (NULL == driver->del) + HGOTO_ERROR(H5E_VFL, H5E_UNSUPPORTED, FAIL, "file driver has no 'del' method") + + /* Dispatch to file driver */ + if ((driver->del)(filename, fapl_id)) + HGOTO_ERROR(H5E_VFL, H5E_CANTDELETEFILE, FAIL, "delete failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5FD_delete() */ |