diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2022-04-16 11:13:30 +0100 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2022-04-16 11:13:30 +0100 |
commit | 1c44ecaf91ae10863665d77eb153538e3bc8abc6 (patch) | |
tree | dfd65af6631a81e9853f4508983facee3ee049cd | |
parent | Turn off specific format-nonliteral warnings (diff) | |
download | netfs-1c44ecaf91ae10863665d77eb153538e3bc8abc6.tar.bz2 netfs-1c44ecaf91ae10863665d77eb153538e3bc8abc6.tar.xz netfs-1c44ecaf91ae10863665d77eb153538e3bc8abc6.zip |
constexpr the operations map
-rw-r--r-- | netfs/fuse/fuseApp.cpp | 3 | ||||
-rw-r--r-- | netfs/fuse/fuseAppBase.h | 93 |
2 files changed, 47 insertions, 49 deletions
diff --git a/netfs/fuse/fuseApp.cpp b/netfs/fuse/fuseApp.cpp index cfd9689..f9b6884 100644 --- a/netfs/fuse/fuseApp.cpp +++ b/netfs/fuse/fuseApp.cpp @@ -20,6 +20,9 @@ namespace AdHoc { template class CallCacheable<struct stat, std::string>; } +static_assert(NetFS::FuseApp::operations.access); +static_assert(!NetFS::FuseApp::operations.destroy); + NetFS::FuseApp::FuseApp(Ice::StringSeq && a) : iceArgs(std::move(a)) { } NetFS::FuseApp::~FuseApp() diff --git a/netfs/fuse/fuseAppBase.h b/netfs/fuse/fuseAppBase.h index ab47476..e4c1c62 100644 --- a/netfs/fuse/fuseAppBase.h +++ b/netfs/fuse/fuseAppBase.h @@ -82,58 +82,53 @@ public: getInternalHelper<decltype(&FuseAppBase::func), decltype(&FuseApp::func), &FuseAppBase::func>(&FuseAppBase::func) #define GetHelper(func) \ getHelper<decltype(&FuseAppBase::func), decltype(&FuseApp::func), &FuseAppBase::func>(&FuseAppBase::func) - FuseAppBaseT() : - operations({ - GetHelper(getattr), - GetHelper(readlink), - GetHelper(mknod), - GetHelper(mkdir), - GetHelper(unlink), - GetHelper(rmdir), - GetHelper(symlink), - GetHelper(rename), - GetHelper(link), - GetHelper(chmod), - GetHelper(chown), - GetHelper(truncate), - GetHelper(open), - GetHelper(read), - GetHelper(write), - GetHelper(statfs), - GetHelper(flush), - GetHelper(release), - GetHelper(fsync), - GetHelper(setxattr), - GetHelper(getxattr), - GetHelper(listxattr), - GetHelper(removexattr), - GetHelper(opendir), - GetHelper(readdir), - GetHelper(releasedir), - GetHelper(fsyncdir), - GetIntHelper(init), - nullptr, // fuseDestroy - GetHelper(access), - GetHelper(create), - GetHelper(lock), - GetHelper(utimens), - GetHelper(bmap), - GetHelper(ioctl), - GetHelper(poll), - GetHelper(write_buf), - GetHelper(read_buf), - GetHelper(flock), - GetHelper(fallocate), - GetHelper(copy_file_range), - GetHelper(lseek), - }) - { - } + constexpr static fuse_operations operations { + GetHelper(getattr), + GetHelper(readlink), + GetHelper(mknod), + GetHelper(mkdir), + GetHelper(unlink), + GetHelper(rmdir), + GetHelper(symlink), + GetHelper(rename), + GetHelper(link), + GetHelper(chmod), + GetHelper(chown), + GetHelper(truncate), + GetHelper(open), + GetHelper(read), + GetHelper(write), + GetHelper(statfs), + GetHelper(flush), + GetHelper(release), + GetHelper(fsync), + GetHelper(setxattr), + GetHelper(getxattr), + GetHelper(listxattr), + GetHelper(removexattr), + GetHelper(opendir), + GetHelper(readdir), + GetHelper(releasedir), + GetHelper(fsyncdir), + GetIntHelper(init), + nullptr, // fuseDestroy + GetHelper(access), + GetHelper(create), + GetHelper(lock), + GetHelper(utimens), + GetHelper(bmap), + GetHelper(ioctl), + GetHelper(poll), + GetHelper(write_buf), + GetHelper(read_buf), + GetHelper(flock), + GetHelper(fallocate), + GetHelper(copy_file_range), + GetHelper(lseek), + }; #undef GetHelper #undef GetIntHelper - const struct fuse_operations operations; - private: template<typename BFunc, typename IFunc, BFunc bfunc, typename Rtn, typename... Args> constexpr static auto |