Fixed Issue 352 and bugs

1) Option syntax verbosity in doc ( Issue 352 )
    Before this revision(version), "use_rrs" option needs to set a parameter like "use_sse" option.
    But this option does not need a parameter, specified "use_rrs" option means enabled RRS.
    (because RRS is desabled by default.)
    After this revision, "use_rrs" option can be specified without a parameter, and "use_sse" too.
    Changed codes, man page and help page.
    Please notice, for old version "use_rrs"(and "use_sse") can be specified with a parameter("1" or "0") yet.

2) Fixes a bug about analizing "use_sse" option.
    Fixed a bug in r451, "use_sse" option is not worked because s3fs mistook to call function for "use_rrs".

3) Fixes a memory leak.
    Fixed a memory leak in r451.
    Fixed that the curl_slist_sort_insert() function forgot to free memory.



git-svn-id: http://s3fs.googlecode.com/svn/trunk@452 df820570-a93a-0410-bd06-b72b767a4274
This commit is contained in:
ggtakec@gmail.com 2013-07-05 05:41:46 +00:00
parent ad19ffa458
commit d1a17cbe3d
4 changed files with 44 additions and 31 deletions

View File

@ -59,11 +59,15 @@ number of times to retry a failed S3 transaction.
\fB\-o\fR use_cache (default="" which means disabled) \fB\-o\fR use_cache (default="" which means disabled)
local folder to use for local file cache. local folder to use for local file cache.
.TP .TP
\fB\-o\fR use_rrs (default="" which means disabled) \fB\-o\fR use_rrs (default is disable)
use Amazon's Reduced Redundancy Storage. use Amazon's Reduced Redundancy Storage.
this option can not be specified with use_sse.
(can specify use_rrs=1 for old version)
.TP .TP
\fB\-o\fR use_sse (default="" which means disabled) \fB\-o\fR use_sse (default is disable)
use Amazon's Server Site Encryption. use Amazon's Server Site Encryption.
this option can not be specified with use_rrs.
(can specify use_sse=1 for old version)
.TP .TP
\fB\-o\fR passwd_file (default="") \fB\-o\fR passwd_file (default="")
specify the path to the password file, which which takes precedence over the password in $HOME/.passwd-s3fs and /etc/passwd-s3fs specify the path to the password file, which which takes precedence over the password in $HOME/.passwd-s3fs and /etc/passwd-s3fs

View File

@ -2479,6 +2479,7 @@ struct curl_slist* curl_slist_sort_insert(struct curl_slist* list, const char* d
list = new_item; list = new_item;
} }
new_item->next = curpos->next; new_item->next = curpos->next;
free(curpos->data);
free(curpos); free(curpos);
break; break;

View File

