Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions cloudfsapi.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ static int curl_pool_count = 0;
static int debug = 0;
static int verify_ssl = 1;
static int rhel5_mode = 0;
static char gprefix[1024] = "";

struct json_payload {
char *data;
Expand Down Expand Up @@ -419,8 +420,8 @@ int cloudfs_list_directory(const char *path, dir_entry **dir_list)
prefix_length++;
}

snprintf(container, sizeof(container), "%s?format=xml&delimiter=/&prefix=%s%s",
encoded_container, encoded_object, trailing_slash);
snprintf(container, sizeof(container), "%s?format=xml&delimiter=/&prefix=%s%s%s",
encoded_container, encoded_object, trailing_slash,gprefix);
curl_free(encoded_container);
curl_free(encoded_object);
}
Expand Down Expand Up @@ -448,6 +449,7 @@ int cloudfs_list_directory(const char *path, dir_entry **dir_list)
de->last_modified = time(NULL);
if (is_container || is_subdir)
de->content_type = strdup("application/directory");
else de->content_type = NULL;
for (anode = onode->children; anode; anode = anode->next)
{
char *content = "<?!?>";
Expand Down Expand Up @@ -565,6 +567,11 @@ void cloudfs_debug(int dbg)
debug = dbg;
}

void cloudfs_set_prefix(char *p)
{
memcpy(&gprefix,p,1024);
}

void cloudfs_verify_ssl(int vrfy)
{
verify_ssl = vrfy;
Expand Down
1 change: 1 addition & 0 deletions cloudfsapi.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ off_t cloudfs_file_size(int fd);
void cloudfs_debug(int dbg);
void cloudfs_verify_ssl(int dbg);
void cloudfs_free_dir_list(dir_entry *dir_list);
void cloudfs_set_prefix(char *p);

void debugf(char *fmt, ...);
#endif
Expand Down
8 changes: 7 additions & 1 deletion cloudfuse.c
Original file line number Diff line number Diff line change
Expand Up @@ -434,6 +434,7 @@ static struct options {
char region[OPTION_SIZE];
char use_snet[OPTION_SIZE];
char verify_ssl[OPTION_SIZE];
char prefix[OPTION_SIZE];
} options = {
.username = "",
.password = "",
Expand All @@ -443,6 +444,7 @@ static struct options {
.region = "",
.use_snet = "false",
.verify_ssl = "true",
.prefix = ""
};

int parse_option(void *data, const char *arg, int key, struct fuse_args *outargs)
Expand All @@ -456,7 +458,8 @@ int parse_option(void *data, const char *arg, int key, struct fuse_args *outargs
sscanf(arg, " authurl = %[^\r\n ]", options.authurl) ||
sscanf(arg, " region = %[^\r\n ]", options.region) ||
sscanf(arg, " use_snet = %[^\r\n ]", options.use_snet) ||
sscanf(arg, " verify_ssl = %[^\r\n ]", options.verify_ssl))
sscanf(arg, " verify_ssl = %[^\r\n ]", options.verify_ssl) ||
sscanf(arg, " prefix = %[^\r\n ]", options.prefix))
return 0;
if (!strcmp(arg, "-f") || !strcmp(arg, "-d") || !strcmp(arg, "debug"))
cloudfs_debug(1);
Expand Down Expand Up @@ -496,6 +499,7 @@ int main(int argc, char **argv)
fprintf(stderr, " use_snet=[True to use Rackspace ServiceNet for connections]\n");
fprintf(stderr, " cache_timeout=[Seconds for directory caching, default 600]\n");
fprintf(stderr, " verify_ssl=[False to disable SSL cert verification]\n");
fprintf(stderr, " prefix=[show files starting with prefix]\n");

return 1;
}
Expand All @@ -504,6 +508,8 @@ int main(int argc, char **argv)

cloudfs_verify_ssl(!strcasecmp(options.verify_ssl, "true"));

cloudfs_set_prefix(options.prefix);

cloudfs_set_credentials(options.username, options.tenant, options.password,
options.authurl, options.region,
!strcasecmp(options.use_snet, "true"));
Expand Down