summaryrefslogtreecommitdiff
path: root/netfs/fuse
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2020-03-29 11:29:42 +0100
committerDan Goodliffe <dan@randomdan.homeip.net>2020-03-29 11:29:42 +0100
commitc830a78d7bae91619561c4e86b39572837453bbc (patch)
tree3f9c41825752f945dcfc10f7026c27d91b57d9dd /netfs/fuse
parentImplement copy range (diff)
downloadnetfs-c830a78d7bae91619561c4e86b39572837453bbc.tar.bz2
netfs-c830a78d7bae91619561c4e86b39572837453bbc.tar.xz
netfs-c830a78d7bae91619561c4e86b39572837453bbc.zip
Modernize and tidy
Diffstat (limited to 'netfs/fuse')
-rw-r--r--netfs/fuse/fuseApp.h21
-rw-r--r--netfs/fuse/fuseAppBase.h16
2 files changed, 21 insertions, 16 deletions
diff --git a/netfs/fuse/fuseApp.h b/netfs/fuse/fuseApp.h
index eec2932..b38c97c 100644
--- a/netfs/fuse/fuseApp.h
+++ b/netfs/fuse/fuseApp.h
@@ -13,6 +13,7 @@
#include "fuseConfig.h"
#include "cache.h"
#include <visibility.h>
+#include <c++11Helpers.h>
#include <boost/icl/interval_map.hpp>
namespace NetFS {
@@ -25,8 +26,8 @@ namespace NetFS {
DirectoryPrxPtr remote;
const std::string path;
};
- typedef std::shared_ptr<OpenDir> OpenDirPtr;
- typedef std::map<int, OpenDirPtr> OpenDirs;
+ using OpenDirPtr = std::shared_ptr<OpenDir>;
+ using OpenDirs = std::map<int, OpenDirPtr>;
class OpenFile {
public:
@@ -39,17 +40,18 @@ namespace NetFS {
const std::string path;
const int flags;
class WriteState;
- typedef boost::icl::interval_map<Ice::Long, std::shared_ptr<WriteState>> BGs;
+ using BGs = boost::icl::interval_map<Ice::Long, std::shared_ptr<WriteState>>;
static BGs::interval_type range(off_t, size_t);
BGs bg;
mutable std::shared_mutex _lock;
};
- typedef std::shared_ptr<OpenFile> OpenFilePtr;
- typedef std::map<int, OpenFilePtr> OpenFiles;
+ using OpenFilePtr = std::shared_ptr<OpenFile>;
+ using OpenFiles = std::map<int, OpenFilePtr>;
public:
- FuseApp(Ice::StringSeq &&);
- ~FuseApp();
+ explicit FuseApp(Ice::StringSeq &&);
+ SPECIAL_MEMBERS_DELETE(FuseApp);
+ ~FuseApp() override;
// lifecycle
void * init (struct fuse_conn_info * info, struct fuse_config * cfg) override;
@@ -73,6 +75,7 @@ namespace NetFS {
int rename(const char *, const char *, unsigned int) override;
int symlink(const char *, const char *) override;
int unlink(const char *) override;
+ // NOLINTNEXTLINE(hicpp-avoid-c-arrays,modernize-avoid-c-arrays)
int utimens(const char *, const struct timespec tv[2], struct fuse_file_info *) override;
int mknod(const char *, mode_t, dev_t) override;
// dirs
@@ -93,7 +96,7 @@ namespace NetFS {
// fs
int statfs(const char *, struct statvfs *) override;
// stuff
- int onError(const std::exception & err) throw() override;
+ int onError(const std::exception & err) noexcept override;
void beforeOperation() override;
virtual struct fuse_context * fuse_get_context() = 0;
@@ -137,7 +140,7 @@ namespace NetFS {
EntCache<Group> groupLookup;
EntryTypeConverter converter;
- typedef AdHoc::Cache<struct stat, std::string> StatCache;
+ using StatCache = AdHoc::Cache<struct stat, std::string>;
StatCache statCache;
};
}
diff --git a/netfs/fuse/fuseAppBase.h b/netfs/fuse/fuseAppBase.h
index c73a476..2709671 100644
--- a/netfs/fuse/fuseAppBase.h
+++ b/netfs/fuse/fuseAppBase.h
@@ -4,17 +4,18 @@
#include <fuse.h>
#include <typeinfo>
#include <exception>
-#include <stdio.h>
-#include <errno.h>
+#include <cstdio>
+#include <cerrno>
#include <syslog.h>
#include <visibility.h>
-#include <buffer.h>
+#include <c++11Helpers.h>
#include <shared_mutex>
#include <lockHelpers.h>
class DLL_PUBLIC FuseAppBase {
public:
FuseAppBase();
+ SPECIAL_MEMBERS_DELETE(FuseAppBase);
virtual ~FuseAppBase();
virtual void * init (struct fuse_conn_info * info, struct fuse_config * cfg);
@@ -48,6 +49,7 @@ class DLL_PUBLIC FuseAppBase {
virtual int unlink(const char *);
virtual int write(const char *, const char *, size_t, off_t, struct fuse_file_info *);
virtual int lock(const char *, struct fuse_file_info *, int cmd, struct flock *);
+ // NOLINTNEXTLINE(hicpp-avoid-c-arrays,modernize-avoid-c-arrays)
virtual int utimens(const char *, const struct timespec tv[2], struct fuse_file_info *);
virtual int bmap(const char *, size_t blocksize, uint64_t *idx);
virtual int ioctl(const char *, unsigned int cmd, void *arg, struct fuse_file_info *, unsigned int flags, void * data);
@@ -58,11 +60,11 @@ class DLL_PUBLIC FuseAppBase {
virtual int fallocate(const char *, int, off_t, off_t, struct fuse_file_info *);
virtual ssize_t copy_file_range(const char *, struct fuse_file_info *, off_t, const char *, struct fuse_file_info *, off_t, size_t, int);
virtual off_t lseek(const char *, off_t off, int whence, struct fuse_file_info *);
- virtual int onError(const std::exception & err) throw();
+ virtual int onError(const std::exception & err) noexcept;
virtual void beforeOperation();
- void log(int level, const char * message) const throw();
- void logf(int level, const char * fmt, ...) const throw() __attribute__ ((__format__ (__printf__, 3, 4)));
- virtual void vlogf(int level, const char * fmt, va_list) const throw() __attribute__ ((__format__ (__printf__, 3, 0))) = 0;
+ void log(int level, const char * message) const noexcept;
+ void logf(int level, const char * fmt, ...) const noexcept __attribute__ ((__format__ (__printf__, 3, 4)));
+ virtual void vlogf(int level, const char * fmt, va_list) const noexcept __attribute__ ((__format__ (__printf__, 3, 0))) = 0;
mutable std::shared_mutex _lock;
protected: