mirror of
https://github.com/s3fs-fuse/s3fs-fuse.git
synced 2024-11-16 01:07:11 +00:00
Compare commits
No commits in common. "a5cdd05c25ab2dac33dc291846f9ce5ba74f0a1a" and "c97f7a2a1373c9ff1f91bb2257aa67fd03889211" have entirely different histories.
a5cdd05c25
...
c97f7a2a13
@ -418,12 +418,6 @@ Username and passphrase are valid only for HTTP schema.
|
|||||||
If the HTTP proxy does not require authentication, this option is not required.
|
If the HTTP proxy does not require authentication, this option is not required.
|
||||||
Separate the username and passphrase with a ':' character and specify each as a URL-encoded string.
|
Separate the username and passphrase with a ':' character and specify each as a URL-encoded string.
|
||||||
.TP
|
.TP
|
||||||
\fB\-o\fR ipresolve (default="whatever")
|
|
||||||
Select what type of IP addresses to use when establishing a connection.
|
|
||||||
Default('whatever') can use addresses of all IP versions(IPv4 and IPv6) that your system allows.
|
|
||||||
If you specify 'IPv4', only IPv4 addresses are used.
|
|
||||||
And when 'IPv6' is specified, only IPv6 addresses will be used.
|
|
||||||
.TP
|
|
||||||
\fB\-o\fR logfile - specify the log output file.
|
\fB\-o\fR logfile - specify the log output file.
|
||||||
s3fs outputs the log file to syslog. Alternatively, if s3fs is started with the "-f" option specified, the log will be output to the stdout/stderr.
|
s3fs outputs the log file to syslog. Alternatively, if s3fs is started with the "-f" option specified, the log will be output to the stdout/stderr.
|
||||||
You can use this option to specify the log file that s3fs outputs.
|
You can use this option to specify the log file that s3fs outputs.
|
||||||
|
24
src/curl.cpp
24
src/curl.cpp
@ -130,7 +130,6 @@ bool S3fsCurl::requester_pays = false; // default
|
|||||||
std::string S3fsCurl::proxy_url;
|
std::string S3fsCurl::proxy_url;
|
||||||
bool S3fsCurl::proxy_http = false;
|
bool S3fsCurl::proxy_http = false;
|
||||||
std::string S3fsCurl::proxy_userpwd;
|
std::string S3fsCurl::proxy_userpwd;
|
||||||
long S3fsCurl::ipresolve_type = CURL_IPRESOLVE_WHATEVER;
|
|
||||||
|
|
||||||
//-------------------------------------------------------------------
|
//-------------------------------------------------------------------
|
||||||
// Class methods for S3fsCurl
|
// Class methods for S3fsCurl
|
||||||
@ -1175,23 +1174,6 @@ bool S3fsCurl::SetProxyUserPwd(const char* file)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool S3fsCurl::SetIPResolveType(const char* value)
|
|
||||||
{
|
|
||||||
if(!value){
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if(0 == strcasecmp(value, "ipv4")){
|
|
||||||
S3fsCurl::ipresolve_type = CURL_IPRESOLVE_V4;
|
|
||||||
}else if(0 == strcasecmp(value, "ipv6")){
|
|
||||||
S3fsCurl::ipresolve_type = CURL_IPRESOLVE_V6;
|
|
||||||
}else if(0 == strcasecmp(value, "whatever")){ // = default type
|
|
||||||
S3fsCurl::ipresolve_type = CURL_IPRESOLVE_WHATEVER;
|
|
||||||
}else{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// cppcheck-suppress unmatchedSuppression
|
// cppcheck-suppress unmatchedSuppression
|
||||||
// cppcheck-suppress constParameter
|
// cppcheck-suppress constParameter
|
||||||
// cppcheck-suppress constParameterCallback
|
// cppcheck-suppress constParameterCallback
|
||||||
@ -1967,11 +1949,7 @@ bool S3fsCurl::ResetHandle(AutoLock::Type locktype)
|
|||||||
if(CURLE_OK != curl_easy_setopt(hCurl, S3FS_CURLOPT_KEEP_SENDING_ON_ERROR, 1) && !run_once){
|
if(CURLE_OK != curl_easy_setopt(hCurl, S3FS_CURLOPT_KEEP_SENDING_ON_ERROR, 1) && !run_once){
|
||||||
S3FS_PRN_WARN("The S3FS_CURLOPT_KEEP_SENDING_ON_ERROR option could not be set. For maximize performance you need to enable this option and you should use libcurl 7.51.0 or later.");
|
S3FS_PRN_WARN("The S3FS_CURLOPT_KEEP_SENDING_ON_ERROR option could not be set. For maximize performance you need to enable this option and you should use libcurl 7.51.0 or later.");
|
||||||
}
|
}
|
||||||
if(CURL_IPRESOLVE_WHATEVER != S3fsCurl::ipresolve_type){ // CURL_IPRESOLVE_WHATEVER is default, so not need to set.
|
|
||||||
if(CURLE_OK != curl_easy_setopt(hCurl, CURLOPT_IPRESOLVE, S3fsCurl::ipresolve_type)){
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(type != REQTYPE::IAMCRED && type != REQTYPE::IAMROLE){
|
if(type != REQTYPE::IAMCRED && type != REQTYPE::IAMROLE){
|
||||||
// REQTYPE::IAMCRED and REQTYPE::IAMROLE are always HTTP
|
// REQTYPE::IAMCRED and REQTYPE::IAMROLE are always HTTP
|
||||||
if(0 == S3fsCurl::ssl_verify_hostname){
|
if(0 == S3fsCurl::ssl_verify_hostname){
|
||||||
|
@ -156,7 +156,6 @@ class S3fsCurl
|
|||||||
static std::string proxy_url;
|
static std::string proxy_url;
|
||||||
static bool proxy_http;
|
static bool proxy_http;
|
||||||
static std::string proxy_userpwd; // load from file(<username>:<passphrase>)
|
static std::string proxy_userpwd; // load from file(<username>:<passphrase>)
|
||||||
static long ipresolve_type; // this value is a libcurl symbol.
|
|
||||||
|
|
||||||
// variables
|
// variables
|
||||||
CURL* hCurl;
|
CURL* hCurl;
|
||||||
@ -341,7 +340,6 @@ class S3fsCurl
|
|||||||
static bool IsRequesterPays() { return S3fsCurl::requester_pays; }
|
static bool IsRequesterPays() { return S3fsCurl::requester_pays; }
|
||||||
static bool SetProxy(const char* url);
|
static bool SetProxy(const char* url);
|
||||||
static bool SetProxyUserPwd(const char* userpwd);
|
static bool SetProxyUserPwd(const char* userpwd);
|
||||||
static bool SetIPResolveType(const char* value);
|
|
||||||
|
|
||||||
// methods
|
// methods
|
||||||
bool CreateCurlHandle(bool only_pool = false, bool remake = false);
|
bool CreateCurlHandle(bool only_pool = false, bool remake = false);
|
||||||
|
@ -449,13 +449,13 @@ bool PseudoFdInfo::ParallelMultipartUpload(const char* path, const mp_part_list_
|
|||||||
thargs->petag = petag;
|
thargs->petag = petag;
|
||||||
|
|
||||||
// make parameter for thread pool
|
// make parameter for thread pool
|
||||||
thpoolman_param ppoolparam;
|
std::unique_ptr<thpoolman_param> ppoolparam(new thpoolman_param);
|
||||||
ppoolparam.args = thargs;
|
ppoolparam->args = thargs;
|
||||||
ppoolparam.psem = &uploaded_sem;
|
ppoolparam->psem = &uploaded_sem;
|
||||||
ppoolparam.pfunc = PseudoFdInfo::MultipartUploadThreadWorker;
|
ppoolparam->pfunc = PseudoFdInfo::MultipartUploadThreadWorker;
|
||||||
|
|
||||||
// setup instruction
|
// setup instruction
|
||||||
if(!ThreadPoolMan::Instruct(ppoolparam)){
|
if(!ThreadPoolMan::Instruct(std::move(ppoolparam))){
|
||||||
S3FS_PRN_ERR("failed setup instruction for uploading.");
|
S3FS_PRN_ERR("failed setup instruction for uploading.");
|
||||||
delete thargs;
|
delete thargs;
|
||||||
return false;
|
return false;
|
||||||
|
@ -5434,14 +5434,6 @@ static int my_fuse_opt_proc(void* data, const char* arg, int key, struct fuse_ar
|
|||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
else if(is_prefix(arg, "ipresolve=")){
|
|
||||||
const char* pipresolve = &arg[strlen("ipresolve=")];
|
|
||||||
if(!S3fsCurl::SetIPResolveType(pipresolve)){
|
|
||||||
S3FS_PRN_EXIT("failed to ip resolve option value(%s).", pipresolve);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
//
|
//
|
||||||
// log file option
|
// log file option
|
||||||
//
|
//
|
||||||
|
@ -527,14 +527,6 @@ static constexpr char help_string[] =
|
|||||||
" Separate the username and passphrase with a ':' character and\n"
|
" Separate the username and passphrase with a ':' character and\n"
|
||||||
" specify each as a URL-encoded string.\n"
|
" specify each as a URL-encoded string.\n"
|
||||||
"\n"
|
"\n"
|
||||||
" ipresolve (default=\"whatever\")\n"
|
|
||||||
" Select what type of IP addresses to use when establishing a\n"
|
|
||||||
" connection.\n"
|
|
||||||
" Default('whatever') can use addresses of all IP versions(IPv4 and\n"
|
|
||||||
" IPv6) that your system allows. If you specify 'IPv4', only IPv4\n"
|
|
||||||
" addresses are used. And when 'IPv6'is specified, only IPv6 addresses\n"
|
|
||||||
" will be used.\n"
|
|
||||||
"\n"
|
|
||||||
" logfile - specify the log output file.\n"
|
" logfile - specify the log output file.\n"
|
||||||
" s3fs outputs the log file to syslog. Alternatively, if s3fs is\n"
|
" s3fs outputs the log file to syslog. Alternatively, if s3fs is\n"
|
||||||
" started with the \"-f\" option specified, the log will be output\n"
|
" started with the \"-f\" option specified, the log will be output\n"
|
||||||
|
@ -53,14 +53,13 @@ void ThreadPoolMan::Destroy()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ThreadPoolMan::Instruct(const thpoolman_param& param)
|
bool ThreadPoolMan::Instruct(std::unique_ptr<thpoolman_param> pparam)
|
||||||
{
|
{
|
||||||
if(!ThreadPoolMan::singleton){
|
if(!ThreadPoolMan::singleton){
|
||||||
S3FS_PRN_WARN("The singleton object is not initialized yet.");
|
S3FS_PRN_WARN("The singleton object is not initialized yet.");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
ThreadPoolMan::singleton->SetInstruction(param);
|
return ThreadPoolMan::singleton->SetInstruction(std::move(pparam));
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@ -85,25 +84,30 @@ void* ThreadPoolMan::Worker(void* arg)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// get instruction
|
// get instruction
|
||||||
thpoolman_param param;
|
std::unique_ptr<thpoolman_param> pparam;
|
||||||
{
|
{
|
||||||
AutoLock auto_lock(&(psingleton->thread_list_lock));
|
AutoLock auto_lock(&(psingleton->thread_list_lock));
|
||||||
|
|
||||||
if(psingleton->instruction_list.empty()){
|
if(!psingleton->instruction_list.empty()){
|
||||||
S3FS_PRN_DBG("Got a semaphore, but the instruction is empty.");
|
pparam = std::move(psingleton->instruction_list.front());
|
||||||
continue;
|
|
||||||
}else{
|
|
||||||
param = psingleton->instruction_list.front();
|
|
||||||
psingleton->instruction_list.pop_front();
|
psingleton->instruction_list.pop_front();
|
||||||
|
if(!pparam){
|
||||||
|
S3FS_PRN_WARN("Got a semaphore, but the instruction is empty.");
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
S3FS_PRN_WARN("Got a semaphore, but there is no instruction.");
|
||||||
|
pparam = nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void* retval = param.pfunc(param.args);
|
if(pparam){
|
||||||
|
void* retval = pparam->pfunc(pparam->args);
|
||||||
if(nullptr != retval){
|
if(nullptr != retval){
|
||||||
S3FS_PRN_WARN("The instruction function returned with somthign error code(%ld).", reinterpret_cast<long>(retval));
|
S3FS_PRN_WARN("The instruction function returned with somthign error code(%ld).", reinterpret_cast<long>(retval));
|
||||||
}
|
}
|
||||||
if(param.psem){
|
if(pparam->psem){
|
||||||
param.psem->post();
|
pparam->psem->post();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -231,16 +235,23 @@ bool ThreadPoolMan::StartThreads(int count)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ThreadPoolMan::SetInstruction(const thpoolman_param& param)
|
bool ThreadPoolMan::SetInstruction(std::unique_ptr<thpoolman_param> pparam)
|
||||||
{
|
{
|
||||||
|
if(!pparam){
|
||||||
|
S3FS_PRN_ERR("The parameter value is nullptr.");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// set parameter to list
|
// set parameter to list
|
||||||
{
|
{
|
||||||
AutoLock auto_lock(&thread_list_lock);
|
AutoLock auto_lock(&thread_list_lock);
|
||||||
instruction_list.push_back(param);
|
instruction_list.push_back(std::move(pparam));
|
||||||
}
|
}
|
||||||
|
|
||||||
// run thread
|
// run thread
|
||||||
thpoolman_sem.post();
|
thpoolman_sem.post();
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -23,6 +23,7 @@
|
|||||||
|
|
||||||
#include <atomic>
|
#include <atomic>
|
||||||
#include <list>
|
#include <list>
|
||||||
|
#include <memory>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "psemaphore.h"
|
#include "psemaphore.h"
|
||||||
@ -52,7 +53,7 @@ struct thpoolman_param
|
|||||||
thpoolman_param() : args(nullptr), psem(nullptr), pfunc(nullptr) {}
|
thpoolman_param() : args(nullptr), psem(nullptr), pfunc(nullptr) {}
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef std::list<thpoolman_param> thpoolman_params_t;
|
typedef std::list<std::unique_ptr<thpoolman_param>> thpoolman_params_t;
|
||||||
|
|
||||||
typedef std::vector<pthread_t> thread_list_t;
|
typedef std::vector<pthread_t> thread_list_t;
|
||||||
|
|
||||||
@ -88,12 +89,12 @@ class ThreadPoolMan
|
|||||||
|
|
||||||
bool StopThreads();
|
bool StopThreads();
|
||||||
bool StartThreads(int count);
|
bool StartThreads(int count);
|
||||||
void SetInstruction(const thpoolman_param& pparam);
|
bool SetInstruction(std::unique_ptr<thpoolman_param> pparam);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static bool Initialize(int count);
|
static bool Initialize(int count);
|
||||||
static void Destroy();
|
static void Destroy();
|
||||||
static bool Instruct(const thpoolman_param& pparam);
|
static bool Instruct(std::unique_ptr<thpoolman_param> pparam);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // S3FS_THREADPOOLMAN_H_
|
#endif // S3FS_THREADPOOLMAN_H_
|
||||||
|
Loading…
Reference in New Issue
Block a user