diff options
Diffstat (limited to 'src/H5FD.c')
-rw-r--r-- | src/H5FD.c | 125 |
1 files changed, 125 insertions, 0 deletions
@@ -1733,6 +1733,131 @@ done: /*------------------------------------------------------------------------- + * Function: H5FDlock + * + * Purpose: Set a file lock + * + * Return: Success: Non-negative + * Failure: Negative + * + * Programmer: Vailin Choi; March 2015 + * + *------------------------------------------------------------------------- + */ +herr_t +H5FDlock(H5FD_t *file, hbool_t rw) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API(FAIL) + H5TRACE2("e", "*xb", file, rw); + + /* Check args */ + if(!file || !file->cls) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid file pointer") + + /* The real work */ + if(H5FD_lock(file, rw) < 0) + HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "file lock request failed") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5FDlock() */ + + + +/*------------------------------------------------------------------------- + * Function: H5FD_lock + * + * Purpose: Private version of H5FDlock() + * + * Return: Success: Non-negative + * Failure: Negative + * + * Programmer: Vailin Choi; May 2013 + * + *------------------------------------------------------------------------- + */ +herr_t +H5FD_lock(H5FD_t *file, hbool_t rw) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + HDassert(file && file->cls); + + if(file->cls->lock && (file->cls->lock)(file, rw) < 0) + HGOTO_ERROR(H5E_VFL, H5E_CANTUPDATE, FAIL, "driver lock request failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5FD_lock() */ + + +/*------------------------------------------------------------------------- + * Function: H5FDunlock + * + * Purpose: Remove a file lock + * + * Return: Success: Non-negative + * Failure: Negative + * + * Programmer: Vailin Choi; March 2015 + * + *------------------------------------------------------------------------- + */ +herr_t +H5FDunlock(H5FD_t *file) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API(FAIL) + H5TRACE1("e", "*x", file); + + /* Check args */ + if(!file || !file->cls) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid file pointer") + + /* The real work */ + if(H5FD_unlock(file) < 0) + HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "file unlock request failed") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5FDunlock() */ + + +/*------------------------------------------------------------------------- + * Function: H5FD_unlock + * + * Purpose: Private version of H5FDunlock() + * + * Return: Success: Non-negative + * Failure: Negative + * + * Programmer: Vailin Choi; May 2013 + * + *------------------------------------------------------------------------- + */ +herr_t +H5FD_unlock(H5FD_t *file) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + HDassert(file && file->cls); + + if(file->cls->unlock && (file->cls->unlock)(file) < 0) + HGOTO_ERROR(H5E_VFL, H5E_CANTUPDATE, FAIL, "driver unlock request failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5FD_unlock() */ + + +/*------------------------------------------------------------------------- * Function: H5FD_get_fileno * * Purpose: Quick and dirty routine to retrieve the file's 'fileno' value |