summaryrefslogtreecommitdiff
path: root/netfs/fuse/fuseFiles.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'netfs/fuse/fuseFiles.cpp')
-rw-r--r--netfs/fuse/fuseFiles.cpp31
1 files changed, 6 insertions, 25 deletions
diff --git a/netfs/fuse/fuseFiles.cpp b/netfs/fuse/fuseFiles.cpp
index c8d2495..4a96e51 100644
--- a/netfs/fuse/fuseFiles.cpp
+++ b/netfs/fuse/fuseFiles.cpp
@@ -21,6 +21,7 @@ NetFS::FuseApp::setProxy(OpenFilePtr of, uint64_t & fh)
NetFS::FuseApp::OpenFilePtr
NetFS::FuseApp::getFileProxy(uint64_t localID) const
{
+ SLOCK;
OpenFiles::const_iterator i = openFiles.find(localID);
if (i != openFiles.end()) {
return i->second;
@@ -65,11 +66,7 @@ int
NetFS::FuseApp::release(const char *, struct fuse_file_info * fi)
{
try {
- FilePrx remote;
- {
- LOCK;
- remote = getFileProxy(fi->fh)->remote;
- }
+ auto remote = getFileProxy(fi->fh)->remote;
remote->close();
clearFileProxy(fi->fh);
return 0;
@@ -83,11 +80,7 @@ int
NetFS::FuseApp::read(const char *, char * buf, size_t s, off_t o, struct fuse_file_info * fi)
{
try {
- FilePrx remote;
- {
- LOCK;
- remote = getFileProxy(fi->fh)->remote;
- }
+ auto remote = getFileProxy(fi->fh)->remote;
NetFS::Buffer data = remote->read(o, s);
memcpy(buf, &data.front(), data.size());
return data.size();
@@ -101,11 +94,7 @@ int
NetFS::FuseApp::write(const char *, const char * buf, size_t s, off_t o, struct fuse_file_info * fi)
{
try {
- FilePrx remote;
- {
- LOCK;
- remote = getFileProxy(fi->fh)->remote;
- }
+ auto remote = getFileProxy(fi->fh)->remote;
remote->write(o, s, NetFS::Buffer(buf, buf + s));
return s;
}
@@ -130,11 +119,7 @@ int
NetFS::FuseApp::ftruncate(const char *, off_t o, fuse_file_info * fi)
{
try {
- FilePrx remote;
- {
- LOCK;
- remote = getFileProxy(fi->fh)->remote;
- }
+ auto remote = getFileProxy(fi->fh)->remote;
remote->ftruncate(reqEnv(), o);
return 0;
}
@@ -147,11 +132,7 @@ int
NetFS::FuseApp::fgetattr(const char *, struct stat * s, fuse_file_info * fi)
{
try {
- FilePrx remote;
- {
- LOCK;
- remote = getFileProxy(fi->fh)->remote;
- }
+ auto remote = getFileProxy(fi->fh)->remote;
*s << AttrSource { remote->fgetattr(reqEnv()), boost::bind(&UserEntCache::getID, &uentries, _1), boost::bind(&GroupEntCache::getID, &gentries, _1) };
return 0;
}