diff options
Diffstat (limited to 'src/H5FD.c')
-rw-r--r-- | src/H5FD.c | 40 |
1 files changed, 37 insertions, 3 deletions
@@ -496,9 +496,9 @@ H5FD_sb_load(H5FD_t *file, const char *name, const uint8_t *buf) /* Check if driver matches driver information saved. Unfortunately, we can't push this * function to each specific driver because we're checking if the driver is correct. */ - if (!HDstrncmp(name, "NCSAfami", (size_t)8) && HDstrcmp(file->cls->name, "family")) + if (!HDstrncmp(name, "NCSAfami", (size_t)8) && HDstrcmp(file->cls->name, "family") != 0) HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, FAIL, "family driver should be used") - if (!HDstrncmp(name, "NCSAmult", (size_t)8) && HDstrcmp(file->cls->name, "multi")) + if (!HDstrncmp(name, "NCSAmult", (size_t)8) && HDstrcmp(file->cls->name, "multi") != 0) HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, FAIL, "multi driver should be used") /* Decode driver information */ @@ -2147,7 +2147,7 @@ H5FD_ctl(H5FD_t *file, uint64_t op_code, uint64_t flags, const void *input, void } else if (flags & H5FD_CTL__FAIL_IF_UNKNOWN_FLAG) { - HGOTO_ERROR(H5E_VFL, H5E_FCNTL, FAIL, "VFD ctl request failed (no ctl and fail if unknown)") + HGOTO_ERROR(H5E_VFL, H5E_FCNTL, FAIL, "VFD ctl request failed (no ctl and fail if unknown flag is set)") } done: @@ -2355,3 +2355,37 @@ H5FDdriver_query(hid_t driver_id, unsigned long *flags /*out*/) done: FUNC_LEAVE_API(ret_value) } /* end H5FDdriver_query() */ + +/*------------------------------------------------------------------------- + * Function: H5FDdelete + * + * Purpose: Deletes a file + * + * Return: Non-negative on success/Negative on failure + * + *------------------------------------------------------------------------- + */ +herr_t +H5FDdelete(const char *filename, hid_t fapl_id) +{ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_API(FAIL) + H5TRACE2("e", "*si", filename, fapl_id); + + /* Check arguments */ + if (!filename || !*filename) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no file name specified") + + if (H5P_DEFAULT == fapl_id) + fapl_id = H5P_FILE_ACCESS_DEFAULT; + else if (TRUE != H5P_isa_class(fapl_id, H5P_FILE_ACCESS)) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list") + + /* Call private function */ + if (H5FD_delete(filename, fapl_id) < 0) + HGOTO_ERROR(H5E_VFL, H5E_CANTDELETEFILE, FAIL, "unable to delete file") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5FDdelete() */ |