From 6f14be9f75537afa398fd82b47ea70d8dd6f4475 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Sat, 16 Apr 2016 01:22:05 +0100 Subject: Split VFS type converters into simpler base class --- netfs/daemon/daemonDirectory.cpp | 4 ++-- netfs/daemon/daemonDirectory.h | 4 ++-- netfs/daemon/daemonFile.cpp | 4 ++-- netfs/daemon/daemonFile.h | 4 ++-- netfs/daemon/daemonVolume.cpp | 2 +- netfs/daemon/daemonVolume.h | 2 +- netfs/fuse/fuseApp.h | 2 +- netfs/fuse/fuseSystem.cpp | 2 +- netfs/ice/typeConverter.cpp | 6 +++--- netfs/ice/typeConverter.h | 13 ++++++++----- 10 files changed, 23 insertions(+), 20 deletions(-) diff --git a/netfs/daemon/daemonDirectory.cpp b/netfs/daemon/daemonDirectory.cpp index 399fb86..6943982 100644 --- a/netfs/daemon/daemonDirectory.cpp +++ b/netfs/daemon/daemonDirectory.cpp @@ -7,8 +7,8 @@ #include #include "daemonDirectory.h" -DirectoryServer::DirectoryServer(DIR * d, TypeConverter & t) : - TypeConverter(t), +DirectoryServer::DirectoryServer(DIR * d, EntryTypeConverter & t) : + EntryTypeConverter(t), od(d) { } diff --git a/netfs/daemon/daemonDirectory.h b/netfs/daemon/daemonDirectory.h index 28c04a9..5e549fe 100644 --- a/netfs/daemon/daemonDirectory.h +++ b/netfs/daemon/daemonDirectory.h @@ -5,9 +5,9 @@ #include #include -class DirectoryServer : public NetFS::DirectoryV2, TypeConverter { +class DirectoryServer : public NetFS::DirectoryV2, EntryTypeConverter { public: - DirectoryServer(DIR * od, TypeConverter &); + DirectoryServer(DIR * od, EntryTypeConverter &); virtual ~DirectoryServer(); virtual void close(const Ice::Current&) override; diff --git a/netfs/daemon/daemonFile.cpp b/netfs/daemon/daemonFile.cpp index e8201c0..a4c903d 100644 --- a/netfs/daemon/daemonFile.cpp +++ b/netfs/daemon/daemonFile.cpp @@ -7,8 +7,8 @@ #include "daemonFile.h" #include -FileServer::FileServer(int f, TypeConverter & t) : - TypeConverter(t), +FileServer::FileServer(int f, EntryTypeConverter & t) : + EntryTypeConverter(t), fd(f) { } diff --git a/netfs/daemon/daemonFile.h b/netfs/daemon/daemonFile.h index 1853732..5bf20f3 100644 --- a/netfs/daemon/daemonFile.h +++ b/netfs/daemon/daemonFile.h @@ -4,9 +4,9 @@ #include #include -class FileServer : public NetFS::File, TypeConverter { +class FileServer : public NetFS::File, EntryTypeConverter { public: - FileServer(int fd, TypeConverter &); + FileServer(int fd, EntryTypeConverter &); virtual ~FileServer(); virtual void close(const Ice::Current&) override; diff --git a/netfs/daemon/daemonVolume.cpp b/netfs/daemon/daemonVolume.cpp index f5e87d8..0a3472c 100644 --- a/netfs/daemon/daemonVolume.cpp +++ b/netfs/daemon/daemonVolume.cpp @@ -200,7 +200,7 @@ VolumeServer::statfs(const NetFS::ReqEnv & re, const std::string & path, const I if (::statvfs(p.c_str(), &s) != 0) { throw NetFS::SystemError(errno); } - return converter.convert(s); + return converter.TypeConverter::convert(s); } void diff --git a/netfs/daemon/daemonVolume.h b/netfs/daemon/daemonVolume.h index b5e8b05..af0e36d 100644 --- a/netfs/daemon/daemonVolume.h +++ b/netfs/daemon/daemonVolume.h @@ -48,7 +48,7 @@ class VolumeServer : public NetFS::Volume { const EntCache & userLookup; const EntCache & groupLookup; - TypeConverter converter; + EntryTypeConverter converter; }; #endif diff --git a/netfs/fuse/fuseApp.h b/netfs/fuse/fuseApp.h index 2c9824b..7e5f279 100644 --- a/netfs/fuse/fuseApp.h +++ b/netfs/fuse/fuseApp.h @@ -125,7 +125,7 @@ namespace NetFS { EntCache userLookup; EntCache groupLookup; - TypeConverter converter; + EntryTypeConverter converter; typedef AdHoc::Cache StatCache; StatCache statCache; diff --git a/netfs/fuse/fuseSystem.cpp b/netfs/fuse/fuseSystem.cpp index 85432e8..ac87d14 100644 --- a/netfs/fuse/fuseSystem.cpp +++ b/netfs/fuse/fuseSystem.cpp @@ -4,7 +4,7 @@ int NetFS::FuseApp::statfs(const char * p, struct statvfs * vfs) { try { - *vfs = converter.convert(volume->statfs(reqEnv(), p)); + *vfs = converter.TypeConverter::convert(volume->statfs(reqEnv(), p)); return 0; } catch (NetFS::SystemError & e) { diff --git a/netfs/ice/typeConverter.cpp b/netfs/ice/typeConverter.cpp index dc130b1..46e8ff1 100644 --- a/netfs/ice/typeConverter.cpp +++ b/netfs/ice/typeConverter.cpp @@ -1,13 +1,13 @@ #include "typeConverter.h" -TypeConverter::TypeConverter(const EntryResolver & u, const EntryResolver & g) : +EntryTypeConverter::EntryTypeConverter(const EntryResolver & u, const EntryResolver & g) : userLookup(u), groupLookup(g) { } struct stat -TypeConverter::convert(const NetFS::Attr & a) const +EntryTypeConverter::convert(const NetFS::Attr & a) const { struct stat s; s.st_dev = a.dev; @@ -51,7 +51,7 @@ TypeConverter::convert(const NetFS::VFS & v) const } NetFS::Attr -TypeConverter::convert(const struct stat & s) const +EntryTypeConverter::convert(const struct stat & s) const { NetFS::Attr a; a.dev = s.st_dev; diff --git a/netfs/ice/typeConverter.h b/netfs/ice/typeConverter.h index d4b1617..b8d6fcd 100644 --- a/netfs/ice/typeConverter.h +++ b/netfs/ice/typeConverter.h @@ -9,16 +9,19 @@ class DLL_PUBLIC TypeConverter { public: - TypeConverter(const EntryResolver &, const EntryResolver &); + // VFS + struct statvfs convert(const NetFS::VFS &) const; + NetFS::VFS convert(const struct statvfs &) const; +}; + +class DLL_PUBLIC EntryTypeConverter : public TypeConverter { + public: + EntryTypeConverter(const EntryResolver &, const EntryResolver &); // Attributes struct stat convert(const NetFS::Attr &) const; NetFS::Attr convert(const struct stat &) const; - // VFS - struct statvfs convert(const NetFS::VFS &) const; - NetFS::VFS convert(const struct statvfs &) const; - protected: const EntryResolver & userLookup; const EntryResolver & groupLookup; -- cgit v1.2.3