@ -3239,37 +3239,45 @@ static int my_fuse_opt_proc(void* data, const char* arg, int key, struct fuse_ar
nomultipart = true; nomultipart = true;
return 0; return 0;
} }
if(strstr(arg, "use_rrs=") != 0){ if(strstr(arg, "use_rrs") != 0){
int rrs = atoi(strchr(arg, '=') + sizeof(char)); int rrs = 1;
if(0 == rrs || 1 == rrs){ // for an old format.
if(1 == rrs && S3fsCurl::GetUseSse()){ if(strstr(arg, "use_rrs=1") != 0){
fprintf(stderr, "%s: use_rrs option could not be specified with use_sse.\n", rrs = atoi(strchr(arg, '=') + sizeof(char));
program_name.c_str()); }
if(0 == rrs){
S3fsCurl::SetUseRrs(false);
}else if(1 == rrs){
if(S3fsCurl::GetUseSse()){
fprintf(stderr, "%s: use_rrs option could not be specified with use_sse.\n", program_name.c_str());
return -1; return -1;
}else{
S3fsCurl::SetUseRrs(0 == rrs ? false : true);
} }
S3fsCurl::SetUseRrs(true);
}else{ }else{
fprintf(stderr, "%s: poorly formed argument to option: use_rrs\n", fprintf(stderr, "%s: poorly formed argument to option: use_rrs\n", program_name.c_str());
program_name.c_str());
return -1; return -1;
} }
return 0;
} }
if(strstr(arg, "use_sse=") != 0){ if(strstr(arg, "use_sse") != 0){
int sse = atoi(strchr(arg, '=') + sizeof(char)); int sse = 1;
if(0 == sse || 1 == sse){ // for an old format.
if(1 == sse && S3fsCurl::GetUseRrs()){ if(strstr(arg, "use_sse=") != 0){
fprintf(stderr, "%s: use_sse option could not be specified with use_rrs.\n", sse = atoi(strchr(arg, '=') + sizeof(char));
program_name.c_str()); }
if(0 == sse){
S3fsCurl::SetUseSse(false);
}else if(1 == sse){
if(S3fsCurl::GetUseRrs()){
fprintf(stderr, "%s: use_sse option could not be specified with use_rrs.\n", program_name.c_str());
return -1; return -1;
}else{
S3fsCurl::SetUseRrs(0 == sse ? false : true);
} }
S3fsCurl::SetUseSse(true);
}else{ }else{
fprintf(stderr, "%s: poorly formed argument to option: use_sse\n", fprintf(stderr, "%s: poorly formed argument to option: use_sse\n", program_name.c_str());
program_name.c_str());
return -1; return -1;
} }
return 0;
} }
if(strstr(arg, "ssl_verify_hostname=") != 0){ if(strstr(arg, "ssl_verify_hostname=") != 0){
long sslvh = strtol(strchr(arg, '=') + sizeof(char), 0, 10); long sslvh = strtol(strchr(arg, '=') + sizeof(char), 0, 10);

View File

@ -709,11 +709,11 @@ void show_help (void)
" use_cache (default=\"\" which means disabled)\n" " use_cache (default=\"\" which means disabled)\n"
" - local folder to use for local file cache\n" " - local folder to use for local file cache\n"
"\n" "\n"
" use_rrs (default=\"\" which means diabled)\n" " use_rrs (default is disable)\n"
" - use Amazon's Reduced Redundancy Storage when set to 1\n" " - this option makes Amazon's Reduced Redundancy Storage enable.\n"
"\n" "\n"
" use_sse (default=\"\" which means diabled)\n" " use_sse (default is disable)\n"
" - use Amazon's Server Site Encryption when set to 1\n" " - this option makes Amazon's Server Site Encryption enable.\n"
"\n" "\n"
" public_bucket (default=\"\" which means disabled)\n" " public_bucket (default=\"\" which means disabled)\n"
" - anonymously mount a public bucket when set to 1\n" " - anonymously mount a public bucket when set to 1\n"
@ -743,7 +743,7 @@ void show_help (void)
" You can specify this option for performance, s3fs memorizes \n" " You can specify this option for performance, s3fs memorizes \n"
" in stat cache that the object(file or directory) does not exist.\n" " in stat cache that the object(file or directory) does not exist.\n"
"\n" "\n"
" nodnscache - disable dns cache\n" " nodnscache (disable dns cache)\n"
" - s3fs is always using dns cache, this option make dns cache disable.\n" " - s3fs is always using dns cache, this option make dns cache disable.\n"
"\n" "\n"
" multireq_max (default=\"500\")\n" " multireq_max (default=\"500\")\n"
@ -752,26 +752,26 @@ void show_help (void)
" url (default=\"http://s3.amazonaws.com\")\n" " url (default=\"http://s3.amazonaws.com\")\n"
" - sets the url to use to access amazon s3\n" " - sets the url to use to access amazon s3\n"
"\n" "\n"
" nomultipart - disable multipart uploads\n" " nomultipart (disable multipart uploads)\n"
"\n" "\n"
" enable_content_md5 (default is disable)\n" " enable_content_md5 (default is disable)\n"
" - verifying uploaded object without multipart by content-md5 header.\n" " - verifying uploaded object without multipart by content-md5 header.\n"
"\n" "\n"
" noxmlns - disable registing xml name space.\n" " noxmlns (disable registing xml name space)\n"
" disable registing xml name space for response of \n" " disable registing xml name space for response of \n"
" ListBucketResult and ListVersionsResult etc. Default name \n" " ListBucketResult and ListVersionsResult etc. Default name \n"
" space is looked up from \"http://s3.amazonaws.com/doc/2006-03-01\".\n" " space is looked up from \"http://s3.amazonaws.com/doc/2006-03-01\".\n"
" This option should not be specified now, because s3fs looks up\n" " This option should not be specified now, because s3fs looks up\n"
" xmlns automatically after v1.66.\n" " xmlns automatically after v1.66.\n"
"\n" "\n"
" nocopyapi - for other incomplete compatibility object storage.\n" " nocopyapi (for other incomplete compatibility object storage)\n"
" For a distributed object storage which is compatibility S3\n" " For a distributed object storage which is compatibility S3\n"
" API without PUT(copy api).\n" " API without PUT(copy api).\n"
" If you set this option, s3fs do not use PUT with \n" " If you set this option, s3fs do not use PUT with \n"
" \"x-amz-copy-source\"(copy api). Because traffic is increased\n" " \"x-amz-copy-source\"(copy api). Because traffic is increased\n"
" 2-3 times by this option, we do not recommend this.\n" " 2-3 times by this option, we do not recommend this.\n"
"\n" "\n"
" norenameapi - for other incomplete compatibility object storage.\n" " norenameapi (for other incomplete compatibility object storage)\n"
" For a distributed object storage which is compatibility S3\n" " For a distributed object storage which is compatibility S3\n"
" API without PUT(copy api).\n" " API without PUT(copy api).\n"
" This option is a subset of nocopyapi option. The nocopyapi\n" " This option is a subset of nocopyapi option. The nocopyapi\n"