mirror of
https://github.com/s3fs-fuse/s3fs-fuse.git
synced 2024-11-19 02:35:13 +00:00
Merge pull request #449 from treestem/mountopt
Accept mount options compatible with mtab
This commit is contained in:
commit
87f617374a
42
src/s3fs.cpp
42
src/s3fs.cpp
@ -4195,18 +4195,11 @@ static int set_moutpoint_attribute(struct stat& mpst)
|
||||
return false;
|
||||
}
|
||||
|
||||
// This is repeatedly called by the fuse option parser
|
||||
// if the key is equal to FUSE_OPT_KEY_OPT, it's an option passed in prefixed by
|
||||
// '-' or '--' e.g.: -f -d -ousecache=/tmp
|
||||
//
|
||||
// if the key is equal to FUSE_OPT_KEY_NONOPT, it's either the bucket name
|
||||
// or the mountpoint. The bucket name will always come before the mountpoint
|
||||
static int my_fuse_opt_proc(void* data, const char* arg, int key, struct fuse_args* outargs)
|
||||
// Set bucket and mount_prefix based on passed bucket name.
|
||||
//
|
||||
static int set_bucket(const char* arg)
|
||||
{
|
||||
if(key == FUSE_OPT_KEY_NONOPT){
|
||||
// the first NONOPT option is the bucket name
|
||||
if(bucket.size() == 0){
|
||||
// extract remote mount path
|
||||
char *bucket_name = (char*)arg;
|
||||
if(strstr(arg, ":")){
|
||||
bucket = strtok(bucket_name, ":");
|
||||
@ -4228,6 +4221,28 @@ static int my_fuse_opt_proc(void* data, const char* arg, int key, struct fuse_ar
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
// This is repeatedly called by the fuse option parser
|
||||
// if the key is equal to FUSE_OPT_KEY_OPT, it's an option passed in prefixed by
|
||||
// '-' or '--' e.g.: -f -d -ousecache=/tmp
|
||||
//
|
||||
// if the key is equal to FUSE_OPT_KEY_NONOPT, it's either the bucket name
|
||||
// or the mountpoint. The bucket name will always come before the mountpoint
|
||||
static int my_fuse_opt_proc(void* data, const char* arg, int key, struct fuse_args* outargs)
|
||||
{
|
||||
int ret;
|
||||
if(key == FUSE_OPT_KEY_NONOPT){
|
||||
// the first NONOPT option is the bucket name
|
||||
if(bucket.size() == 0){
|
||||
if ((ret = set_bucket(arg))){
|
||||
return ret;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
else if (!strcmp(arg, "s3fs")) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
// the second NONPOT option is the mountpoint(not utility mode)
|
||||
if(0 == mountpoint.size() && 0 == utility_mode){
|
||||
// save the mountpoint and do some basic error checking
|
||||
@ -4520,6 +4535,13 @@ static int my_fuse_opt_proc(void* data, const char* arg, int key, struct fuse_ar
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
if(0 == STR2NCMP(arg, "bucket=")){
|
||||
std::string bname = strchr(arg, '=') + sizeof(char);
|
||||
if ((ret = set_bucket(bname.c_str()))){
|
||||
return ret;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
if(0 == STR2NCMP(arg, "host=")){
|
||||
host = strchr(arg, '=') + sizeof(char);
|
||||
return 0;
|
||||
|
Loading…
Reference in New Issue
Block a user