aboutsummaryrefslogtreecommitdiff
path: root/test/test_write_cache.c
diff options
context:
space:
mode:
Diffstat (limited to 'test/test_write_cache.c')
-rw-r--r--test/test_write_cache.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/test/test_write_cache.c b/test/test_write_cache.c
index d2f7004..137cb8d 100644
--- a/test/test_write_cache.c
+++ b/test/test_write_cache.c
@@ -39,11 +39,20 @@ struct options {
static const struct fuse_opt option_spec[] = {
OPTION("writeback_cache", writeback),
OPTION("--data-size=%d", data_size),
- FUSE_OPT_KEY("writeback_cache", FUSE_OPT_KEY_KEEP),
FUSE_OPT_END
};
static int got_write;
+static void tfs_init (void *userdata, struct fuse_conn_info *conn)
+{
+ (void) userdata;
+
+ if(options.writeback) {
+ assert(conn->capable & FUSE_CAP_WRITEBACK_CACHE);
+ conn->want |= FUSE_CAP_WRITEBACK_CACHE;
+ }
+}
+
static int tfs_stat(fuse_ino_t ino, struct stat *stbuf) {
stbuf->st_ino = ino;
if (ino == FUSE_ROOT_ID) {
@@ -126,6 +135,7 @@ static void tfs_write(fuse_req_t req, fuse_ino_t ino, const char *buf,
}
static struct fuse_lowlevel_ops tfs_oper = {
+ .init = tfs_init,
.lookup = tfs_lookup,
.getattr = tfs_getattr,
.open = tfs_open,