mirror of
https://github.com/s3fs-fuse/s3fs-fuse.git
synced 2024-11-08 13:54:10 +00:00
Address clang-tidy 19 warnings (#2474)
This commit is contained in:
parent
86e6bdaf4d
commit
254d717a4a
@ -48,6 +48,7 @@ Checks: '
|
|||||||
-misc-redundant-expression,
|
-misc-redundant-expression,
|
||||||
-misc-unused-parameters,
|
-misc-unused-parameters,
|
||||||
-misc-use-anonymous-namespace,
|
-misc-use-anonymous-namespace,
|
||||||
|
-misc-use-internal-linkage,
|
||||||
modernize-*,
|
modernize-*,
|
||||||
-modernize-avoid-c-arrays,
|
-modernize-avoid-c-arrays,
|
||||||
-modernize-loop-convert,
|
-modernize-loop-convert,
|
||||||
@ -75,6 +76,7 @@ Checks: '
|
|||||||
-readability-inconsistent-declaration-parameter-name,
|
-readability-inconsistent-declaration-parameter-name,
|
||||||
-readability-isolate-declaration,
|
-readability-isolate-declaration,
|
||||||
-readability-magic-numbers,
|
-readability-magic-numbers,
|
||||||
|
-readability-math-missing-parentheses,
|
||||||
-readability-named-parameter,
|
-readability-named-parameter,
|
||||||
-readability-redundant-access-specifiers,
|
-readability-redundant-access-specifiers,
|
||||||
-readability-redundant-declaration,
|
-readability-redundant-declaration,
|
||||||
|
@ -34,7 +34,7 @@
|
|||||||
//-------------------------------------------------------------------
|
//-------------------------------------------------------------------
|
||||||
// Utility
|
// Utility
|
||||||
//-------------------------------------------------------------------
|
//-------------------------------------------------------------------
|
||||||
inline void SetStatCacheTime(struct timespec& ts)
|
static inline void SetStatCacheTime(struct timespec& ts)
|
||||||
{
|
{
|
||||||
if(-1 == clock_gettime(static_cast<clockid_t>(CLOCK_MONOTONIC_COARSE), &ts)){
|
if(-1 == clock_gettime(static_cast<clockid_t>(CLOCK_MONOTONIC_COARSE), &ts)){
|
||||||
S3FS_PRN_CRIT("clock_gettime failed: %d", errno);
|
S3FS_PRN_CRIT("clock_gettime failed: %d", errno);
|
||||||
@ -42,13 +42,13 @@ inline void SetStatCacheTime(struct timespec& ts)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void InitStatCacheTime(struct timespec& ts)
|
static inline void InitStatCacheTime(struct timespec& ts)
|
||||||
{
|
{
|
||||||
ts.tv_sec = 0;
|
ts.tv_sec = 0;
|
||||||
ts.tv_nsec = 0;
|
ts.tv_nsec = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline int CompareStatCacheTime(const struct timespec& ts1, const struct timespec& ts2)
|
static inline int CompareStatCacheTime(const struct timespec& ts1, const struct timespec& ts2)
|
||||||
{
|
{
|
||||||
// return -1: ts1 < ts2
|
// return -1: ts1 < ts2
|
||||||
// 0: ts1 == ts2
|
// 0: ts1 == ts2
|
||||||
@ -67,7 +67,7 @@ inline int CompareStatCacheTime(const struct timespec& ts1, const struct timespe
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool IsExpireStatCacheTime(const struct timespec& ts, const time_t& expire)
|
static inline bool IsExpireStatCacheTime(const struct timespec& ts, const time_t& expire)
|
||||||
{
|
{
|
||||||
struct timespec nowts;
|
struct timespec nowts;
|
||||||
SetStatCacheTime(nowts);
|
SetStatCacheTime(nowts);
|
||||||
|
@ -173,9 +173,7 @@ bool S3fsCurl::InitS3fsCurl()
|
|||||||
// [NOTE]
|
// [NOTE]
|
||||||
// sCurlPoolSize must be over parallel(or multireq) count.
|
// sCurlPoolSize must be over parallel(or multireq) count.
|
||||||
//
|
//
|
||||||
if(sCurlPoolSize < std::max(GetMaxParallelCount(), GetMaxMultiRequest())){
|
sCurlPoolSize = std::max({sCurlPoolSize, GetMaxParallelCount(), GetMaxMultiRequest()});
|
||||||
sCurlPoolSize = std::max(GetMaxParallelCount(), GetMaxMultiRequest());
|
|
||||||
}
|
|
||||||
sCurlPool = new CurlHandlerPool(sCurlPoolSize);
|
sCurlPool = new CurlHandlerPool(sCurlPoolSize);
|
||||||
if (!sCurlPool->Init()) {
|
if (!sCurlPool->Init()) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -453,9 +453,7 @@ int FdEntity::Open(const headers_t* pmeta, off_t size, const struct timespec& ts
|
|||||||
orgmeta = *pmeta;
|
orgmeta = *pmeta;
|
||||||
size_orgmeta = get_size(orgmeta);
|
size_orgmeta = get_size(orgmeta);
|
||||||
}
|
}
|
||||||
if(new_size < size_orgmeta){
|
size_orgmeta = std::min(new_size, size_orgmeta);
|
||||||
size_orgmeta = new_size;
|
|
||||||
}
|
|
||||||
|
|
||||||
}else{
|
}else{
|
||||||
//
|
//
|
||||||
|
@ -40,7 +40,7 @@ static constexpr int CHECK_CACHEFILE_PART_SIZE = 1024 * 16; // Buffer size in
|
|||||||
// fdpage_list_t utility
|
// fdpage_list_t utility
|
||||||
//------------------------------------------------
|
//------------------------------------------------
|
||||||
// Inline function for repeated processing
|
// Inline function for repeated processing
|
||||||
inline void raw_add_compress_fdpage_list(fdpage_list_t& pagelist, const fdpage& orgpage, bool ignore_load, bool ignore_modify, bool default_load, bool default_modify)
|
static inline void raw_add_compress_fdpage_list(fdpage_list_t& pagelist, const fdpage& orgpage, bool ignore_load, bool ignore_modify, bool default_load, bool default_modify)
|
||||||
{
|
{
|
||||||
if(0 < orgpage.bytes){
|
if(0 < orgpage.bytes){
|
||||||
// [NOTE]
|
// [NOTE]
|
||||||
|
14
src/s3fs.cpp
14
src/s3fs.cpp
@ -2720,9 +2720,7 @@ static int s3fs_truncate(const char* _path, off_t size)
|
|||||||
|
|
||||||
FUSE_CTX_INFO("[path=%s][size=%lld]", path, static_cast<long long>(size));
|
FUSE_CTX_INFO("[path=%s][size=%lld]", path, static_cast<long long>(size));
|
||||||
|
|
||||||
if(size < 0){
|
size = std::max<off_t>(size, 0);
|
||||||
size = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(0 != (result = check_parent_object_access(path, X_OK))){
|
if(0 != (result = check_parent_object_access(path, X_OK))){
|
||||||
return result;
|
return result;
|
||||||
@ -3186,7 +3184,7 @@ static bool multi_head_callback(S3fsCurl* s3fscurl, void* param)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Add stat cache
|
// Add stat cache
|
||||||
std::string saved_path = s3fscurl->GetSpecialSavedPath();
|
const std::string& saved_path = s3fscurl->GetSpecialSavedPath();
|
||||||
if(!StatCache::getStatCacheData()->AddStat(saved_path, *(s3fscurl->GetResponseHeaders()))){
|
if(!StatCache::getStatCacheData()->AddStat(saved_path, *(s3fscurl->GetResponseHeaders()))){
|
||||||
S3FS_PRN_ERR("failed adding stat cache [path=%s]", saved_path.c_str());
|
S3FS_PRN_ERR("failed adding stat cache [path=%s]", saved_path.c_str());
|
||||||
return false;
|
return false;
|
||||||
@ -3261,9 +3259,9 @@ static std::unique_ptr<S3fsCurl> multi_head_retry_callback(S3fsCurl* s3fscurl)
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<S3fsCurl> newcurl(new S3fsCurl(s3fscurl->IsUseAhbe()));
|
std::unique_ptr<S3fsCurl> newcurl(new S3fsCurl(s3fscurl->IsUseAhbe()));
|
||||||
std::string path = s3fscurl->GetBasePath();
|
const std::string& path = s3fscurl->GetBasePath();
|
||||||
std::string base_path = s3fscurl->GetBasePath();
|
const std::string& base_path = s3fscurl->GetBasePath();
|
||||||
std::string saved_path = s3fscurl->GetSpecialSavedPath();
|
const std::string& saved_path = s3fscurl->GetSpecialSavedPath();
|
||||||
|
|
||||||
if(!newcurl->PreHeadRequest(path, base_path, saved_path, ssec_key_pos)){
|
if(!newcurl->PreHeadRequest(path, base_path, saved_path, ssec_key_pos)){
|
||||||
S3FS_PRN_ERR("Could not duplicate curl object(%s).", saved_path.c_str());
|
S3FS_PRN_ERR("Could not duplicate curl object(%s).", saved_path.c_str());
|
||||||
@ -3381,7 +3379,7 @@ static int readdir_multi_head(const char* path, const S3ObjList& head, void* buf
|
|||||||
|
|
||||||
for(s3obj_list_t::iterator reiter = notfound_param.notfound_list.begin(); reiter != notfound_param.notfound_list.end(); ++reiter){
|
for(s3obj_list_t::iterator reiter = notfound_param.notfound_list.begin(); reiter != notfound_param.notfound_list.end(); ++reiter){
|
||||||
int dir_result;
|
int dir_result;
|
||||||
std::string dirpath = *reiter;
|
const std::string& dirpath = *reiter;
|
||||||
if(-ENOTEMPTY == (dir_result = directory_empty(dirpath.c_str()))){
|
if(-ENOTEMPTY == (dir_result = directory_empty(dirpath.c_str()))){
|
||||||
// Found objects under the path, so the path is directory.
|
// Found objects under the path, so the path is directory.
|
||||||
|
|
||||||
|
@ -20,6 +20,8 @@
|
|||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
|
#include "common.h"
|
||||||
|
|
||||||
//-------------------------------------------------------------------
|
//-------------------------------------------------------------------
|
||||||
// Global variables
|
// Global variables
|
||||||
//-------------------------------------------------------------------
|
//-------------------------------------------------------------------
|
||||||
|
@ -402,7 +402,7 @@ std::string s3fs_base64(const unsigned char* input, size_t length)
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline unsigned char char_decode64(const char ch)
|
static inline unsigned char char_decode64(const char ch)
|
||||||
{
|
{
|
||||||
unsigned char by;
|
unsigned char by;
|
||||||
if('A' <= ch && ch <= 'Z'){ // A - Z
|
if('A' <= ch && ch <= 'Z'){ // A - Z
|
||||||
|
Loading…
Reference in New Issue
Block a user