mirror of
https://github.com/s3fs-fuse/s3fs-fuse.git
synced 2025-02-02 10:38:25 +00:00
Merge pull request #1414 from gaul/clang-tidy/misc
Fix clang-tidy warnings
This commit is contained in:
commit
864941d4d5
@ -53,14 +53,14 @@ class AdditionalHeader
|
||||
|
||||
public:
|
||||
// Reference singleton
|
||||
static AdditionalHeader* get(void) { return &singleton; }
|
||||
static AdditionalHeader* get() { return &singleton; }
|
||||
|
||||
bool Load(const char* file);
|
||||
void Unload(void);
|
||||
void Unload();
|
||||
|
||||
bool AddHeader(headers_t& meta, const char* path) const;
|
||||
struct curl_slist* AddHeader(struct curl_slist* list, const char* path) const;
|
||||
bool Dump(void) const;
|
||||
bool Dump() const;
|
||||
};
|
||||
|
||||
#endif // S3FS_ADDHEAD_H_
|
||||
|
@ -47,7 +47,7 @@ class BodyData
|
||||
Clear();
|
||||
}
|
||||
|
||||
void Clear(void);
|
||||
void Clear();
|
||||
bool Append(void* ptr, size_t bytes);
|
||||
bool Append(void* ptr, size_t blockSize, size_t numBlocks)
|
||||
{
|
||||
|
20
src/cache.h
20
src/cache.h
@ -95,36 +95,36 @@ class StatCache
|
||||
StatCache();
|
||||
~StatCache();
|
||||
|
||||
void Clear(void);
|
||||
void Clear();
|
||||
bool GetStat(const std::string& key, struct stat* pst, headers_t* meta, bool overcheck, const char* petag, bool* pisforce);
|
||||
// Truncate stat cache
|
||||
bool TruncateCache(void);
|
||||
bool TruncateCache();
|
||||
// Truncate symbolic link cache
|
||||
bool TruncateSymlink(void);
|
||||
bool TruncateSymlink();
|
||||
|
||||
public:
|
||||
// Reference singleton
|
||||
static StatCache* getStatCacheData(void)
|
||||
static StatCache* getStatCacheData()
|
||||
{
|
||||
return &singleton;
|
||||
}
|
||||
|
||||
// Attribute
|
||||
unsigned long GetCacheSize(void) const;
|
||||
unsigned long GetCacheSize() const;
|
||||
unsigned long SetCacheSize(unsigned long size);
|
||||
time_t GetExpireTime(void) const;
|
||||
time_t GetExpireTime() const;
|
||||
time_t SetExpireTime(time_t expire, bool is_interval = false);
|
||||
time_t UnsetExpireTime(void);
|
||||
time_t UnsetExpireTime();
|
||||
bool SetCacheNoObject(bool flag);
|
||||
bool EnableCacheNoObject(void)
|
||||
bool EnableCacheNoObject()
|
||||
{
|
||||
return SetCacheNoObject(true);
|
||||
}
|
||||
bool DisableCacheNoObject(void)
|
||||
bool DisableCacheNoObject()
|
||||
{
|
||||
return SetCacheNoObject(false);
|
||||
}
|
||||
bool GetCacheNoObject(void) const
|
||||
bool GetCacheNoObject() const
|
||||
{
|
||||
return IsCacheNoObject;
|
||||
}
|
||||
|
116
src/curl.h
116
src/curl.h
@ -203,17 +203,17 @@ class S3fsCurl
|
||||
|
||||
private:
|
||||
// class methods
|
||||
static bool InitGlobalCurl(void);
|
||||
static bool DestroyGlobalCurl(void);
|
||||
static bool InitShareCurl(void);
|
||||
static bool DestroyShareCurl(void);
|
||||
static bool InitGlobalCurl();
|
||||
static bool DestroyGlobalCurl();
|
||||
static bool InitShareCurl();
|
||||
static bool DestroyShareCurl();
|
||||
static void LockCurlShare(CURL* handle, curl_lock_data nLockData, curl_lock_access laccess, void* useptr);
|
||||
static void UnlockCurlShare(CURL* handle, curl_lock_data nLockData, void* useptr);
|
||||
static bool InitCryptMutex(void);
|
||||
static bool DestroyCryptMutex(void);
|
||||
static bool InitCryptMutex();
|
||||
static bool DestroyCryptMutex();
|
||||
static int CurlProgress(void *clientp, double dltotal, double dlnow, double ultotal, double ulnow);
|
||||
|
||||
static bool LocateBundle(void);
|
||||
static bool LocateBundle();
|
||||
static size_t HeaderCallback(void *data, size_t blockSize, size_t numBlocks, void *userPtr);
|
||||
static size_t WriteMemoryCallback(void *ptr, size_t blockSize, size_t numBlocks, void *data);
|
||||
static size_t ReadCallback(void *ptr, size_t size, size_t nmemb, void *userp);
|
||||
@ -238,8 +238,8 @@ class S3fsCurl
|
||||
static bool SetIAMCredentials(const char* response);
|
||||
static bool ParseIAMRoleFromMetaDataResponse(const char* response, std::string& rolename);
|
||||
static bool SetIAMRoleFromMetaData(const char* response);
|
||||
static bool LoadEnvSseCKeys(void);
|
||||
static bool LoadEnvSseKmsid(void);
|
||||
static bool LoadEnvSseCKeys();
|
||||
static bool LoadEnvSseKmsid();
|
||||
static bool PushbackSseKeys(std::string& onekey);
|
||||
static bool AddUserAgent(CURL* hCurl);
|
||||
|
||||
@ -250,15 +250,15 @@ class S3fsCurl
|
||||
|
||||
// methods
|
||||
bool ResetHandle(bool lock_already_held = false);
|
||||
bool RemakeHandle(void);
|
||||
bool ClearInternalData(void);
|
||||
bool RemakeHandle();
|
||||
bool ClearInternalData();
|
||||
void insertV4Headers();
|
||||
void insertV2Headers();
|
||||
void insertIBMIAMHeaders();
|
||||
void insertAuthHeaders();
|
||||
std::string CalcSignatureV2(const std::string& method, const std::string& strMD5, const std::string& content_type, const std::string& date, const std::string& resource);
|
||||
std::string CalcSignature(const std::string& method, const std::string& canonical_uri, const std::string& query_string, const std::string& strdate, const std::string& payload_hash, const std::string& date8601);
|
||||
int GetIAMCredentials(void);
|
||||
int GetIAMCredentials();
|
||||
|
||||
int UploadMultipartPostSetup(const char* tpath, int part_num, const std::string& upload_id);
|
||||
int CopyMultipartPostSetup(const char* from, const char* to, int part_num, const std::string& upload_id, headers_t& meta);
|
||||
@ -268,13 +268,13 @@ class S3fsCurl
|
||||
|
||||
public:
|
||||
// class methods
|
||||
static bool InitS3fsCurl(void);
|
||||
static bool InitS3fsCurl();
|
||||
static bool InitMimeType(const std::string& strFile);
|
||||
static bool DestroyS3fsCurl(void);
|
||||
static bool DestroyS3fsCurl();
|
||||
static int ParallelMultipartUploadRequest(const char* tpath, headers_t& meta, int fd);
|
||||
static int ParallelMixMultipartUploadRequest(const char* tpath, headers_t& meta, int fd, const fdpage_list_t& mixuppages);
|
||||
static int ParallelGetObjectRequest(const char* tpath, int fd, off_t start, off_t size);
|
||||
static bool CheckIAMCredentialUpdate(void);
|
||||
static bool CheckIAMCredentialUpdate();
|
||||
|
||||
// class methods(variables)
|
||||
static std::string LookupMimeType(const std::string& name);
|
||||
@ -283,52 +283,52 @@ class S3fsCurl
|
||||
static bool SetSslSessionCache(bool isCache);
|
||||
static long SetConnectTimeout(long timeout);
|
||||
static time_t SetReadwriteTimeout(time_t timeout);
|
||||
static time_t GetReadwriteTimeout(void) { return S3fsCurl::readwrite_timeout; }
|
||||
static time_t GetReadwriteTimeout() { return S3fsCurl::readwrite_timeout; }
|
||||
static int SetRetries(int count);
|
||||
static bool SetPublicBucket(bool flag);
|
||||
static bool IsPublicBucket(void) { return S3fsCurl::is_public_bucket; }
|
||||
static bool IsPublicBucket() { return S3fsCurl::is_public_bucket; }
|
||||
static acl_t SetDefaultAcl(acl_t acl);
|
||||
static acl_t GetDefaultAcl();
|
||||
static storage_class_t SetStorageClass(storage_class_t storage_class);
|
||||
static storage_class_t GetStorageClass() { return S3fsCurl::storage_class; }
|
||||
static bool LoadEnvSse(void) { return (S3fsCurl::LoadEnvSseCKeys() && S3fsCurl::LoadEnvSseKmsid()); }
|
||||
static bool LoadEnvSse() { return (S3fsCurl::LoadEnvSseCKeys() && S3fsCurl::LoadEnvSseKmsid()); }
|
||||
static sse_type_t SetSseType(sse_type_t type);
|
||||
static sse_type_t GetSseType(void) { return S3fsCurl::ssetype; }
|
||||
static bool IsSseDisable(void) { return (sse_type_t::SSE_DISABLE == S3fsCurl::ssetype); }
|
||||
static bool IsSseS3Type(void) { return (sse_type_t::SSE_S3 == S3fsCurl::ssetype); }
|
||||
static bool IsSseCType(void) { return (sse_type_t::SSE_C == S3fsCurl::ssetype); }
|
||||
static bool IsSseKmsType(void) { return (sse_type_t::SSE_KMS == S3fsCurl::ssetype); }
|
||||
static bool FinalCheckSse(void);
|
||||
static sse_type_t GetSseType() { return S3fsCurl::ssetype; }
|
||||
static bool IsSseDisable() { return (sse_type_t::SSE_DISABLE == S3fsCurl::ssetype); }
|
||||
static bool IsSseS3Type() { return (sse_type_t::SSE_S3 == S3fsCurl::ssetype); }
|
||||
static bool IsSseCType() { return (sse_type_t::SSE_C == S3fsCurl::ssetype); }
|
||||
static bool IsSseKmsType() { return (sse_type_t::SSE_KMS == S3fsCurl::ssetype); }
|
||||
static bool FinalCheckSse();
|
||||
static bool SetSseCKeys(const char* filepath);
|
||||
static bool SetSseKmsid(const char* kmsid);
|
||||
static bool IsSetSseKmsId(void) { return !S3fsCurl::ssekmsid.empty(); }
|
||||
static const char* GetSseKmsId(void) { return S3fsCurl::ssekmsid.c_str(); }
|
||||
static bool IsSetSseKmsId() { return !S3fsCurl::ssekmsid.empty(); }
|
||||
static const char* GetSseKmsId() { return S3fsCurl::ssekmsid.c_str(); }
|
||||
static bool GetSseKey(std::string& md5, std::string& ssekey);
|
||||
static bool GetSseKeyMd5(int pos, std::string& md5);
|
||||
static int GetSseKeyCount(void);
|
||||
static int GetSseKeyCount();
|
||||
static bool SetContentMd5(bool flag);
|
||||
static bool SetVerbose(bool flag);
|
||||
static bool GetVerbose(void) { return S3fsCurl::is_verbose; }
|
||||
static bool GetVerbose() { return S3fsCurl::is_verbose; }
|
||||
static bool SetDumpBody(bool flag);
|
||||
static bool IsDumpBody(void) { return S3fsCurl::is_dump_body; }
|
||||
static bool IsDumpBody() { return S3fsCurl::is_dump_body; }
|
||||
static bool SetAccessKey(const char* AccessKeyId, const char* SecretAccessKey);
|
||||
static bool SetAccessKeyWithSessionToken(const char* AccessKeyId, const char* SecretAccessKey, const char * SessionToken);
|
||||
static bool IsSetAccessKeyID(void)
|
||||
static bool IsSetAccessKeyID()
|
||||
{
|
||||
return (0 < S3fsCurl::AWSAccessKeyId.size());
|
||||
}
|
||||
static bool IsSetAccessKeys(void)
|
||||
static bool IsSetAccessKeys()
|
||||
{
|
||||
return (0 < S3fsCurl::IAM_role.size() || ((0 < S3fsCurl::AWSAccessKeyId.size() || S3fsCurl::is_ibm_iam_auth) && 0 < S3fsCurl::AWSSecretAccessKey.size()));
|
||||
}
|
||||
static long SetSslVerifyHostname(long value);
|
||||
static long GetSslVerifyHostname(void) { return S3fsCurl::ssl_verify_hostname; }
|
||||
static long GetSslVerifyHostname() { return S3fsCurl::ssl_verify_hostname; }
|
||||
// maximum parallel GET and PUT requests
|
||||
static int SetMaxParallelCount(int value);
|
||||
static int GetMaxParallelCount(void) { return S3fsCurl::max_parallel_cnt; }
|
||||
static int GetMaxParallelCount() { return S3fsCurl::max_parallel_cnt; }
|
||||
// maximum parallel HEAD requests
|
||||
static int SetMaxMultiRequest(int max);
|
||||
static int GetMaxMultiRequest(void) { return S3fsCurl::max_multireq; }
|
||||
static int GetMaxMultiRequest() { return S3fsCurl::max_multireq; }
|
||||
static bool SetIsECS(bool flag);
|
||||
static bool SetIsIBMIAMAuth(bool flag);
|
||||
static size_t SetIAMFieldCount(size_t field_count);
|
||||
@ -336,22 +336,22 @@ class S3fsCurl
|
||||
static std::string SetIAMTokenField(const char* token_field);
|
||||
static std::string SetIAMExpiryField(const char* expiry_field);
|
||||
static std::string SetIAMRole(const char* role);
|
||||
static const char* GetIAMRole(void) { return S3fsCurl::IAM_role.c_str(); }
|
||||
static const char* GetIAMRole() { return S3fsCurl::IAM_role.c_str(); }
|
||||
static bool SetMultipartSize(off_t size);
|
||||
static off_t GetMultipartSize(void) { return S3fsCurl::multipart_size; }
|
||||
static off_t GetMultipartSize() { return S3fsCurl::multipart_size; }
|
||||
static bool SetSignatureV4(bool isset) { bool bresult = S3fsCurl::is_sigv4; S3fsCurl::is_sigv4 = isset; return bresult; }
|
||||
static bool IsSignatureV4(void) { return S3fsCurl::is_sigv4; }
|
||||
static bool IsSignatureV4() { return S3fsCurl::is_sigv4; }
|
||||
static bool SetUserAgentFlag(bool isset) { bool bresult = S3fsCurl::is_ua; S3fsCurl::is_ua = isset; return bresult; }
|
||||
static bool IsUserAgentFlag(void) { return S3fsCurl::is_ua; }
|
||||
static void InitUserAgent(void);
|
||||
static bool IsUserAgentFlag() { return S3fsCurl::is_ua; }
|
||||
static void InitUserAgent();
|
||||
static bool SetRequesterPays(bool flag) { bool old_flag = S3fsCurl::requester_pays; S3fsCurl::requester_pays = flag; return old_flag; }
|
||||
static bool IsRequesterPays(void) { return S3fsCurl::requester_pays; }
|
||||
static bool IsRequesterPays() { return S3fsCurl::requester_pays; }
|
||||
|
||||
// methods
|
||||
bool CreateCurlHandle(bool only_pool = false, bool remake = false);
|
||||
bool DestroyCurlHandle(bool restore_pool = true, bool clear_internal_data = true);
|
||||
|
||||
bool LoadIAMRoleFromMetaData(void);
|
||||
bool LoadIAMRoleFromMetaData();
|
||||
bool AddSseRequestHead(sse_type_t ssetype, std::string& ssevalue, bool is_only_c, bool is_copy);
|
||||
bool GetResponseCode(long& responseCode, bool from_curl_handle = true);
|
||||
int RequestPerform(bool dontAddAuthHeaders=false);
|
||||
@ -365,7 +365,7 @@ class S3fsCurl
|
||||
int PutRequest(const char* tpath, headers_t& meta, int fd);
|
||||
int PreGetObjectRequest(const char* tpath, int fd, off_t start, off_t size, sse_type_t ssetype, std::string& ssevalue);
|
||||
int GetObjectRequest(const char* tpath, int fd, off_t start = -1, off_t size = -1);
|
||||
int CheckBucket(void);
|
||||
int CheckBucket();
|
||||
int ListBucketRequest(const char* tpath, const char* query);
|
||||
int PreMultipartPostRequest(const char* tpath, headers_t& meta, std::string& upload_id, bool is_copy);
|
||||
int CompleteMultipartPostRequest(const char* tpath, const std::string& upload_id, etaglist_t& parts);
|
||||
@ -378,24 +378,24 @@ class S3fsCurl
|
||||
int MultipartRenameRequest(const char* from, const char* to, headers_t& meta, off_t size);
|
||||
|
||||
// methods(variables)
|
||||
CURL* GetCurlHandle(void) const { return hCurl; }
|
||||
std::string GetPath(void) const { return path; }
|
||||
std::string GetBasePath(void) const { return base_path; }
|
||||
std::string GetSpacialSavedPath(void) const { return saved_path; }
|
||||
std::string GetUrl(void) const { return url; }
|
||||
std::string GetOp(void) const { return op; }
|
||||
headers_t* GetResponseHeaders(void) { return &responseHeaders; }
|
||||
BodyData* GetBodyData(void) { return &bodydata; }
|
||||
BodyData* GetHeadData(void) { return &headdata; }
|
||||
long GetLastResponseCode(void) const { return LastResponseCode; }
|
||||
CURL* GetCurlHandle() const { return hCurl; }
|
||||
std::string GetPath() const { return path; }
|
||||
std::string GetBasePath() const { return base_path; }
|
||||
std::string GetSpacialSavedPath() const { return saved_path; }
|
||||
std::string GetUrl() const { return url; }
|
||||
std::string GetOp() const { return op; }
|
||||
headers_t* GetResponseHeaders() { return &responseHeaders; }
|
||||
BodyData* GetBodyData() { return &bodydata; }
|
||||
BodyData* GetHeadData() { return &headdata; }
|
||||
long GetLastResponseCode() const { return LastResponseCode; }
|
||||
bool SetUseAhbe(bool ahbe);
|
||||
bool EnableUseAhbe(void) { return SetUseAhbe(true); }
|
||||
bool DisableUseAhbe(void) { return SetUseAhbe(false); }
|
||||
bool IsUseAhbe(void) const { return is_use_ahbe; }
|
||||
int GetMultipartRetryCount(void) const { return retry_count; }
|
||||
bool EnableUseAhbe() { return SetUseAhbe(true); }
|
||||
bool DisableUseAhbe() { return SetUseAhbe(false); }
|
||||
bool IsUseAhbe() const { return is_use_ahbe; }
|
||||
int GetMultipartRetryCount() const { return retry_count; }
|
||||
void SetMultipartRetryCount(int retrycnt) { retry_count = retrycnt; }
|
||||
bool IsOverMultipartRetryCount(void) const { return (retry_count >= S3fsCurl::retries); }
|
||||
int GetLastPreHeadSeecKeyPos(void) const { return b_ssekey_pos; }
|
||||
bool IsOverMultipartRetryCount() const { return (retry_count >= S3fsCurl::retries); }
|
||||
int GetLastPreHeadSeecKeyPos() const { return b_ssekey_pos; }
|
||||
};
|
||||
|
||||
#endif // S3FS_CURL_H_
|
||||
|
@ -49,8 +49,8 @@ class S3fsMultiCurl
|
||||
|
||||
private:
|
||||
bool ClearEx(bool is_all);
|
||||
int MultiPerform(void);
|
||||
int MultiRead(void);
|
||||
int MultiPerform();
|
||||
int MultiRead();
|
||||
|
||||
static void* RequestPerformWrapper(void* arg);
|
||||
|
||||
@ -62,9 +62,9 @@ class S3fsMultiCurl
|
||||
|
||||
S3fsMultiSuccessCallback SetSuccessCallback(S3fsMultiSuccessCallback function);
|
||||
S3fsMultiRetryCallback SetRetryCallback(S3fsMultiRetryCallback function);
|
||||
bool Clear(void) { return ClearEx(true); }
|
||||
bool Clear() { return ClearEx(true); }
|
||||
bool SetS3fsCurlObject(S3fsCurl* s3fscurl);
|
||||
int Request(void);
|
||||
int Request();
|
||||
};
|
||||
|
||||
#endif // S3FS_CURL_MULTI_H_
|
||||
|
@ -40,7 +40,7 @@ bool get_object_sse_type(const char* path, sse_type_t& ssetype, std::string& sse
|
||||
|
||||
bool make_md5_from_binary(const char* pstr, size_t length, std::string& md5);
|
||||
std::string url_to_host(const std::string &url);
|
||||
std::string get_bucket_host(void);
|
||||
std::string get_bucket_host();
|
||||
const char* getCurlDebugHead(curl_infotype type);
|
||||
|
||||
bool etag_equals(std::string s1, std::string s2);
|
||||
|
@ -306,7 +306,7 @@ bool FdManager::IsSafeDiskSpace(const char* path, off_t size)
|
||||
return size + FdManager::GetEnsureFreeDiskSpace() <= fsize;
|
||||
}
|
||||
|
||||
bool FdManager::HaveLseekHole(void)
|
||||
bool FdManager::HaveLseekHole()
|
||||
{
|
||||
if(FdManager::checked_lseek){
|
||||
return FdManager::have_lseek_hole;
|
||||
|
@ -53,27 +53,27 @@ class FdManager
|
||||
~FdManager();
|
||||
|
||||
// Reference singleton
|
||||
static FdManager* get(void) { return &singleton; }
|
||||
static FdManager* get() { return &singleton; }
|
||||
|
||||
static bool DeleteCacheDirectory(void);
|
||||
static bool DeleteCacheDirectory();
|
||||
static int DeleteCacheFile(const char* path);
|
||||
static bool SetCacheDir(const char* dir);
|
||||
static bool IsCacheDir(void) { return !FdManager::cache_dir.empty(); }
|
||||
static const char* GetCacheDir(void) { return FdManager::cache_dir.c_str(); }
|
||||
static bool IsCacheDir() { return !FdManager::cache_dir.empty(); }
|
||||
static const char* GetCacheDir() { return FdManager::cache_dir.c_str(); }
|
||||
static bool SetCacheCheckOutput(const char* path);
|
||||
static const char* GetCacheCheckOutput(void) { return FdManager::check_cache_output.c_str(); }
|
||||
static const char* GetCacheCheckOutput() { return FdManager::check_cache_output.c_str(); }
|
||||
static bool MakeCachePath(const char* path, std::string& cache_path, bool is_create_dir = true, bool is_mirror_path = false);
|
||||
static bool CheckCacheTopDir(void);
|
||||
static bool CheckCacheTopDir();
|
||||
static bool MakeRandomTempPath(const char* path, std::string& tmppath);
|
||||
static bool SetCheckCacheDirExist(bool is_check);
|
||||
static bool CheckCacheDirExist(void);
|
||||
static bool CheckCacheDirExist();
|
||||
|
||||
static off_t GetEnsureFreeDiskSpace();
|
||||
static off_t SetEnsureFreeDiskSpace(off_t size);
|
||||
static bool IsSafeDiskSpace(const char* path, off_t size);
|
||||
static void FreeReservedDiskSpace(off_t size);
|
||||
static bool ReserveDiskSpace(off_t size);
|
||||
static bool HaveLseekHole(void);
|
||||
static bool HaveLseekHole();
|
||||
|
||||
// Return FdEntity associated with path, returning NULL on error. This operation increments the reference count; callers must decrement via Close after use.
|
||||
FdEntity* GetFdEntity(const char* path, int existfd = -1, bool increase_ref = true);
|
||||
@ -84,7 +84,7 @@ class FdManager
|
||||
bool ChangeEntityToTempPath(FdEntity* ent, const char* path);
|
||||
void CleanupCacheDir();
|
||||
|
||||
bool CheckAllCache(void);
|
||||
bool CheckAllCache();
|
||||
};
|
||||
|
||||
#endif // S3FS_FDCACHE_H_
|
||||
|
@ -44,8 +44,8 @@ class AutoFdEntity
|
||||
AutoFdEntity();
|
||||
~AutoFdEntity();
|
||||
|
||||
bool Close(void);
|
||||
bool Detach(void);
|
||||
bool Close();
|
||||
bool Detach();
|
||||
FdEntity* GetFdEntity(const char* path, int existfd = -1, bool increase_ref = true);
|
||||
FdEntity* Open(const char* path, headers_t* pmeta = NULL, off_t size = -1, time_t time = -1, bool force_tmpfile = false, bool is_create = true, bool no_fd_lock_wait = false);
|
||||
FdEntity* ExistOpen(const char* path, int existfd = -1, bool ignore_existfd = false);
|
||||
|
@ -622,7 +622,7 @@ bool FdEntity::RenamePath(const std::string& newpath, std::string& fentmapkey)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool FdEntity::IsModified(void) const
|
||||
bool FdEntity::IsModified() const
|
||||
{
|
||||
AutoLock auto_data_lock(const_cast<pthread_mutex_t *>(&fdent_data_lock));
|
||||
return pagelist.IsModified();
|
||||
|
@ -56,37 +56,37 @@ class FdEntity
|
||||
static int FillFile(int fd, unsigned char byte, off_t size, off_t start);
|
||||
static ino_t GetInode(int fd);
|
||||
|
||||
void Clear(void);
|
||||
ino_t GetInode(void);
|
||||
int OpenMirrorFile(void);
|
||||
void Clear();
|
||||
ino_t GetInode();
|
||||
int OpenMirrorFile();
|
||||
bool SetAllStatus(bool is_loaded); // [NOTE] not locking
|
||||
bool SetAllStatusUnloaded(void) { return SetAllStatus(false); }
|
||||
int UploadPendingMeta(void);
|
||||
bool SetAllStatusUnloaded() { return SetAllStatus(false); }
|
||||
int UploadPendingMeta();
|
||||
|
||||
public:
|
||||
static bool SetNoMixMultipart(void);
|
||||
static bool SetNoMixMultipart();
|
||||
|
||||
explicit FdEntity(const char* tpath = NULL, const char* cpath = NULL);
|
||||
~FdEntity();
|
||||
|
||||
void Close(void);
|
||||
bool IsOpen(void) const { return (-1 != fd); }
|
||||
void Close();
|
||||
bool IsOpen() const { return (-1 != fd); }
|
||||
int Open(headers_t* pmeta = NULL, off_t size = -1, time_t time = -1, bool no_fd_lock_wait = false);
|
||||
bool OpenAndLoadAll(headers_t* pmeta = NULL, off_t* size = NULL, bool force_load = false);
|
||||
int Dup(bool lock_already_held = false);
|
||||
int GetRefCnt(void) const { return refcnt; } // [NOTE] Use only debugging
|
||||
int GetRefCnt() const { return refcnt; } // [NOTE] Use only debugging
|
||||
|
||||
const char* GetPath(void) const { return path.c_str(); }
|
||||
const char* GetPath() const { return path.c_str(); }
|
||||
bool RenamePath(const std::string& newpath, std::string& fentmapkey);
|
||||
int GetFd(void) const { return fd; }
|
||||
bool IsModified(void) const;
|
||||
int GetFd() const { return fd; }
|
||||
bool IsModified() const;
|
||||
bool MergeOrgMeta(headers_t& updatemeta);
|
||||
|
||||
bool GetStats(struct stat& st, bool lock_already_held = false);
|
||||
int SetCtime(time_t time, bool lock_already_held = false);
|
||||
int SetMtime(time_t time, bool lock_already_held = false);
|
||||
bool UpdateCtime(void);
|
||||
bool UpdateMtime(void);
|
||||
bool UpdateCtime();
|
||||
bool UpdateMtime();
|
||||
bool GetSize(off_t& size);
|
||||
bool GetXattr(std::string& xattr);
|
||||
bool SetXattr(const std::string& xattr);
|
||||
@ -97,9 +97,9 @@ class FdEntity
|
||||
|
||||
int Load(off_t start = 0, off_t size = 0, bool lock_already_held = false, bool is_modified_flag = false); // size=0 means loading to end
|
||||
int NoCacheLoadAndPost(off_t start = 0, off_t size = 0); // size=0 means loading to end
|
||||
int NoCachePreMultipartPost(void);
|
||||
int NoCachePreMultipartPost();
|
||||
int NoCacheMultipartPost(int tgfd, off_t start, off_t size);
|
||||
int NoCacheCompleteMultipartPost(void);
|
||||
int NoCacheCompleteMultipartPost();
|
||||
|
||||
int RowFlush(const char* tpath, bool force_sync = false);
|
||||
int Flush(bool force_sync = false) { return RowFlush(NULL, force_sync); }
|
||||
|
@ -51,11 +51,11 @@ struct fdpage
|
||||
fdpage(off_t start = 0, off_t size = 0, bool is_loaded = false, bool is_modified = false) :
|
||||
offset(start), bytes(size), loaded(is_loaded), modified(is_modified) {}
|
||||
|
||||
off_t next(void) const
|
||||
off_t next() const
|
||||
{
|
||||
return (offset + bytes);
|
||||
}
|
||||
off_t end(void) const
|
||||
off_t end() const
|
||||
{
|
||||
return (0 < bytes ? offset + bytes - 1 : 0);
|
||||
}
|
||||
@ -88,7 +88,7 @@ class PageList
|
||||
static bool CheckZeroAreaInFile(int fd, off_t start, size_t bytes);
|
||||
static bool CheckAreaInSparseFile(const struct fdpage& checkpage, const fdpage_list_t& sparse_list, int fd, fdpage_list_t& err_area_list, fdpage_list_t& warn_area_list);
|
||||
|
||||
void Clear(void);
|
||||
void Clear();
|
||||
bool Compress();
|
||||
bool Parse(off_t new_pos);
|
||||
|
||||
@ -100,7 +100,7 @@ class PageList
|
||||
~PageList();
|
||||
|
||||
bool Init(off_t size, bool is_loaded, bool is_modified);
|
||||
off_t Size(void) const;
|
||||
off_t Size() const;
|
||||
bool Resize(off_t size, bool is_loaded, bool is_modified);
|
||||
|
||||
bool IsPageLoaded(off_t start = 0, off_t size = 0) const; // size=0 is checking to end of list
|
||||
@ -110,11 +110,11 @@ class PageList
|
||||
int GetUnloadedPages(fdpage_list_t& unloaded_list, off_t start = 0, off_t size = 0) const; // size=0 is checking to end of list
|
||||
bool GetPageListsForMultipartUpload(fdpage_list_t& dlpages, fdpage_list_t& mixuppages, off_t max_partsize);
|
||||
|
||||
bool IsModified(void) const;
|
||||
bool ClearAllModified(void);
|
||||
bool IsModified() const;
|
||||
bool ClearAllModified();
|
||||
|
||||
bool Serialize(CacheFileStat& file, bool is_output, ino_t inode);
|
||||
void Dump(void) const;
|
||||
void Dump() const;
|
||||
bool CompareSparseFile(int fd, size_t file_size, fdpage_list_t& err_area_list, fdpage_list_t& warn_area_list);
|
||||
};
|
||||
|
||||
|
@ -36,7 +36,7 @@
|
||||
//------------------------------------------------
|
||||
std::string CacheFileStat::GetCacheFileStatTopDir()
|
||||
{
|
||||
std::string top_path("");
|
||||
std::string top_path;
|
||||
if(!FdManager::IsCacheDir() || bucket.empty()){
|
||||
return top_path;
|
||||
}
|
||||
|
@ -36,20 +36,20 @@ class CacheFileStat
|
||||
bool RawOpen(bool readonly);
|
||||
|
||||
public:
|
||||
static std::string GetCacheFileStatTopDir(void);
|
||||
static std::string GetCacheFileStatTopDir();
|
||||
static bool DeleteCacheFileStat(const char* path);
|
||||
static bool CheckCacheFileStatTopDir(void);
|
||||
static bool DeleteCacheFileStatDirectory(void);
|
||||
static bool CheckCacheFileStatTopDir();
|
||||
static bool DeleteCacheFileStatDirectory();
|
||||
static bool RenameCacheFileStat(const char* oldpath, const char* newpath);
|
||||
|
||||
explicit CacheFileStat(const char* tpath = NULL);
|
||||
~CacheFileStat();
|
||||
|
||||
bool Open(void);
|
||||
bool ReadOnlyOpen(void);
|
||||
bool Release(void);
|
||||
bool Open();
|
||||
bool ReadOnlyOpen();
|
||||
bool Release();
|
||||
bool SetPath(const char* tpath, bool is_open = true);
|
||||
int GetFd(void) const { return fd; }
|
||||
int GetFd() const { return fd; }
|
||||
};
|
||||
|
||||
#endif // S3FS_FDCACHE_STAT_H_
|
||||
|
@ -36,17 +36,17 @@ std::string s3fs_sha256_hex_fd(int fd, off_t start, off_t size);
|
||||
//
|
||||
// in xxxxxx_auth.cpp
|
||||
//
|
||||
const char* s3fs_crypt_lib_name(void);
|
||||
bool s3fs_init_global_ssl(void);
|
||||
bool s3fs_destroy_global_ssl(void);
|
||||
bool s3fs_init_crypt_mutex(void);
|
||||
bool s3fs_destroy_crypt_mutex(void);
|
||||
const char* s3fs_crypt_lib_name();
|
||||
bool s3fs_init_global_ssl();
|
||||
bool s3fs_destroy_global_ssl();
|
||||
bool s3fs_init_crypt_mutex();
|
||||
bool s3fs_destroy_crypt_mutex();
|
||||
bool s3fs_HMAC(const void* key, size_t keylen, const unsigned char* data, size_t datalen, unsigned char** digest, unsigned int* digestlen);
|
||||
bool s3fs_HMAC256(const void* key, size_t keylen, const unsigned char* data, size_t datalen, unsigned char** digest, unsigned int* digestlen);
|
||||
size_t get_md5_digest_length(void);
|
||||
size_t get_md5_digest_length();
|
||||
unsigned char* s3fs_md5_fd(int fd, off_t start, off_t size);
|
||||
bool s3fs_sha256(const unsigned char* data, unsigned int datalen, unsigned char** digest, unsigned int* digestlen);
|
||||
size_t get_sha256_digest_length(void);
|
||||
size_t get_sha256_digest_length();
|
||||
unsigned char* s3fs_sha256_fd(int fd, off_t start, off_t size);
|
||||
|
||||
#endif // S3FS_AUTH_H_
|
||||
|
@ -24,9 +24,9 @@
|
||||
//-------------------------------------------------------------------
|
||||
// Functions
|
||||
//-------------------------------------------------------------------
|
||||
void show_usage(void);
|
||||
void show_help(void);
|
||||
void show_version(void);
|
||||
void show_usage();
|
||||
void show_help();
|
||||
void show_version();
|
||||
|
||||
#endif // S3FS_S3FS_HELP_H_
|
||||
|
||||
|
@ -48,14 +48,14 @@ class S3ObjList
|
||||
bool insert_normalized(const char* name, const char* normalized, bool is_dir);
|
||||
const s3obj_entry* GetS3Obj(const char* name) const;
|
||||
|
||||
s3obj_t::const_iterator begin(void) const { return objects.begin(); }
|
||||
s3obj_t::const_iterator end(void) const { return objects.end(); }
|
||||
s3obj_t::const_iterator begin() const { return objects.begin(); }
|
||||
s3obj_t::const_iterator end() const { return objects.end(); }
|
||||
|
||||
public:
|
||||
S3ObjList() {}
|
||||
~S3ObjList() {}
|
||||
|
||||
bool IsEmpty(void) const { return objects.empty(); }
|
||||
bool IsEmpty() const { return objects.empty(); }
|
||||
bool insert(const char* name, const char* etag = NULL, bool is_dir = false);
|
||||
std::string GetOrgName(const char* name) const;
|
||||
std::string GetNormalizedName(const char* name) const;
|
||||
|
@ -47,9 +47,8 @@ bool S3fsSignals::Initialize()
|
||||
|
||||
bool S3fsSignals::Destroy()
|
||||
{
|
||||
if(S3fsSignals::pSingleton){
|
||||
delete S3fsSignals::pSingleton;
|
||||
}
|
||||
delete S3fsSignals::pSingleton;
|
||||
S3fsSignals::pSingleton = NULL;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -36,29 +36,29 @@ class S3fsSignals
|
||||
Semaphore* pSemUsr1;
|
||||
|
||||
protected:
|
||||
static S3fsSignals* get(void) { return pSingleton; }
|
||||
static S3fsSignals* get() { return pSingleton; }
|
||||
|
||||
static void HandlerUSR1(int sig);
|
||||
static void* CheckCacheWorker(void* arg);
|
||||
|
||||
static void HandlerUSR2(int sig);
|
||||
static bool InitUsr2Handler(void);
|
||||
static bool InitUsr2Handler();
|
||||
|
||||
S3fsSignals();
|
||||
~S3fsSignals();
|
||||
|
||||
bool InitUsr1Handler(void);
|
||||
bool DestroyUsr1Handler(void);
|
||||
bool WakeupUsr1Thread(void);
|
||||
bool InitUsr1Handler();
|
||||
bool DestroyUsr1Handler();
|
||||
bool WakeupUsr1Thread();
|
||||
|
||||
public:
|
||||
static bool Initialize(void);
|
||||
static bool Destroy(void);
|
||||
static bool Initialize();
|
||||
static bool Destroy();
|
||||
|
||||
static bool SetUsr1Handler(const char* path);
|
||||
|
||||
static s3fs_log_level SetLogLevel(s3fs_log_level level);
|
||||
static s3fs_log_level BumpupLogLevel(void);
|
||||
static s3fs_log_level BumpupLogLevel();
|
||||
};
|
||||
|
||||
#endif // S3FS_SIGHANDLERS_H_
|
||||
|
@ -72,7 +72,7 @@ std::string lower(std::string s);
|
||||
//
|
||||
// Date string
|
||||
//
|
||||
std::string get_date_rfc850(void);
|
||||
std::string get_date_rfc850();
|
||||
void get_date_sigv3(std::string& date, std::string& date8601);
|
||||
std::string get_date_string(time_t tm);
|
||||
std::string get_date_iso8601(time_t tm);
|
||||
|
@ -258,7 +258,7 @@ struct filepart
|
||||
clear();
|
||||
}
|
||||
|
||||
void clear(void)
|
||||
void clear()
|
||||
{
|
||||
uploaded = false;
|
||||
etag = "";
|
||||
|
Loading…
x
Reference in New Issue
Block a user