diff options
| -rw-r--r-- | netfs/fuse/fuseApp.cpp | 6 | ||||
| -rw-r--r-- | netfs/fuse/fuseApp.h | 9 | ||||
| -rw-r--r-- | netfs/fuse/fuseFiles.cpp | 8 | ||||
| -rw-r--r-- | netfs/fuse/fuseFiles.h | 4 | ||||
| -rw-r--r-- | netfs/unittests/mockFuse.cpp | 1 | 
5 files changed, 17 insertions, 11 deletions
diff --git a/netfs/fuse/fuseApp.cpp b/netfs/fuse/fuseApp.cpp index 29a142d..f21c8c3 100644 --- a/netfs/fuse/fuseApp.cpp +++ b/netfs/fuse/fuseApp.cpp @@ -85,7 +85,7 @@ NetFS::FuseApp::init(struct fuse_conn_info *, struct fuse_config *)  	}  	BOOST_ASSERT(fcr);  	converter.mapper = fcr->Mapper; -	combinedSettings.MessageSizeMax = ic->getProperties()->getPropertyAsIntWithDefault("Ice.MessageSizeMax", 1024); +	clientSettings.MessageSizeMax = ic->getProperties()->getPropertyAsIntWithDefault("Ice.MessageSizeMax", 1024);  	return this;  } @@ -173,10 +173,10 @@ NetFS::FuseApp::connectSession()  	}  } -NetFS::Settings +NetFS::FuseApp::CombinedSettings  NetFS::FuseApp::combineSettings(const Settings & daemon, const Settings & client)  { -	return NetFS::Settings {std::min(daemon.MessageSizeMax.value_or(1024), client.MessageSizeMax.value_or(1024))}; +	return {safe {std::min(daemon.MessageSizeMax.value_or(1024), client.MessageSizeMax.value_or(1024)) * 1024}};  }  void diff --git a/netfs/fuse/fuseApp.h b/netfs/fuse/fuseApp.h index 006effd..30425b8 100644 --- a/netfs/fuse/fuseApp.h +++ b/netfs/fuse/fuseApp.h @@ -41,6 +41,10 @@ namespace NetFS {  		void connectHandles();  		void verifyConnection(); +		struct CombinedSettings { +			size_t MessageSizeMax; +		}; +  	public:  		// misc  		int access(const char * p, int a) override; @@ -82,7 +86,7 @@ namespace NetFS {  		static NetFS::Client::ResourcePtr configureFromFile(const std::filesystem::path &, const std::string &);  		static NetFS::Client::ResourcePtr configureFromUri(const std::string &); -		static Settings combineSettings(const Settings & daemon, const Settings & client); +		static CombinedSettings combineSettings(const Settings & daemon, const Settings & client);  	protected:  		template<typename Handle, typename... Params> void setProxy(FuseHandleTypeId & fh, const Params &...); @@ -104,7 +108,8 @@ namespace NetFS {  		NetFS::ServicePrxPtr service;  		Glacier2::SessionPrxPtr session;  		NetFS::SettingsPtr daemonSettings; -		NetFS::Settings clientSettings, combinedSettings; +		NetFS::Settings clientSettings; +		CombinedSettings combinedSettings;  		bool sessionOpened {false};  		std::string mountPoint; diff --git a/netfs/fuse/fuseFiles.cpp b/netfs/fuse/fuseFiles.cpp index 7a4a4f6..3ecb37f 100644 --- a/netfs/fuse/fuseFiles.cpp +++ b/netfs/fuse/fuseFiles.cpp @@ -9,8 +9,8 @@  namespace NetFS {  	FuseApp::OpenFile::WriteState::WriteState() : future(promise.get_future().share()) { } -	FuseApp::OpenFile::OpenFile(FilePrxPtr r, std::string p, int f, Ice::Int mms) : -		remote(std::move(r)), path(std::move(p)), flags(f), messageMaxSize(mms) +	FuseApp::OpenFile::OpenFile(FilePrxPtr r, std::string p, int f, size_t mms) : +		remote(std::move(r)), path(std::move(p)), flags(f), bodyMaxSize(mms - 1024)  	{  	} @@ -56,7 +56,7 @@ namespace NetFS {  	{  		try {  			auto remote = volume->open(reqEnv(), p, fi->flags); -			setProxy<OpenFilePtr>(fi->fh, remote, p, fi->flags, combinedSettings.MessageSizeMax.value_or(1024)); +			setProxy<OpenFilePtr>(fi->fh, remote, p, fi->flags, combinedSettings.MessageSizeMax);  			return 0;  		}  		catch (SystemError & e) { @@ -69,7 +69,7 @@ namespace NetFS {  	{  		try {  			auto remote = volume->create(reqEnv(), p, fi->flags, safe {m}); -			setProxy<OpenFilePtr>(fi->fh, remote, p, fi->flags, combinedSettings.MessageSizeMax.value_or(1024)); +			setProxy<OpenFilePtr>(fi->fh, remote, p, fi->flags, combinedSettings.MessageSizeMax);  			return 0;  		}  		catch (SystemError & e) { diff --git a/netfs/fuse/fuseFiles.h b/netfs/fuse/fuseFiles.h index 7ddf799..37e3dec 100644 --- a/netfs/fuse/fuseFiles.h +++ b/netfs/fuse/fuseFiles.h @@ -6,7 +6,7 @@  namespace NetFS {  	class FuseApp::OpenFile {  	public: -		OpenFile(FilePrxPtr remote, std::string path, int flags, Ice::Int messageMaxSize); +		OpenFile(FilePrxPtr remote, std::string path, int flags, size_t messageMaxSize);  		void flush();  		void wait() const; @@ -14,7 +14,7 @@ namespace NetFS {  		FilePrxPtr remote;  		const std::string path;  		const int flags; -		const Ice::Int messageMaxSize; +		const size_t bodyMaxSize;  		class WriteState {  		public:  			WriteState(); diff --git a/netfs/unittests/mockFuse.cpp b/netfs/unittests/mockFuse.cpp index 35bc61d..a1cf29b 100644 --- a/netfs/unittests/mockFuse.cpp +++ b/netfs/unittests/mockFuse.cpp @@ -32,6 +32,7 @@ FuseMock::connectToService()  			throw std::runtime_error("Invalid service proxy: " + testEndpoint);  		}  		daemonSettings = service->getSettings(); +		combinedSettings = combineSettings(*daemonSettings, clientSettings);  	}  }  | 
