-
Notifications
You must be signed in to change notification settings - Fork 55
/
cloudfsapi.h
92 lines (80 loc) · 2.46 KB
/
cloudfsapi.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
#ifndef _CLOUDFSAPI_H
#define _CLOUDFSAPI_H
#include <curl/curl.h>
#include <curl/easy.h>
#define FUSE_USE_VERSION 30
#include <fuse.h>
#include <time.h>
#define BUFFER_INITIAL_SIZE 4096
#define MAX_HEADER_SIZE 8192
#define MAX_URL_SIZE (MAX_PATH_SIZE * 3)
#define USER_AGENT "CloudFuse"
#define OPTION_SIZE 1024
typedef struct curl_slist curl_slist;
#define MINIMAL_PROGRESS_FUNCTIONALITY_INTERVAL 5
struct curl_progress
{
double lastruntime;
CURL* curl;
};
typedef struct options
{
char cache_timeout[OPTION_SIZE];
char verify_ssl[OPTION_SIZE];
char segment_size[OPTION_SIZE];
char segment_above[OPTION_SIZE];
char storage_url[OPTION_SIZE];
char container[OPTION_SIZE];
char temp_dir[OPTION_SIZE];
char client_id[OPTION_SIZE];
char client_secret[OPTION_SIZE];
char refresh_token[OPTION_SIZE];
} FuseOptions;
typedef struct extra_options
{
char settings_filename[MAX_PATH_SIZE];
char get_extended_metadata[OPTION_SIZE];
char curl_verbose[OPTION_SIZE];
char cache_statfs_timeout[OPTION_SIZE];
char debug_level[OPTION_SIZE];
char curl_progress_state[OPTION_SIZE];
char enable_chmod[OPTION_SIZE];
char enable_chown[OPTION_SIZE];
char help[OPTION_SIZE];
} ExtraFuseOptions;
void cloudfs_init(void);
void cloudfs_free(void);
void cloudfs_set_credentials(char* client_id, char* client_secret,
char* refresh_token);
int cloudfs_connect(void);
struct segment_info
{
FILE* fp;
int part;
long size;
long segment_size;
char* seg_base;
const char* method;
};
extern long segment_size;
extern long segment_above;
extern char* override_storage_url;
extern char* public_container;
int file_is_readable(const char* fname);
const char* get_file_mimetype ( const char* filename );
int cloudfs_object_read_fp(const char* path, FILE* fp);
int cloudfs_object_write_fp(const char* path, FILE* fp);
int cloudfs_list_directory(const char* path, dir_entry**);
int cloudfs_delete_object(const char* path);
int cloudfs_copy_object(const char* src, const char* dst);
int cloudfs_create_symlink(const char* src, const char* dst);
int cloudfs_create_directory(const char* label);
int cloudfs_object_truncate(const char* path, off_t size);
off_t cloudfs_file_size(int fd);
int cloudfs_statfs(const char* path, struct statvfs* stat);
void cloudfs_verify_ssl(int dbg);
void cloudfs_option_get_extended_metadata(int option);
void cloudfs_option_curl_verbose(int option);
void get_file_metadata(dir_entry* de);
int cloudfs_update_meta(dir_entry* de);
#endif