Make some methods and parameters const (#2078)

This requires making some locks mutable.
This commit is contained in:
Andrew Gaul 2023-01-04 16:53:39 +05:30 committed by GitHub
parent 14eb1a7fd8
commit 0ba49518e9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
17 changed files with 52 additions and 53 deletions

View File

@ -334,7 +334,7 @@ bool StatCache::IsNoObjectCache(const std::string& key, bool overcheck)
return false; return false;
} }
bool StatCache::AddStat(const std::string& key, headers_t& meta, bool forcedir, bool no_truncate) bool StatCache::AddStat(const std::string& key, const headers_t& meta, bool forcedir, bool no_truncate)
{ {
if(!no_truncate && CacheSize< 1){ if(!no_truncate && CacheSize< 1){
return true; return true;
@ -372,7 +372,7 @@ bool StatCache::AddStat(const std::string& key, headers_t& meta, bool forcedir,
ent->meta.clear(); ent->meta.clear();
SetStatCacheTime(ent->cache_date); // Set time. SetStatCacheTime(ent->cache_date); // Set time.
//copy only some keys //copy only some keys
for(headers_t::iterator iter = meta.begin(); iter != meta.end(); ++iter){ for(headers_t::const_iterator iter = meta.begin(); iter != meta.end(); ++iter){
std::string tag = lower(iter->first); std::string tag = lower(iter->first);
std::string value = iter->second; std::string value = iter->second;
if(tag == "content-type"){ if(tag == "content-type"){

View File

@ -163,7 +163,7 @@ class StatCache
bool AddNoObjectCache(const std::string& key); bool AddNoObjectCache(const std::string& key);
// Add stat cache // Add stat cache
bool AddStat(const std::string& key, headers_t& meta, bool forcedir = false, bool no_truncate = false); bool AddStat(const std::string& key, const headers_t& meta, bool forcedir = false, bool no_truncate = false);
// Update meta stats // Update meta stats
bool UpdateMetaStats(const std::string& key, headers_t& meta); bool UpdateMetaStats(const std::string& key, headers_t& meta);

View File

@ -1988,7 +1988,7 @@ bool S3fsCurl::SetUseAhbe(bool ahbe)
return old; return old;
} }
bool S3fsCurl::GetResponseCode(long& responseCode, bool from_curl_handle) bool S3fsCurl::GetResponseCode(long& responseCode, bool from_curl_handle) const
{ {
responseCode = -1; responseCode = -1;

View File

@ -339,7 +339,7 @@ class S3fsCurl
bool GetIAMCredentials(const char* cred_url, const char* iam_v2_token, const char* ibm_secret_access_key, std::string& response); bool GetIAMCredentials(const char* cred_url, const char* iam_v2_token, const char* ibm_secret_access_key, std::string& response);
bool GetIAMRoleFromMetaData(const char* cred_url, const char* iam_v2_token, std::string& token); bool GetIAMRoleFromMetaData(const char* cred_url, const char* iam_v2_token, std::string& token);
bool AddSseRequestHead(sse_type_t ssetype, const std::string& ssevalue, bool is_only_c, bool is_copy); bool AddSseRequestHead(sse_type_t ssetype, const std::string& ssevalue, bool is_only_c, bool is_copy);
bool GetResponseCode(long& responseCode, bool from_curl_handle = true); bool GetResponseCode(long& responseCode, bool from_curl_handle = true) const;
int RequestPerform(bool dontAddAuthHeaders=false); int RequestPerform(bool dontAddAuthHeaders=false);
int DeleteRequest(const char* tpath); int DeleteRequest(const char* tpath);
int GetIAMv2ApiToken(const char* token_url, int token_ttl, const char* token_ttl_hdr, std::string& response); int GetIAMv2ApiToken(const char* token_url, int token_ttl, const char* token_ttl_hdr, std::string& response);
@ -371,9 +371,9 @@ class S3fsCurl
std::string GetSpecialSavedPath() const { return saved_path; } std::string GetSpecialSavedPath() const { return saved_path; }
std::string GetUrl() const { return url; } std::string GetUrl() const { return url; }
std::string GetOp() const { return op; } std::string GetOp() const { return op; }
headers_t* GetResponseHeaders() { return &responseHeaders; } const headers_t* GetResponseHeaders() const { return &responseHeaders; }
BodyData* GetBodyData() { return &bodydata; } const BodyData* GetBodyData() const { return &bodydata; }
BodyData* GetHeadData() { return &headdata; } const BodyData* GetHeadData() const { return &headdata; }
CURLcode GetCurlCode() const { return curlCode; } CURLcode GetCurlCode() const { return curlCode; }
long GetLastResponseCode() const { return LastResponseCode; } long GetLastResponseCode() const { return LastResponseCode; }
bool SetUseAhbe(bool ahbe); bool SetUseAhbe(bool ahbe);

View File

@ -62,7 +62,7 @@ class S3fsMultiCurl
explicit S3fsMultiCurl(int maxParallelism); explicit S3fsMultiCurl(int maxParallelism);
~S3fsMultiCurl(); ~S3fsMultiCurl();
int GetMaxParallelism() { return maxParallelism; } int GetMaxParallelism() const { return maxParallelism; }
S3fsMultiSuccessCallback SetSuccessCallback(S3fsMultiSuccessCallback function); S3fsMultiSuccessCallback SetSuccessCallback(S3fsMultiSuccessCallback function);
S3fsMultiNotFoundCallback SetNotFoundCallback(S3fsMultiNotFoundCallback function); S3fsMultiNotFoundCallback SetNotFoundCallback(S3fsMultiNotFoundCallback function);

View File

@ -28,7 +28,6 @@ class sse_type_t;
//---------------------------------------------- //----------------------------------------------
// Functions // Functions
//---------------------------------------------- //----------------------------------------------
std::string GetContentMD5(int fd);
struct curl_slist* curl_slist_sort_insert(struct curl_slist* list, const char* data); struct curl_slist* curl_slist_sort_insert(struct curl_slist* list, const char* data);
struct curl_slist* curl_slist_sort_insert(struct curl_slist* list, const char* key, const char* value); struct curl_slist* curl_slist_sort_insert(struct curl_slist* list, const char* key, const char* value);
struct curl_slist* curl_slist_remove(struct curl_slist* list, const char* key); struct curl_slist* curl_slist_remove(struct curl_slist* list, const char* key);

View File

@ -196,7 +196,7 @@ void FdEntity::Clear()
// The return value is the same as the class method GetInode(). // The return value is the same as the class method GetInode().
// The caller must have exclusive control. // The caller must have exclusive control.
// //
ino_t FdEntity::GetInode() ino_t FdEntity::GetInode() const
{ {
if(cachepath.empty()){ if(cachepath.empty()){
S3FS_PRN_INFO("cache file path is empty, then return inode as 0."); S3FS_PRN_INFO("cache file path is empty, then return inode as 0.");
@ -298,7 +298,7 @@ int FdEntity::OpenPseudoFd(int flags, AutoLock::Type locktype)
return pseudo_fd; return pseudo_fd;
} }
int FdEntity::GetOpenCount(AutoLock::Type locktype) int FdEntity::GetOpenCount(AutoLock::Type locktype) const
{ {
AutoLock auto_lock(&fdent_lock, locktype); AutoLock auto_lock(&fdent_lock, locktype);
@ -362,7 +362,7 @@ int FdEntity::OpenMirrorFile()
return mirrorfd; return mirrorfd;
} }
bool FdEntity::FindPseudoFd(int fd, AutoLock::Type locktype) bool FdEntity::FindPseudoFd(int fd, AutoLock::Type locktype) const
{ {
AutoLock auto_lock(&fdent_lock, locktype); AutoLock auto_lock(&fdent_lock, locktype);
@ -777,7 +777,7 @@ bool FdEntity::IsModified() const
return pagelist.IsModified(); return pagelist.IsModified();
} }
bool FdEntity::GetStats(struct stat& st, AutoLock::Type locktype) bool FdEntity::GetStats(struct stat& st, AutoLock::Type locktype) const
{ {
AutoLock auto_lock(&fdent_lock, locktype); AutoLock auto_lock(&fdent_lock, locktype);
if(-1 == physical_fd){ if(-1 == physical_fd){
@ -976,7 +976,7 @@ bool FdEntity::ClearHoldingMtime(AutoLock::Type locktype)
return true; return true;
} }
bool FdEntity::GetSize(off_t& size) bool FdEntity::GetSize(off_t& size) const
{ {
AutoLock auto_lock(&fdent_lock); AutoLock auto_lock(&fdent_lock);
if(-1 == physical_fd){ if(-1 == physical_fd){
@ -988,7 +988,7 @@ bool FdEntity::GetSize(off_t& size)
return true; return true;
} }
bool FdEntity::GetXattr(std::string& xattr) bool FdEntity::GetXattr(std::string& xattr) const
{ {
AutoLock auto_lock(&fdent_lock); AutoLock auto_lock(&fdent_lock);
@ -2531,7 +2531,7 @@ bool FdEntity::AddUntreated(off_t start, off_t size)
return result; return result;
} }
bool FdEntity::GetLastUpdateUntreatedPart(off_t& start, off_t& size) bool FdEntity::GetLastUpdateUntreatedPart(off_t& start, off_t& size) const
{ {
// Get last untreated area // Get last untreated area
if(!untreated_list.GetLastUpdatePart(start, size)){ if(!untreated_list.GetLastUpdatePart(start, size)){

View File

@ -49,7 +49,7 @@ class FdEntity
static bool mixmultipart; // whether multipart uploading can use copy api. static bool mixmultipart; // whether multipart uploading can use copy api.
static bool streamupload; // whether stream uploading. static bool streamupload; // whether stream uploading.
pthread_mutex_t fdent_lock; mutable pthread_mutex_t fdent_lock;
bool is_lock_init; bool is_lock_init;
std::string path; // object path std::string path; // object path
int physical_fd; // physical file(cache or temporary file) descriptor int physical_fd; // physical file(cache or temporary file) descriptor
@ -73,7 +73,7 @@ class FdEntity
static ino_t GetInode(int fd); static ino_t GetInode(int fd);
void Clear(); void Clear();
ino_t GetInode(); ino_t GetInode() const;
int OpenMirrorFile(); int OpenMirrorFile();
int NoCacheLoadAndPost(PseudoFdInfo* pseudo_obj, off_t start = 0, off_t size = 0); // size=0 means loading to end int NoCacheLoadAndPost(PseudoFdInfo* pseudo_obj, off_t start = 0, off_t size = 0); // size=0 means loading to end
PseudoFdInfo* CheckPseudoFdFlags(int fd, bool writable, AutoLock::Type locktype = AutoLock::NONE); PseudoFdInfo* CheckPseudoFdFlags(int fd, bool writable, AutoLock::Type locktype = AutoLock::NONE);
@ -105,12 +105,12 @@ class FdEntity
void Close(int fd); void Close(int fd);
bool IsOpen() const { return (-1 != physical_fd); } bool IsOpen() const { return (-1 != physical_fd); }
bool FindPseudoFd(int fd, AutoLock::Type locktype = AutoLock::NONE); bool FindPseudoFd(int fd, AutoLock::Type locktype = AutoLock::NONE) const;
int Open(const headers_t* pmeta, off_t size, const struct timespec& ts_mctime, int flags, AutoLock::Type type); int Open(const headers_t* pmeta, off_t size, const struct timespec& ts_mctime, int flags, AutoLock::Type type);
bool LoadAll(int fd, headers_t* pmeta = NULL, off_t* size = NULL, bool force_load = false); bool LoadAll(int fd, headers_t* pmeta = NULL, off_t* size = NULL, bool force_load = false);
int Dup(int fd, AutoLock::Type locktype = AutoLock::NONE); int Dup(int fd, AutoLock::Type locktype = AutoLock::NONE);
int OpenPseudoFd(int flags = O_RDONLY, AutoLock::Type locktype = AutoLock::NONE); int OpenPseudoFd(int flags = O_RDONLY, AutoLock::Type locktype = AutoLock::NONE);
int GetOpenCount(AutoLock::Type locktype = AutoLock::NONE); int GetOpenCount(AutoLock::Type locktype = AutoLock::NONE) const;
const char* GetPath() const { return path.c_str(); } const char* GetPath() const { return path.c_str(); }
bool RenamePath(const std::string& newpath, std::string& fentmapkey); bool RenamePath(const std::string& newpath, std::string& fentmapkey);
int GetPhysicalFd() const { return physical_fd; } int GetPhysicalFd() const { return physical_fd; }
@ -118,7 +118,7 @@ class FdEntity
bool MergeOrgMeta(headers_t& updatemeta); bool MergeOrgMeta(headers_t& updatemeta);
int UploadPending(int fd, AutoLock::Type type); int UploadPending(int fd, AutoLock::Type type);
bool GetStats(struct stat& st, AutoLock::Type locktype = AutoLock::NONE); bool GetStats(struct stat& st, AutoLock::Type locktype = AutoLock::NONE) const;
int SetCtime(struct timespec time, AutoLock::Type locktype = AutoLock::NONE); int SetCtime(struct timespec time, AutoLock::Type locktype = AutoLock::NONE);
int SetAtime(struct timespec time, AutoLock::Type locktype = AutoLock::NONE); int SetAtime(struct timespec time, AutoLock::Type locktype = AutoLock::NONE);
int SetMCtime(struct timespec mtime, struct timespec ctime, AutoLock::Type locktype = AutoLock::NONE); int SetMCtime(struct timespec mtime, struct timespec ctime, AutoLock::Type locktype = AutoLock::NONE);
@ -128,8 +128,8 @@ class FdEntity
bool UpdateMCtime(); bool UpdateMCtime();
bool SetHoldingMtime(struct timespec mtime, AutoLock::Type locktype = AutoLock::NONE); bool SetHoldingMtime(struct timespec mtime, AutoLock::Type locktype = AutoLock::NONE);
bool ClearHoldingMtime(AutoLock::Type locktype = AutoLock::NONE); bool ClearHoldingMtime(AutoLock::Type locktype = AutoLock::NONE);
bool GetSize(off_t& size); bool GetSize(off_t& size) const;
bool GetXattr(std::string& xattr); bool GetXattr(std::string& xattr) const;
bool SetXattr(const std::string& xattr); bool SetXattr(const std::string& xattr);
bool SetMode(mode_t mode); bool SetMode(mode_t mode);
bool SetUId(uid_t uid); bool SetUId(uid_t uid);
@ -150,7 +150,7 @@ class FdEntity
void MarkDirtyNewFile(); void MarkDirtyNewFile();
bool GetLastUpdateUntreatedPart(off_t& start, off_t& size); bool GetLastUpdateUntreatedPart(off_t& start, off_t& size) const;
bool ReplaceLastUpdateUntreatedPart(off_t front_start, off_t front_size, off_t behind_start, off_t behind_size); bool ReplaceLastUpdateUntreatedPart(off_t front_start, off_t front_size, off_t behind_start, off_t behind_size);
}; };

View File

@ -302,7 +302,7 @@ bool PseudoFdInfo::GetUploadId(std::string& id) const
return true; return true;
} }
bool PseudoFdInfo::GetEtaglist(etaglist_t& list) bool PseudoFdInfo::GetEtaglist(etaglist_t& list) const
{ {
if(!IsUploading()){ if(!IsUploading()){
S3FS_PRN_ERR("Multipart Upload has not started yet."); S3FS_PRN_ERR("Multipart Upload has not started yet.");

View File

@ -66,7 +66,7 @@ class PseudoFdInfo
filepart_list_t upload_list; filepart_list_t upload_list;
petagpool etag_entities; // list of etag string and part number entities(to maintain the etag entity even if MPPART_INFO is destroyed) petagpool etag_entities; // list of etag string and part number entities(to maintain the etag entity even if MPPART_INFO is destroyed)
bool is_lock_init; bool is_lock_init;
pthread_mutex_t upload_list_lock; // protects upload_id and upload_list mutable pthread_mutex_t upload_list_lock; // protects upload_id and upload_list
Semaphore uploaded_sem; // use a semaphore to trigger an upload completion like event flag Semaphore uploaded_sem; // use a semaphore to trigger an upload completion like event flag
volatile int instruct_count; // number of instructions for processing by threads volatile int instruct_count; // number of instructions for processing by threads
volatile int completed_count; // number of completed processes by thread volatile int completed_count; // number of completed processes by thread
@ -103,7 +103,7 @@ class PseudoFdInfo
bool IsUploading() const { return !upload_id.empty(); } bool IsUploading() const { return !upload_id.empty(); }
bool GetUploadId(std::string& id) const; bool GetUploadId(std::string& id) const;
bool GetEtaglist(etaglist_t& list); bool GetEtaglist(etaglist_t& list) const;
bool AppendUploadPart(off_t start, off_t size, bool is_copy = false, etagpair** ppetag = NULL); bool AppendUploadPart(off_t start, off_t size, bool is_copy = false, etagpair** ppetag = NULL);

View File

@ -99,7 +99,7 @@ bool UntreatedParts::AddPart(off_t start, off_t size)
return true; return true;
} }
bool UntreatedParts::RowGetPart(off_t& start, off_t& size, off_t max_size, off_t min_size, bool lastpart) bool UntreatedParts::RowGetPart(off_t& start, off_t& size, off_t max_size, off_t min_size, bool lastpart) const
{ {
if(max_size <= 0 || min_size < 0 || max_size < min_size){ if(max_size <= 0 || min_size < 0 || max_size < min_size){
S3FS_PRN_ERR("Paramter are wrong(max_size=%lld, min_size=%lld).", static_cast<long long int>(max_size), static_cast<long long int>(min_size)); S3FS_PRN_ERR("Paramter are wrong(max_size=%lld, min_size=%lld).", static_cast<long long int>(max_size), static_cast<long long int>(min_size));
@ -108,7 +108,7 @@ bool UntreatedParts::RowGetPart(off_t& start, off_t& size, off_t max_size, off_t
AutoLock auto_lock(&untreated_list_lock); AutoLock auto_lock(&untreated_list_lock);
// Check the overlap with the existing part and add the part. // Check the overlap with the existing part and add the part.
for(untreated_list_t::iterator iter = untreated_list.begin(); iter != untreated_list.end(); ++iter){ for(untreated_list_t::const_iterator iter = untreated_list.begin(); iter != untreated_list.end(); ++iter){
if(!lastpart || iter->untreated_tag == last_tag){ if(!lastpart || iter->untreated_tag == last_tag){
if(min_size <= iter->size){ if(min_size <= iter->size){
if(iter->size <= max_size){ if(iter->size <= max_size){
@ -191,7 +191,7 @@ bool UntreatedParts::ClearParts(off_t start, off_t size)
// //
// Update the last updated Untreated part // Update the last updated Untreated part
// //
bool UntreatedParts::GetLastUpdatePart(off_t& start, off_t& size) bool UntreatedParts::GetLastUpdatePart(off_t& start, off_t& size) const
{ {
AutoLock auto_lock(&untreated_list_lock); AutoLock auto_lock(&untreated_list_lock);

View File

@ -30,14 +30,14 @@
class UntreatedParts class UntreatedParts
{ {
private: private:
pthread_mutex_t untreated_list_lock; // protects untreated_list mutable pthread_mutex_t untreated_list_lock; // protects untreated_list
bool is_lock_init; bool is_lock_init;
untreated_list_t untreated_list; untreated_list_t untreated_list;
long last_tag; // [NOTE] Use this to identify the latest updated part. long last_tag; // [NOTE] Use this to identify the latest updated part.
private: private:
bool RowGetPart(off_t& start, off_t& size, off_t max_size, off_t min_size, bool lastpart); bool RowGetPart(off_t& start, off_t& size, off_t max_size, off_t min_size, bool lastpart) const;
public: public:
UntreatedParts(); UntreatedParts();
@ -46,12 +46,12 @@ class UntreatedParts
bool empty(); bool empty();
bool AddPart(off_t start, off_t size); bool AddPart(off_t start, off_t size);
bool GetLastUpdatedPart(off_t& start, off_t& size, off_t max_size, off_t min_size = MIN_MULTIPART_SIZE) { return RowGetPart(start, size, max_size, min_size, true); } bool GetLastUpdatedPart(off_t& start, off_t& size, off_t max_size, off_t min_size = MIN_MULTIPART_SIZE) const { return RowGetPart(start, size, max_size, min_size, true); }
bool ClearParts(off_t start, off_t size); bool ClearParts(off_t start, off_t size);
bool ClearAll() { return ClearParts(0, 0); } bool ClearAll() { return ClearParts(0, 0); }
bool GetLastUpdatePart(off_t& start, off_t& size); bool GetLastUpdatePart(off_t& start, off_t& size) const;
bool ReplaceLastUpdatePart(off_t start, off_t size); bool ReplaceLastUpdatePart(off_t start, off_t size);
bool RemoveLastUpdatePart(); bool RemoveLastUpdatePart();

View File

@ -3112,7 +3112,7 @@ static int list_bucket(const char* path, S3ObjList& head, const char* delimiter,
S3FS_PRN_ERR("ListBucketRequest returns with error."); S3FS_PRN_ERR("ListBucketRequest returns with error.");
return result; return result;
} }
BodyData* body = s3fscurl.GetBodyData(); const BodyData* body = s3fscurl.GetBodyData();
// xmlDocPtr // xmlDocPtr
if(NULL == (doc = xmlReadMemory(body->str(), static_cast<int>(body->size()), "", NULL, 0))){ if(NULL == (doc = xmlReadMemory(body->str(), static_cast<int>(body->size()), "", NULL, 0))){
@ -4037,7 +4037,7 @@ static int s3fs_check_service()
if(300 <= responseCode && responseCode < 500){ if(300 <= responseCode && responseCode < 500){
// check region error(for putting message or retrying) // check region error(for putting message or retrying)
BodyData* body = s3fscurl.GetBodyData(); const BodyData* body = s3fscurl.GetBodyData();
std::string expectregion; std::string expectregion;
std::string expectendpoint; std::string expectendpoint;
if(check_region_error(body->str(), body->size(), expectregion)){ if(check_region_error(body->str(), body->size(), expectregion)){

View File

@ -285,7 +285,7 @@ bool S3fsCred::SetAccessKeyWithSessionToken(const char* AccessKeyId, const char*
return true; return true;
} }
bool S3fsCred::IsSetAccessKeys(AutoLock::Type type) bool S3fsCred::IsSetAccessKeys(AutoLock::Type type) const
{ {
AutoLock auto_lock(&token_lock, type); AutoLock auto_lock(&token_lock, type);
@ -321,14 +321,14 @@ bool S3fsCred::SetIAMRole(const char* role, AutoLock::Type type)
return true; return true;
} }
std::string S3fsCred::GetIAMRole(AutoLock::Type type) std::string S3fsCred::GetIAMRole(AutoLock::Type type) const
{ {
AutoLock auto_lock(&token_lock, type); AutoLock auto_lock(&token_lock, type);
return IAM_role; return IAM_role;
} }
bool S3fsCred::IsSetIAMRole(AutoLock::Type type) bool S3fsCred::IsSetIAMRole(AutoLock::Type type) const
{ {
AutoLock auto_lock(&token_lock, type); AutoLock auto_lock(&token_lock, type);
@ -435,7 +435,7 @@ int S3fsCred::SetIMDSVersion(int version, AutoLock::Type type)
return old; return old;
} }
int S3fsCred::GetIMDSVersion(AutoLock::Type type) int S3fsCred::GetIMDSVersion(AutoLock::Type type) const
{ {
AutoLock auto_lock(&token_lock, type); AutoLock auto_lock(&token_lock, type);
@ -455,7 +455,7 @@ bool S3fsCred::SetIAMv2APIToken(const std::string& token, AutoLock::Type type)
return true; return true;
} }
std::string S3fsCred::GetIAMv2APIToken(AutoLock::Type type) std::string S3fsCred::GetIAMv2APIToken(AutoLock::Type type) const
{ {
AutoLock auto_lock(&token_lock, type); AutoLock auto_lock(&token_lock, type);
@ -596,7 +596,7 @@ bool S3fsCred::SetIAMRoleFromMetaData(const char* response, AutoLock::Type type)
// //
// Check passwd file readable // Check passwd file readable
// //
bool S3fsCred::IsReadableS3fsPasswdFile() bool S3fsCred::IsReadableS3fsPasswdFile() const
{ {
if(passwd_file.empty()){ if(passwd_file.empty()){
return false; return false;

View File

@ -53,7 +53,7 @@ class S3fsCred
static std::string bucket_name; static std::string bucket_name;
pthread_mutex_t token_lock; mutable pthread_mutex_t token_lock;
bool is_lock_init; bool is_lock_init;
std::string passwd_file; std::string passwd_file;
@ -104,7 +104,7 @@ class S3fsCred
bool SetAccessKey(const char* AccessKeyId, const char* SecretAccessKey, AutoLock::Type type); bool SetAccessKey(const char* AccessKeyId, const char* SecretAccessKey, AutoLock::Type type);
bool SetAccessKeyWithSessionToken(const char* AccessKeyId, const char* SecretAccessKey, const char * SessionToken, AutoLock::Type type); bool SetAccessKeyWithSessionToken(const char* AccessKeyId, const char* SecretAccessKey, const char * SessionToken, AutoLock::Type type);
bool IsSetAccessKeys(AutoLock::Type type); bool IsSetAccessKeys(AutoLock::Type type) const;
bool SetIsECS(bool flag); bool SetIsECS(bool flag);
bool SetIsUseSessionToken(bool flag); bool SetIsUseSessionToken(bool flag);
@ -112,20 +112,20 @@ class S3fsCred
bool SetIsIBMIAMAuth(bool flag); bool SetIsIBMIAMAuth(bool flag);
int SetIMDSVersion(int version, AutoLock::Type type); int SetIMDSVersion(int version, AutoLock::Type type);
int GetIMDSVersion(AutoLock::Type type); int GetIMDSVersion(AutoLock::Type type) const;
bool SetIAMv2APIToken(const std::string& token, AutoLock::Type type); bool SetIAMv2APIToken(const std::string& token, AutoLock::Type type);
std::string GetIAMv2APIToken(AutoLock::Type type); std::string GetIAMv2APIToken(AutoLock::Type type) const;
bool SetIAMRole(const char* role, AutoLock::Type type); bool SetIAMRole(const char* role, AutoLock::Type type);
std::string GetIAMRole(AutoLock::Type type); std::string GetIAMRole(AutoLock::Type type) const;
bool IsSetIAMRole(AutoLock::Type type); bool IsSetIAMRole(AutoLock::Type type) const;
size_t SetIAMFieldCount(size_t field_count); size_t SetIAMFieldCount(size_t field_count);
std::string SetIAMCredentialsURL(const char* url); std::string SetIAMCredentialsURL(const char* url);
std::string SetIAMTokenField(const char* token_field); std::string SetIAMTokenField(const char* token_field);
std::string SetIAMExpiryField(const char* expiry_field); std::string SetIAMExpiryField(const char* expiry_field);
bool IsReadableS3fsPasswdFile(); bool IsReadableS3fsPasswdFile() const;
bool CheckS3fsPasswdFilePerms(); bool CheckS3fsPasswdFilePerms();
bool ParseS3fsPasswdFile(bucketkvmap_t& resmap); bool ParseS3fsPasswdFile(bucketkvmap_t& resmap);
bool ReadS3fsPasswdFile(AutoLock::Type type); bool ReadS3fsPasswdFile(AutoLock::Type type);

View File

@ -177,7 +177,7 @@ ThreadPoolMan::~ThreadPoolMan()
} }
} }
bool ThreadPoolMan::IsExit() bool ThreadPoolMan::IsExit() const
{ {
AutoLock auto_lock(&thread_exit_flag_lock); AutoLock auto_lock(&thread_exit_flag_lock);
return is_exit; return is_exit;

View File

@ -70,7 +70,7 @@ class ThreadPoolMan
thpoolman_params_t instruction_list; thpoolman_params_t instruction_list;
bool is_exit_flag_init; bool is_exit_flag_init;
pthread_mutex_t thread_exit_flag_lock; mutable pthread_mutex_t thread_exit_flag_lock;
private: private:
static void* Worker(void* arg); static void* Worker(void* arg);
@ -78,7 +78,7 @@ class ThreadPoolMan
explicit ThreadPoolMan(int count = 1); explicit ThreadPoolMan(int count = 1);
~ThreadPoolMan(); ~ThreadPoolMan();
bool IsExit(); bool IsExit() const;
void SetExitFlag(bool exit_flag); void SetExitFlag(bool exit_flag);
bool StopThreads(); bool StopThreads();