7
struct fs *(*init)(const char *args, const struct fs_settings *set);
7
struct fs *(*alloc)(void);
8
int (*init)(struct fs *fs, const char *args,
9
const struct fs_settings *set);
8
10
void (*deinit)(struct fs *fs);
10
int (*open)(struct fs *fs, const char *path, enum fs_open_mode mode,
11
enum fs_open_flags flags, struct fs_file **file_r);
12
void (*close)(struct fs_file *file);
12
enum fs_properties (*get_properties)(struct fs *fs);
14
struct fs_file *(*file_init)(struct fs *fs, const char *path,
15
enum fs_open_mode mode,
16
enum fs_open_flags flags);
17
void (*file_deinit)(struct fs_file *file);
18
void (*file_close)(struct fs_file *file);
19
const char *(*get_path)(struct fs_file *file);
21
void (*set_async_callback)(struct fs_file *file,
22
fs_file_async_callback_t *callback,
24
int (*wait_async)(struct fs *fs);
26
void (*set_metadata)(struct fs_file *file, const char *key,
28
int (*get_metadata)(struct fs_file *file,
29
const ARRAY_TYPE(fs_metadata) **metadata_r);
31
bool (*prefetch)(struct fs_file *file, uoff_t length);
14
32
ssize_t (*read)(struct fs_file *file, void *buf, size_t size);
15
33
struct istream *(*read_stream)(struct fs_file *file,
16
34
size_t max_buffer_size);
22
40
int (*lock)(struct fs_file *file, unsigned int secs,
23
41
struct fs_lock **lock_r);
24
42
void (*unlock)(struct fs_lock *lock);
25
int (*fdatasync)(struct fs_file *file);
27
int (*exists)(struct fs *fs, const char *path);
28
int (*stat)(struct fs *fs, const char *path, struct stat *st_r);
29
int (*link)(struct fs *fs, const char *src, const char *dest);
30
int (*rename)(struct fs *fs, const char *src, const char *dest);
31
int (*unlink)(struct fs *fs, const char *path);
32
int (*rmdir)(struct fs *fs, const char *path);
44
int (*exists)(struct fs_file *file);
45
int (*stat)(struct fs_file *file, struct stat *st_r);
46
int (*copy)(struct fs_file *src, struct fs_file *dest);
47
int (*rename)(struct fs_file *src, struct fs_file *dest);
48
int (*delete_file)(struct fs_file *file);
50
struct fs_iter *(*iter_init)(struct fs *fs, const char *path,
51
enum fs_iter_flags flags);
52
const char *(*iter_next)(struct fs_iter *iter);
53
int (*iter_deinit)(struct fs_iter *iter);
57
struct fs *parent; /* for wrapper filesystems */
37
59
struct fs_vfuncs v;
60
char *temp_path_prefix;
39
62
struct fs_settings set;
40
63
string_t *last_error;
47
70
struct ostream *output;
72
enum fs_open_flags flags;
74
struct istream *seekable_input;
75
struct istream *pending_read_input;
78
const struct hash_method *write_digest_method;
82
ARRAY_TYPE(fs_metadata) metadata;
84
struct fs_file *copy_src;
85
struct istream *copy_input;
86
struct ostream *copy_output;
52
90
struct fs_file *file;
55
extern struct fs fs_class_posix;
56
extern struct fs fs_class_sis;
57
extern struct fs fs_class_sis_queue;
95
enum fs_iter_flags flags;
98
fs_file_async_callback_t *async_callback;
102
extern const struct fs fs_class_posix;
103
extern const struct fs fs_class_metawrap;
104
extern const struct fs fs_class_sis;
105
extern const struct fs fs_class_sis_queue;
59
107
void fs_set_error(struct fs *fs, const char *fmt, ...) ATTR_FORMAT(2, 3);
60
108
void fs_set_critical(struct fs *fs, const char *fmt, ...) ATTR_FORMAT(2, 3);
110
void fs_set_error_async(struct fs *fs);
112
ssize_t fs_read_via_stream(struct fs_file *file, void *buf, size_t size);
113
int fs_write_via_stream(struct fs_file *file, const void *data, size_t size);
114
void fs_metadata_init(struct fs_file *file);
115
void fs_default_set_metadata(struct fs_file *file,
116
const char *key, const char *value);
117
int fs_default_copy(struct fs_file *src, struct fs_file *dest);