Remove unneeded lock utility functions (#2500)

std::mutex RAII removes the need for these.

Co-authored-by: Takeshi Nakatani <ggtakec@gmail.com>
This commit is contained in:
Andrew Gaul 2024-07-15 15:32:39 +09:00 committed by GitHub
parent 23efccbe39
commit 1c2f61e2a5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 0 additions and 66 deletions

View File

@ -5620,21 +5620,6 @@ int main(int argc, char* argv[])
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
// mutex for xml
if(!init_parser_xml_lock()){
S3FS_PRN_EXIT("could not initialize mutex for xml parser.");
s3fs_destroy_global_ssl();
exit(EXIT_FAILURE);
}
// mutex for basename/dirname
if(!init_basename_lock()){
S3FS_PRN_EXIT("could not initialize mutex for basename/dirname.");
s3fs_destroy_global_ssl();
destroy_parser_xml_lock();
exit(EXIT_FAILURE);
}
// init curl (without mime types) // init curl (without mime types)
// //
// [NOTE] // [NOTE]
@ -5654,8 +5639,6 @@ int main(int argc, char* argv[])
if(!S3fsCurl::InitS3fsCurl()){ if(!S3fsCurl::InitS3fsCurl()){
S3FS_PRN_EXIT("Could not initiate curl library."); S3FS_PRN_EXIT("Could not initiate curl library.");
s3fs_destroy_global_ssl(); s3fs_destroy_global_ssl();
destroy_parser_xml_lock();
destroy_basename_lock();
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
@ -5666,8 +5649,6 @@ int main(int argc, char* argv[])
if(0 != fuse_opt_parse(&custom_args, nullptr, nullptr, my_fuse_opt_proc)){ if(0 != fuse_opt_parse(&custom_args, nullptr, nullptr, my_fuse_opt_proc)){
S3fsCurl::DestroyS3fsCurl(); S3fsCurl::DestroyS3fsCurl();
s3fs_destroy_global_ssl(); s3fs_destroy_global_ssl();
destroy_parser_xml_lock();
destroy_basename_lock();
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
@ -5683,16 +5664,12 @@ int main(int argc, char* argv[])
S3FS_PRN_EXIT("use_sse option could not be specified with storage class reduced_redundancy."); S3FS_PRN_EXIT("use_sse option could not be specified with storage class reduced_redundancy.");
S3fsCurl::DestroyS3fsCurl(); S3fsCurl::DestroyS3fsCurl();
s3fs_destroy_global_ssl(); s3fs_destroy_global_ssl();
destroy_parser_xml_lock();
destroy_basename_lock();
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
if(!S3fsCurl::FinalCheckSse()){ if(!S3fsCurl::FinalCheckSse()){
S3FS_PRN_EXIT("something wrong about SSE options."); S3FS_PRN_EXIT("something wrong about SSE options.");
S3fsCurl::DestroyS3fsCurl(); S3fsCurl::DestroyS3fsCurl();
s3fs_destroy_global_ssl(); s3fs_destroy_global_ssl();
destroy_parser_xml_lock();
destroy_basename_lock();
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
@ -5711,8 +5688,6 @@ int main(int argc, char* argv[])
if(!ps3fscred->CheckAllParams()){ if(!ps3fscred->CheckAllParams()){
S3fsCurl::DestroyS3fsCurl(); S3fsCurl::DestroyS3fsCurl();
s3fs_destroy_global_ssl(); s3fs_destroy_global_ssl();
destroy_parser_xml_lock();
destroy_basename_lock();
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
@ -5726,8 +5701,6 @@ int main(int argc, char* argv[])
show_usage(); show_usage();
S3fsCurl::DestroyS3fsCurl(); S3fsCurl::DestroyS3fsCurl();
s3fs_destroy_global_ssl(); s3fs_destroy_global_ssl();
destroy_parser_xml_lock();
destroy_basename_lock();
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
} }
@ -5737,8 +5710,6 @@ int main(int argc, char* argv[])
S3FS_PRN_EXIT("temporary directory doesn't exists."); S3FS_PRN_EXIT("temporary directory doesn't exists.");
S3fsCurl::DestroyS3fsCurl(); S3fsCurl::DestroyS3fsCurl();
s3fs_destroy_global_ssl(); s3fs_destroy_global_ssl();
destroy_parser_xml_lock();
destroy_basename_lock();
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
@ -5747,8 +5718,6 @@ int main(int argc, char* argv[])
S3FS_PRN_EXIT("could not allow cache directory permission, check permission of cache directories."); S3FS_PRN_EXIT("could not allow cache directory permission, check permission of cache directories.");
S3fsCurl::DestroyS3fsCurl(); S3fsCurl::DestroyS3fsCurl();
s3fs_destroy_global_ssl(); s3fs_destroy_global_ssl();
destroy_parser_xml_lock();
destroy_basename_lock();
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
@ -5795,7 +5764,6 @@ int main(int argc, char* argv[])
S3FS_PRN_EXIT("Using https and a bucket name with periods is unsupported."); S3FS_PRN_EXIT("Using https and a bucket name with periods is unsupported.");
S3fsCurl::DestroyS3fsCurl(); S3fsCurl::DestroyS3fsCurl();
s3fs_destroy_global_ssl(); s3fs_destroy_global_ssl();
destroy_parser_xml_lock();
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
} }
@ -5807,8 +5775,6 @@ int main(int argc, char* argv[])
S3fsCurl::DestroyS3fsCurl(); S3fsCurl::DestroyS3fsCurl();
s3fs_destroy_global_ssl(); s3fs_destroy_global_ssl();
destroy_parser_xml_lock();
destroy_basename_lock();
exit(exitcode); exit(exitcode);
} }
@ -5827,8 +5793,6 @@ int main(int argc, char* argv[])
if(!FdManager::IsSafeDiskSpaceWithLog(nullptr, S3fsCurl::GetMultipartSize() * S3fsCurl::GetMaxParallelCount())){ if(!FdManager::IsSafeDiskSpaceWithLog(nullptr, S3fsCurl::GetMultipartSize() * S3fsCurl::GetMaxParallelCount())){
S3fsCurl::DestroyS3fsCurl(); S3fsCurl::DestroyS3fsCurl();
s3fs_destroy_global_ssl(); s3fs_destroy_global_ssl();
destroy_parser_xml_lock();
destroy_basename_lock();
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
} }
@ -5886,8 +5850,6 @@ int main(int argc, char* argv[])
S3FS_PRN_WARN("Could not release curl library."); S3FS_PRN_WARN("Could not release curl library.");
} }
s3fs_destroy_global_ssl(); s3fs_destroy_global_ssl();
destroy_parser_xml_lock();
destroy_basename_lock();
// cleanup xml2 // cleanup xml2
xmlCleanupParser(); xmlCleanupParser();

View File

@ -169,16 +169,6 @@ int is_uid_include_group(uid_t uid, gid_t gid)
// //
static std::mutex basename_lock; static std::mutex basename_lock;
bool init_basename_lock()
{
return true;
}
bool destroy_basename_lock()
{
return true;
}
std::string mydirname(const std::string& path) std::string mydirname(const std::string& path)
{ {
const std::lock_guard<std::mutex> lock(basename_lock); const std::lock_guard<std::mutex> lock(basename_lock);

View File

@ -45,8 +45,6 @@ void init_sysconf_vars();
std::string get_username(uid_t uid); std::string get_username(uid_t uid);
int is_uid_include_group(uid_t uid, gid_t gid); int is_uid_include_group(uid_t uid, gid_t gid);
bool init_basename_lock();
bool destroy_basename_lock();
std::string mydirname(const char* path); std::string mydirname(const char* path);
std::string mydirname(const std::string& path); std::string mydirname(const std::string& path);
std::string mybasename(const char* path); std::string mybasename(const char* path);

View File

@ -481,19 +481,6 @@ bool simple_parse_xml(const char* data, size_t len, const char* key, std::string
return result; return result;
} }
//-------------------------------------------------------------------
// Utility for lock
//-------------------------------------------------------------------
bool init_parser_xml_lock()
{
return true;
}
bool destroy_parser_xml_lock()
{
return true;
}
/* /*
* Local variables: * Local variables:
* tab-width: 4 * tab-width: 4

View File

@ -47,9 +47,6 @@ bool get_incomp_mpu_list(xmlDocPtr doc, incomp_mpu_list_t& list);
bool simple_parse_xml(const char* data, size_t len, const char* key, std::string& value); bool simple_parse_xml(const char* data, size_t len, const char* key, std::string& value);
bool init_parser_xml_lock();
bool destroy_parser_xml_lock();
#endif // S3FS_S3FS_XML_H_ #endif // S3FS_S3FS_XML_H_
/* /*