From 4a69e4a845865272473020da2004d69be6228c55 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Wed, 25 Oct 2017 17:44:42 +0100 Subject: Adds a (currently NOOP) flush implementation --- netfs/fuse/fuseApp.h | 1 + netfs/fuse/fuseConfig.ice | 3 +++ netfs/fuse/fuseFiles.cpp | 12 ++++++++++++ netfs/unittests/defaultFuse.xml | 1 + netfs/unittests/testEdgeCases.cpp | 1 + 5 files changed, 18 insertions(+) diff --git a/netfs/fuse/fuseApp.h b/netfs/fuse/fuseApp.h index 0d2dd1d..a15d150 100644 --- a/netfs/fuse/fuseApp.h +++ b/netfs/fuse/fuseApp.h @@ -76,6 +76,7 @@ namespace NetFS { // files int open(const char * p, struct fuse_file_info * fi) override; int create(const char *, mode_t, struct fuse_file_info *) override; + int flush(const char *, struct fuse_file_info * fi) override; int release(const char *, struct fuse_file_info * fi) override; int read(const char *, char * buf, size_t s, off_t o, struct fuse_file_info * fi) override; int write(const char *, const char * buf, size_t s, off_t o, struct fuse_file_info * fi) override; diff --git a/netfs/fuse/fuseConfig.ice b/netfs/fuse/fuseConfig.ice index 3e17017..1e6aed3 100644 --- a/netfs/fuse/fuseConfig.ice +++ b/netfs/fuse/fuseConfig.ice @@ -17,6 +17,9 @@ module NetFS { ["slicer:name:authtoken"] string AuthToken; + + ["slicer:name:async"] + bool Async; }; ["slicer:key:name","slicer:value:resource","slicer:item:resource"] diff --git a/netfs/fuse/fuseFiles.cpp b/netfs/fuse/fuseFiles.cpp index fcc58a9..5268f4a 100644 --- a/netfs/fuse/fuseFiles.cpp +++ b/netfs/fuse/fuseFiles.cpp @@ -76,6 +76,18 @@ NetFS::FuseApp::release(const char *, struct fuse_file_info * fi) } } +int +NetFS::FuseApp::flush(const char *, struct fuse_file_info * fi) +{ + try { + (void)fi; + return 0; + } + catch (NetFS::SystemError & e) { + return -e.syserrno; + } +} + int NetFS::FuseApp::read(const char *, char * buf, size_t s, off_t o, struct fuse_file_info * fi) { diff --git a/netfs/unittests/defaultFuse.xml b/netfs/unittests/defaultFuse.xml index 37f55a3..0e95066 100644 --- a/netfs/unittests/defaultFuse.xml +++ b/netfs/unittests/defaultFuse.xml @@ -5,6 +5,7 @@ testvol testvol + true overridden diff --git a/netfs/unittests/testEdgeCases.cpp b/netfs/unittests/testEdgeCases.cpp index 31cdf03..aeaa725 100644 --- a/netfs/unittests/testEdgeCases.cpp +++ b/netfs/unittests/testEdgeCases.cpp @@ -41,6 +41,7 @@ BOOST_AUTO_TEST_CASE ( createAndDaemonRestart ) BOOST_REQUIRE_EQUAL(0, fuse.fuse->fgetattr(fileName, &st, &fh)); BOOST_REQUIRE_EQUAL(st.st_size, sizeof(someData)); + BOOST_REQUIRE_EQUAL(0, fuse.fuse->flush(fileName, &fh)); BOOST_TEST_CHECKPOINT("Restart daemon object"); daemon.restart(); -- cgit v1.2.3