mirror of
https://github.com/s3fs-fuse/s3fs-fuse.git
synced 2025-01-24 06:18:25 +00:00
Merge pull request #955 from gaul/clang-tidy/misc
Address miscellaneous clang-tidy warnings
This commit is contained in:
commit
314dc5a398
26
.clang-tidy
Normal file
26
.clang-tidy
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
Checks: '
|
||||||
|
-*,
|
||||||
|
bugprone-*,
|
||||||
|
google-*,
|
||||||
|
-google-build-using-namespace,
|
||||||
|
-google-readability-casting,
|
||||||
|
-google-readability-todo,
|
||||||
|
-google-runtime-int,
|
||||||
|
-google-runtime-references,
|
||||||
|
misc-*,
|
||||||
|
-misc-misplaced-const,
|
||||||
|
-misc-redundant-expression,
|
||||||
|
-misc-unused-parameters,
|
||||||
|
modernize-*,
|
||||||
|
-modernize-deprecated-headers,
|
||||||
|
-modernize-loop-convert,
|
||||||
|
-modernize-use-auto,
|
||||||
|
-modernize-use-nullptr,
|
||||||
|
-modernize-use-using,
|
||||||
|
performance-*,
|
||||||
|
portability-*,
|
||||||
|
readability-*,
|
||||||
|
-readability-else-after-return,
|
||||||
|
-readability-implicit-bool-conversion,
|
||||||
|
-readability-named-parameter,
|
||||||
|
-readability-simplify-boolean-expr'
|
@ -1471,7 +1471,7 @@ int FdEntity::RowFlush(const char* tpath, bool force_sync)
|
|||||||
// enough disk space
|
// enough disk space
|
||||||
// Load all uninitialized area
|
// Load all uninitialized area
|
||||||
result = Load();
|
result = Load();
|
||||||
FdManager::get()->FreeReservedDiskSpace(restsize);
|
FdManager::FreeReservedDiskSpace(restsize);
|
||||||
if(0 != result){
|
if(0 != result){
|
||||||
S3FS_PRN_ERR("failed to upload all area(errno=%d)", result);
|
S3FS_PRN_ERR("failed to upload all area(errno=%d)", result);
|
||||||
return static_cast<ssize_t>(result);
|
return static_cast<ssize_t>(result);
|
||||||
@ -1646,7 +1646,7 @@ ssize_t FdEntity::Read(char* bytes, off_t start, size_t size, bool force_load)
|
|||||||
result = Load(start, load_size);
|
result = Load(start, load_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
FdManager::get()->FreeReservedDiskSpace(load_size);
|
FdManager::FreeReservedDiskSpace(load_size);
|
||||||
|
|
||||||
if(0 != result){
|
if(0 != result){
|
||||||
S3FS_PRN_ERR("could not download. start(%jd), size(%zu), errno(%d)", (intmax_t)start, size, result);
|
S3FS_PRN_ERR("could not download. start(%jd), size(%zu), errno(%d)", (intmax_t)start, size, result);
|
||||||
@ -1698,7 +1698,7 @@ ssize_t FdEntity::Write(const char* bytes, off_t start, size_t size)
|
|||||||
if(0 < start){
|
if(0 < start){
|
||||||
result = Load(0, static_cast<size_t>(start));
|
result = Load(0, static_cast<size_t>(start));
|
||||||
}
|
}
|
||||||
FdManager::get()->FreeReservedDiskSpace(restsize);
|
FdManager::FreeReservedDiskSpace(restsize);
|
||||||
if(0 != result){
|
if(0 != result){
|
||||||
S3FS_PRN_ERR("failed to load uninitialized area before writing(errno=%d)", result);
|
S3FS_PRN_ERR("failed to load uninitialized area before writing(errno=%d)", result);
|
||||||
return static_cast<ssize_t>(result);
|
return static_cast<ssize_t>(result);
|
||||||
|
15
src/s3fs.cpp
15
src/s3fs.cpp
@ -822,9 +822,9 @@ static int put_headers(const char* path, headers_t& meta, bool is_copy)
|
|||||||
}
|
}
|
||||||
|
|
||||||
FdEntity* ent = NULL;
|
FdEntity* ent = NULL;
|
||||||
if(NULL == (ent = FdManager::get()->ExistOpen(path, -1, !(FdManager::get()->IsCacheDir())))){
|
if(NULL == (ent = FdManager::get()->ExistOpen(path, -1, !FdManager::IsCacheDir()))){
|
||||||
// no opened fd
|
// no opened fd
|
||||||
if(FdManager::get()->IsCacheDir()){
|
if(FdManager::IsCacheDir()){
|
||||||
// create cache file if be needed
|
// create cache file if be needed
|
||||||
ent = FdManager::get()->Open(path, &meta, static_cast<ssize_t>(buf.st_size), -1, false, true);
|
ent = FdManager::get()->Open(path, &meta, static_cast<ssize_t>(buf.st_size), -1, false, true);
|
||||||
}
|
}
|
||||||
@ -2564,8 +2564,9 @@ static int list_bucket(const char* path, S3ObjList& head, const char* delimiter,
|
|||||||
// reset(initialize) curl object
|
// reset(initialize) curl object
|
||||||
s3fscurl.DestroyCurlHandle();
|
s3fscurl.DestroyCurlHandle();
|
||||||
|
|
||||||
if (check_content_only)
|
if(check_content_only){
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
S3FS_MALLOCTRIM(0);
|
S3FS_MALLOCTRIM(0);
|
||||||
|
|
||||||
@ -4342,7 +4343,7 @@ static int my_fuse_opt_proc(void* data, const char* arg, int key, struct fuse_ar
|
|||||||
}
|
}
|
||||||
|
|
||||||
// the second NONOPT option is the mountpoint(not utility mode)
|
// the second NONOPT option is the mountpoint(not utility mode)
|
||||||
if(mountpoint.empty() && 0 == utility_mode){
|
if(mountpoint.empty() && !utility_mode){
|
||||||
// save the mountpoint and do some basic error checking
|
// save the mountpoint and do some basic error checking
|
||||||
mountpoint = arg;
|
mountpoint = arg;
|
||||||
struct stat stbuf;
|
struct stat stbuf;
|
||||||
@ -4380,7 +4381,7 @@ static int my_fuse_opt_proc(void* data, const char* arg, int key, struct fuse_ar
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Unknown option
|
// Unknown option
|
||||||
if(0 == utility_mode){
|
if(!utility_mode){
|
||||||
S3FS_PRN_EXIT("specified unknown third option(%s).", arg);
|
S3FS_PRN_EXIT("specified unknown third option(%s).", arg);
|
||||||
}else{
|
}else{
|
||||||
S3FS_PRN_EXIT("specified unknown second option(%s). you don't need to specify second option(mountpoint) for utility mode(-u).", arg);
|
S3FS_PRN_EXIT("specified unknown second option(%s). you don't need to specify second option(mountpoint) for utility mode(-u).", arg);
|
||||||
@ -4989,7 +4990,7 @@ int main(int argc, char* argv[])
|
|||||||
case 's':
|
case 's':
|
||||||
break;
|
break;
|
||||||
case 'u':
|
case 'u':
|
||||||
utility_mode = 1;
|
utility_mode = true;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
@ -5081,7 +5082,7 @@ int main(int argc, char* argv[])
|
|||||||
// if the option was given, we all ready checked for a
|
// if the option was given, we all ready checked for a
|
||||||
// readable, non-empty directory, this checks determines
|
// readable, non-empty directory, this checks determines
|
||||||
// if the mountpoint option was ever supplied
|
// if the mountpoint option was ever supplied
|
||||||
if(utility_mode == 0){
|
if(!utility_mode){
|
||||||
if(mountpoint.empty()){
|
if(mountpoint.empty()){
|
||||||
S3FS_PRN_EXIT("missing MOUNTPOINT argument.");
|
S3FS_PRN_EXIT("missing MOUNTPOINT argument.");
|
||||||
show_usage();
|
show_usage();
|
||||||
|
@ -419,7 +419,6 @@ void free_mvnodes(MVNODE *head)
|
|||||||
free(my_head->new_path);
|
free(my_head->new_path);
|
||||||
free(my_head);
|
free(my_head);
|
||||||
}
|
}
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------------
|
//-------------------------------------------------------------------
|
||||||
@ -1362,7 +1361,6 @@ void show_help ()
|
|||||||
"\n"
|
"\n"
|
||||||
"s3fs home page: <https://github.com/s3fs-fuse/s3fs-fuse>\n"
|
"s3fs home page: <https://github.com/s3fs-fuse/s3fs-fuse>\n"
|
||||||
);
|
);
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void show_version()
|
void show_version()
|
||||||
@ -1374,7 +1372,6 @@ void show_version()
|
|||||||
"This is free software: you are free to change and redistribute it.\n"
|
"This is free software: you are free to change and redistribute it.\n"
|
||||||
"There is NO WARRANTY, to the extent permitted by law.\n",
|
"There is NO WARRANTY, to the extent permitted by law.\n",
|
||||||
VERSION, COMMIT_HASH_VAL, s3fs_crypt_lib_name());
|
VERSION, COMMIT_HASH_VAL, s3fs_crypt_lib_name());
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Loading…
x
Reference in New Issue
Block a user