mirror of
https://github.com/s3fs-fuse/s3fs-fuse.git
synced 2024-12-23 01:08:54 +00:00
Use result instead of res for consistency (#1530)
This commit is contained in:
parent
6d65e30dd5
commit
b0e8758b63
@ -34,21 +34,21 @@ AutoLock::AutoLock(pthread_mutex_t* pmutex, Type type) : auto_mutex(pmutex)
|
||||
if (type == ALREADY_LOCKED) {
|
||||
is_lock_acquired = false;
|
||||
} else if (type == NO_WAIT) {
|
||||
int res = pthread_mutex_trylock(auto_mutex);
|
||||
if(res == 0){
|
||||
int result = pthread_mutex_trylock(auto_mutex);
|
||||
if(result == 0){
|
||||
is_lock_acquired = true;
|
||||
}else if(res == EBUSY){
|
||||
}else if(result == EBUSY){
|
||||
is_lock_acquired = false;
|
||||
}else{
|
||||
S3FS_PRN_CRIT("pthread_mutex_trylock returned: %d", res);
|
||||
S3FS_PRN_CRIT("pthread_mutex_trylock returned: %d", result);
|
||||
abort();
|
||||
}
|
||||
} else {
|
||||
int res = pthread_mutex_lock(auto_mutex);
|
||||
if(res == 0){
|
||||
int result = pthread_mutex_lock(auto_mutex);
|
||||
if(result == 0){
|
||||
is_lock_acquired = true;
|
||||
}else{
|
||||
S3FS_PRN_CRIT("pthread_mutex_lock returned: %d", res);
|
||||
S3FS_PRN_CRIT("pthread_mutex_lock returned: %d", result);
|
||||
abort();
|
||||
}
|
||||
}
|
||||
@ -62,9 +62,9 @@ bool AutoLock::isLockAcquired() const
|
||||
AutoLock::~AutoLock()
|
||||
{
|
||||
if (is_lock_acquired) {
|
||||
int res = pthread_mutex_unlock(auto_mutex);
|
||||
if(res != 0){
|
||||
S3FS_PRN_CRIT("pthread_mutex_lock returned: %d", res);
|
||||
int result = pthread_mutex_unlock(auto_mutex);
|
||||
if(result != 0){
|
||||
S3FS_PRN_CRIT("pthread_mutex_lock returned: %d", result);
|
||||
abort();
|
||||
}
|
||||
}
|
||||
|
@ -159,9 +159,9 @@ StatCache::StatCache() : IsExpireTime(false), IsExpireIntervalType(false), Expir
|
||||
#if S3FS_PTHREAD_ERRORCHECK
|
||||
pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_ERRORCHECK);
|
||||
#endif
|
||||
int res;
|
||||
if(0 != (res = pthread_mutex_init(&StatCache::stat_cache_lock, &attr))){
|
||||
S3FS_PRN_CRIT("failed to init stat_cache_lock: %d", res);
|
||||
int result;
|
||||
if(0 != (result = pthread_mutex_init(&StatCache::stat_cache_lock, &attr))){
|
||||
S3FS_PRN_CRIT("failed to init stat_cache_lock: %d", result);
|
||||
abort();
|
||||
}
|
||||
}else{
|
||||
@ -173,9 +173,9 @@ StatCache::~StatCache()
|
||||
{
|
||||
if(this == StatCache::getStatCacheData()){
|
||||
Clear();
|
||||
int res = pthread_mutex_destroy(&StatCache::stat_cache_lock);
|
||||
if(res != 0){
|
||||
S3FS_PRN_CRIT("failed to destroy stat_cache_lock: %d", res);
|
||||
int result = pthread_mutex_destroy(&StatCache::stat_cache_lock);
|
||||
if(result != 0){
|
||||
S3FS_PRN_CRIT("failed to destroy stat_cache_lock: %d", result);
|
||||
abort();
|
||||
}
|
||||
}else{
|
||||
|
20
src/curl.cpp
20
src/curl.cpp
@ -313,15 +313,15 @@ void S3fsCurl::LockCurlShare(CURL* handle, curl_lock_data nLockData, curl_lock_a
|
||||
return;
|
||||
}
|
||||
S3fsCurl::callback_locks_t* locks = static_cast<S3fsCurl::callback_locks_t*>(useptr);
|
||||
int res;
|
||||
int result;
|
||||
if(CURL_LOCK_DATA_DNS == nLockData){
|
||||
if(0 != (res = pthread_mutex_lock(&locks->dns))){
|
||||
S3FS_PRN_CRIT("pthread_mutex_lock returned: %d", res);
|
||||
if(0 != (result = pthread_mutex_lock(&locks->dns))){
|
||||
S3FS_PRN_CRIT("pthread_mutex_lock returned: %d", result);
|
||||
abort();
|
||||
}
|
||||
}else if(CURL_LOCK_DATA_SSL_SESSION == nLockData){
|
||||
if(0 != (res = pthread_mutex_lock(&locks->ssl_session))){
|
||||
S3FS_PRN_CRIT("pthread_mutex_lock returned: %d", res);
|
||||
if(0 != (result = pthread_mutex_lock(&locks->ssl_session))){
|
||||
S3FS_PRN_CRIT("pthread_mutex_lock returned: %d", result);
|
||||
abort();
|
||||
}
|
||||
}
|
||||
@ -333,15 +333,15 @@ void S3fsCurl::UnlockCurlShare(CURL* handle, curl_lock_data nLockData, void* use
|
||||
return;
|
||||
}
|
||||
S3fsCurl::callback_locks_t* locks = static_cast<S3fsCurl::callback_locks_t*>(useptr);
|
||||
int res;
|
||||
int result;
|
||||
if(CURL_LOCK_DATA_DNS == nLockData){
|
||||
if(0 != (res = pthread_mutex_unlock(&locks->dns))){
|
||||
S3FS_PRN_CRIT("pthread_mutex_unlock returned: %d", res);
|
||||
if(0 != (result = pthread_mutex_unlock(&locks->dns))){
|
||||
S3FS_PRN_CRIT("pthread_mutex_unlock returned: %d", result);
|
||||
abort();
|
||||
}
|
||||
}else if(CURL_LOCK_DATA_SSL_SESSION == nLockData){
|
||||
if(0 != (res = pthread_mutex_unlock(&locks->ssl_session))){
|
||||
S3FS_PRN_CRIT("pthread_mutex_unlock returned: %d", res);
|
||||
if(0 != (result = pthread_mutex_unlock(&locks->ssl_session))){
|
||||
S3FS_PRN_CRIT("pthread_mutex_unlock returned: %d", result);
|
||||
abort();
|
||||
}
|
||||
}
|
||||
|
@ -33,23 +33,23 @@
|
||||
//-------------------------------------------------------------------
|
||||
S3fsMultiCurl::S3fsMultiCurl(int maxParallelism) : maxParallelism(maxParallelism), SuccessCallback(NULL), RetryCallback(NULL)
|
||||
{
|
||||
int res;
|
||||
int result;
|
||||
pthread_mutexattr_t attr;
|
||||
pthread_mutexattr_init(&attr);
|
||||
#if S3FS_PTHREAD_ERRORCHECK
|
||||
pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_ERRORCHECK);
|
||||
#endif
|
||||
if (0 != (res = pthread_mutex_init(&completed_tids_lock, &attr))) {
|
||||
S3FS_PRN_ERR("could not initialize completed_tids_lock: %i", res);
|
||||
if (0 != (result = pthread_mutex_init(&completed_tids_lock, &attr))) {
|
||||
S3FS_PRN_ERR("could not initialize completed_tids_lock: %i", result);
|
||||
}
|
||||
}
|
||||
|
||||
S3fsMultiCurl::~S3fsMultiCurl()
|
||||
{
|
||||
Clear();
|
||||
int res;
|
||||
if(0 != (res = pthread_mutex_destroy(&completed_tids_lock))){
|
||||
S3FS_PRN_ERR("could not destroy completed_tids_lock: %i", res);
|
||||
int result;
|
||||
if(0 != (result = pthread_mutex_destroy(&completed_tids_lock))){
|
||||
S3FS_PRN_ERR("could not destroy completed_tids_lock: %i", result);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -354,17 +354,17 @@ FdManager::FdManager()
|
||||
#if S3FS_PTHREAD_ERRORCHECK
|
||||
pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_ERRORCHECK);
|
||||
#endif
|
||||
int res;
|
||||
if(0 != (res = pthread_mutex_init(&FdManager::fd_manager_lock, &attr))){
|
||||
S3FS_PRN_CRIT("failed to init fd_manager_lock: %d", res);
|
||||
int result;
|
||||
if(0 != (result = pthread_mutex_init(&FdManager::fd_manager_lock, &attr))){
|
||||
S3FS_PRN_CRIT("failed to init fd_manager_lock: %d", result);
|
||||
abort();
|
||||
}
|
||||
if(0 != (res = pthread_mutex_init(&FdManager::cache_cleanup_lock, &attr))){
|
||||
S3FS_PRN_CRIT("failed to init cache_cleanup_lock: %d", res);
|
||||
if(0 != (result = pthread_mutex_init(&FdManager::cache_cleanup_lock, &attr))){
|
||||
S3FS_PRN_CRIT("failed to init cache_cleanup_lock: %d", result);
|
||||
abort();
|
||||
}
|
||||
if(0 != (res = pthread_mutex_init(&FdManager::reserved_diskspace_lock, &attr))){
|
||||
S3FS_PRN_CRIT("failed to init reserved_diskspace_lock: %d", res);
|
||||
if(0 != (result = pthread_mutex_init(&FdManager::reserved_diskspace_lock, &attr))){
|
||||
S3FS_PRN_CRIT("failed to init reserved_diskspace_lock: %d", result);
|
||||
abort();
|
||||
}
|
||||
FdManager::is_lock_init = true;
|
||||
@ -384,17 +384,17 @@ FdManager::~FdManager()
|
||||
fent.clear();
|
||||
|
||||
if(FdManager::is_lock_init){
|
||||
int res;
|
||||
if(0 != (res = pthread_mutex_destroy(&FdManager::fd_manager_lock))){
|
||||
S3FS_PRN_CRIT("failed to destroy fd_manager_lock: %d", res);
|
||||
int result;
|
||||
if(0 != (result = pthread_mutex_destroy(&FdManager::fd_manager_lock))){
|
||||
S3FS_PRN_CRIT("failed to destroy fd_manager_lock: %d", result);
|
||||
abort();
|
||||
}
|
||||
if(0 != (res = pthread_mutex_destroy(&FdManager::cache_cleanup_lock))){
|
||||
S3FS_PRN_CRIT("failed to destroy cache_cleanup_lock: %d", res);
|
||||
if(0 != (result = pthread_mutex_destroy(&FdManager::cache_cleanup_lock))){
|
||||
S3FS_PRN_CRIT("failed to destroy cache_cleanup_lock: %d", result);
|
||||
abort();
|
||||
}
|
||||
if(0 != (res = pthread_mutex_destroy(&FdManager::reserved_diskspace_lock))){
|
||||
S3FS_PRN_CRIT("failed to destroy reserved_diskspace_lock: %d", res);
|
||||
if(0 != (result = pthread_mutex_destroy(&FdManager::reserved_diskspace_lock))){
|
||||
S3FS_PRN_CRIT("failed to destroy reserved_diskspace_lock: %d", result);
|
||||
abort();
|
||||
}
|
||||
FdManager::is_lock_init = false;
|
||||
|
@ -103,13 +103,13 @@ FdEntity::FdEntity(const char* tpath, const char* cpath) :
|
||||
#if S3FS_PTHREAD_ERRORCHECK
|
||||
pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_ERRORCHECK);
|
||||
#endif
|
||||
int res;
|
||||
if(0 != (res = pthread_mutex_init(&fdent_lock, &attr))){
|
||||
S3FS_PRN_CRIT("failed to init fdent_lock: %d", res);
|
||||
int result;
|
||||
if(0 != (result = pthread_mutex_init(&fdent_lock, &attr))){
|
||||
S3FS_PRN_CRIT("failed to init fdent_lock: %d", result);
|
||||
abort();
|
||||
}
|
||||
if(0 != (res = pthread_mutex_init(&fdent_data_lock, &attr))){
|
||||
S3FS_PRN_CRIT("failed to init fdent_data_lock: %d", res);
|
||||
if(0 != (result = pthread_mutex_init(&fdent_data_lock, &attr))){
|
||||
S3FS_PRN_CRIT("failed to init fdent_data_lock: %d", result);
|
||||
abort();
|
||||
}
|
||||
is_lock_init = true;
|
||||
@ -120,13 +120,13 @@ FdEntity::~FdEntity()
|
||||
Clear();
|
||||
|
||||
if(is_lock_init){
|
||||
int res;
|
||||
if(0 != (res = pthread_mutex_destroy(&fdent_data_lock))){
|
||||
S3FS_PRN_CRIT("failed to destroy fdent_data_lock: %d", res);
|
||||
int result;
|
||||
if(0 != (result = pthread_mutex_destroy(&fdent_data_lock))){
|
||||
S3FS_PRN_CRIT("failed to destroy fdent_data_lock: %d", result);
|
||||
abort();
|
||||
}
|
||||
if(0 != (res = pthread_mutex_destroy(&fdent_lock))){
|
||||
S3FS_PRN_CRIT("failed to destroy fdent_lock: %d", res);
|
||||
if(0 != (result = pthread_mutex_destroy(&fdent_lock))){
|
||||
S3FS_PRN_CRIT("failed to destroy fdent_lock: %d", result);
|
||||
abort();
|
||||
}
|
||||
is_lock_init = false;
|
||||
|
@ -801,14 +801,14 @@ bool PageList::Serialize(CacheFileStat& file, bool is_output, ino_t inode)
|
||||
return true;
|
||||
}
|
||||
char* ptmp = new char[st.st_size + 1];
|
||||
int res;
|
||||
int result;
|
||||
// read from file
|
||||
if(0 >= (res = pread(file.GetFd(), ptmp, st.st_size, 0))){
|
||||
if(0 >= (result = pread(file.GetFd(), ptmp, st.st_size, 0))){
|
||||
S3FS_PRN_ERR("failed to read stats(%d)", errno);
|
||||
delete[] ptmp;
|
||||
return false;
|
||||
}
|
||||
ptmp[res] = '\0';
|
||||
ptmp[result] = '\0';
|
||||
std::string oneline;
|
||||
std::istringstream ssall(ptmp);
|
||||
|
||||
|
@ -85,15 +85,15 @@ static void s3fs_crypt_mutex_lock(int mode, int pos, const char* file, int line)
|
||||
static void s3fs_crypt_mutex_lock(int mode, int pos, const char* file, int line)
|
||||
{
|
||||
if(s3fs_crypt_mutex){
|
||||
int res;
|
||||
int result;
|
||||
if(mode & CRYPTO_LOCK){
|
||||
if(0 != (res = pthread_mutex_lock(&s3fs_crypt_mutex[pos]))){
|
||||
S3FS_PRN_CRIT("pthread_mutex_lock returned: %d", res);
|
||||
if(0 != (result = pthread_mutex_lock(&s3fs_crypt_mutex[pos]))){
|
||||
S3FS_PRN_CRIT("pthread_mutex_lock returned: %d", result);
|
||||
abort();
|
||||
}
|
||||
}else{
|
||||
if(0 != (res = pthread_mutex_unlock(&s3fs_crypt_mutex[pos]))){
|
||||
S3FS_PRN_CRIT("pthread_mutex_unlock returned: %d", res);
|
||||
if(0 != (result = pthread_mutex_unlock(&s3fs_crypt_mutex[pos]))){
|
||||
S3FS_PRN_CRIT("pthread_mutex_unlock returned: %d", result);
|
||||
abort();
|
||||
}
|
||||
}
|
||||
@ -117,9 +117,9 @@ static struct CRYPTO_dynlock_value* s3fs_dyn_crypt_mutex(const char* file, int l
|
||||
#if S3FS_PTHREAD_ERRORCHECK
|
||||
pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_ERRORCHECK);
|
||||
#endif
|
||||
int res;
|
||||
if(0 != (res = pthread_mutex_init(&(dyndata->dyn_mutex), &attr))){
|
||||
S3FS_PRN_CRIT("pthread_mutex_init returned: %d", res);
|
||||
int result;
|
||||
if(0 != (result = pthread_mutex_init(&(dyndata->dyn_mutex), &attr))){
|
||||
S3FS_PRN_CRIT("pthread_mutex_init returned: %d", result);
|
||||
return NULL;
|
||||
}
|
||||
return dyndata;
|
||||
@ -129,15 +129,15 @@ static void s3fs_dyn_crypt_mutex_lock(int mode, struct CRYPTO_dynlock_value* dyn
|
||||
static void s3fs_dyn_crypt_mutex_lock(int mode, struct CRYPTO_dynlock_value* dyndata, const char* file, int line)
|
||||
{
|
||||
if(dyndata){
|
||||
int res;
|
||||
int result;
|
||||
if(mode & CRYPTO_LOCK){
|
||||
if(0 != (res = pthread_mutex_lock(&(dyndata->dyn_mutex)))){
|
||||
S3FS_PRN_CRIT("pthread_mutex_lock returned: %d", res);
|
||||
if(0 != (result = pthread_mutex_lock(&(dyndata->dyn_mutex)))){
|
||||
S3FS_PRN_CRIT("pthread_mutex_lock returned: %d", result);
|
||||
abort();
|
||||
}
|
||||
}else{
|
||||
if(0 != (res = pthread_mutex_unlock(&(dyndata->dyn_mutex)))){
|
||||
S3FS_PRN_CRIT("pthread_mutex_unlock returned: %d", res);
|
||||
if(0 != (result = pthread_mutex_unlock(&(dyndata->dyn_mutex)))){
|
||||
S3FS_PRN_CRIT("pthread_mutex_unlock returned: %d", result);
|
||||
abort();
|
||||
}
|
||||
}
|
||||
@ -148,8 +148,8 @@ static void s3fs_destroy_dyn_crypt_mutex(struct CRYPTO_dynlock_value* dyndata, c
|
||||
static void s3fs_destroy_dyn_crypt_mutex(struct CRYPTO_dynlock_value* dyndata, const char* file, int line)
|
||||
{
|
||||
if(dyndata){
|
||||
int res = pthread_mutex_destroy(&(dyndata->dyn_mutex));
|
||||
if(res != 0){
|
||||
int result = pthread_mutex_destroy(&(dyndata->dyn_mutex));
|
||||
if(result != 0){
|
||||
S3FS_PRN_CRIT("failed to destroy dyn_mutex");
|
||||
abort();
|
||||
}
|
||||
@ -173,9 +173,9 @@ bool s3fs_init_crypt_mutex()
|
||||
pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_ERRORCHECK);
|
||||
#endif
|
||||
for(int cnt = 0; cnt < CRYPTO_num_locks(); cnt++){
|
||||
int res = pthread_mutex_init(&s3fs_crypt_mutex[cnt], &attr);
|
||||
if(res != 0){
|
||||
S3FS_PRN_CRIT("pthread_mutex_init returned: %d", res);
|
||||
int result = pthread_mutex_init(&s3fs_crypt_mutex[cnt], &attr);
|
||||
if(result != 0){
|
||||
S3FS_PRN_CRIT("pthread_mutex_init returned: %d", result);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -203,8 +203,8 @@ bool s3fs_destroy_crypt_mutex()
|
||||
CRYPTO_set_locking_callback(NULL);
|
||||
|
||||
for(int cnt = 0; cnt < CRYPTO_num_locks(); cnt++){
|
||||
int res = pthread_mutex_destroy(&s3fs_crypt_mutex[cnt]);
|
||||
if(res != 0){
|
||||
int result = pthread_mutex_destroy(&s3fs_crypt_mutex[cnt]);
|
||||
if(result != 0){
|
||||
S3FS_PRN_CRIT("failed to destroy s3fs_crypt_mutex[%d]", cnt);
|
||||
abort();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user