diff --git a/src/create.cpp b/src/create.cpp index 01a5a10e..c85605f5 100644 --- a/src/create.cpp +++ b/src/create.cpp @@ -34,13 +34,11 @@ #include "config.hpp" #include "ugid.hpp" -#include "fileinfo.hpp" #include "fs.hpp" #include "rwlock.hpp" using std::string; using std::vector; -using mergerfs::FileInfo; using mergerfs::Policy; static @@ -81,7 +79,7 @@ _create(const fs::find::Func searchFunc, if(fd == -1) return -errno; - fh = (uint64_t)new FileInfo(fd,flags,path); + fh = fd; return 0; } diff --git a/src/fallocate.cpp b/src/fallocate.cpp index ca698256..6f6826b2 100644 --- a/src/fallocate.cpp +++ b/src/fallocate.cpp @@ -33,8 +33,6 @@ #include #include -#include "fileinfo.hpp" - static int _fallocate(const int fd, @@ -75,9 +73,7 @@ namespace mergerfs off_t len, struct fuse_file_info *ffi) { - const FileInfo *fileinfo = (FileInfo*)ffi->fh; - - return _fallocate(fileinfo->fd, + return _fallocate(ffi->fh, mode, offset, len); diff --git a/src/fgetattr.cpp b/src/fgetattr.cpp index f248a920..9a7eb9a0 100644 --- a/src/fgetattr.cpp +++ b/src/fgetattr.cpp @@ -29,8 +29,6 @@ #include #include -#include "fileinfo.hpp" - static int _fgetattr(const int fd, @@ -52,9 +50,7 @@ namespace mergerfs struct stat *st, struct fuse_file_info *ffi) { - const FileInfo *fileinfo = (FileInfo*)ffi->fh; - - return _fgetattr(fileinfo->fd, + return _fgetattr(ffi->fh, *st); } } diff --git a/src/fileinfo.hpp b/src/fileinfo.hpp deleted file mode 100644 index 950f300e..00000000 --- a/src/fileinfo.hpp +++ /dev/null @@ -1,53 +0,0 @@ -/* - The MIT License (MIT) - - Copyright (c) 2014 Antonio SJ Musumeci - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - THE SOFTWARE. -*/ - -#ifndef __FILEINFO_H__ -#define __FILEINFO_H__ - -#include - -namespace mergerfs -{ - struct FileInfo - { - public: - FileInfo(int fd_, - int flags_, - std::string realpath_) : - fd(fd_), - flags(flags_), - realpath(realpath_) - { - } - - int fd; - int flags; - std::string realpath; - - private: - FileInfo() {} - }; -} - -#endif /* __FILEINFO_H__ */ diff --git a/src/flush.cpp b/src/flush.cpp index bf74460a..ac5e6aff 100644 --- a/src/flush.cpp +++ b/src/flush.cpp @@ -27,8 +27,6 @@ #include #include -#include "fileinfo.hpp" - static int _flush(const int fd) @@ -52,7 +50,7 @@ namespace mergerfs flush(const char *fusepath, struct fuse_file_info *ffi) { - return _flush(((FileInfo*)ffi->fh)->fd); + return _flush(ffi->fh); } } } diff --git a/src/fsync.cpp b/src/fsync.cpp index e9c0d4c0..93c4f383 100644 --- a/src/fsync.cpp +++ b/src/fsync.cpp @@ -34,8 +34,6 @@ #include #include -#include "fileinfo.hpp" - static int _fsync(const int fd, @@ -59,9 +57,7 @@ namespace mergerfs int isdatasync, struct fuse_file_info *ffi) { - const FileInfo *fileinfo = (FileInfo*)ffi->fh; - - return _fsync(fileinfo->fd, + return _fsync(ffi->fh, isdatasync); } } diff --git a/src/ftruncate.cpp b/src/ftruncate.cpp index 5e2f9958..1f6d7abf 100644 --- a/src/ftruncate.cpp +++ b/src/ftruncate.cpp @@ -28,8 +28,6 @@ #include #include -#include "fileinfo.hpp" - static int _ftruncate(const int fd, @@ -51,9 +49,7 @@ namespace mergerfs off_t size, struct fuse_file_info *ffi) { - const FileInfo *fileinfo = (FileInfo*)ffi->fh; - - return _ftruncate(fileinfo->fd, + return _ftruncate(ffi->fh, size); } } diff --git a/src/ioctl.cpp b/src/ioctl.cpp index 441e4e3c..9c3fa97f 100644 --- a/src/ioctl.cpp +++ b/src/ioctl.cpp @@ -32,7 +32,6 @@ #include #include "config.hpp" -#include "fileinfo.hpp" #include "ugid.hpp" #include "rwlock.hpp" @@ -145,8 +144,6 @@ namespace mergerfs unsigned int flags, void *data) { - const FileInfo *fileinfo = (FileInfo*)ffi->fh; - #ifdef FUSE_IOCTL_DIR if(flags & FUSE_IOCTL_DIR) return _ioctl_dir(fusepath, @@ -156,7 +153,7 @@ namespace mergerfs data); #endif - return _ioctl(fileinfo->fd, + return _ioctl(ffi->fh, cmd, arg, flags, diff --git a/src/mkdir.cpp b/src/mkdir.cpp index cb9814c7..6b209162 100644 --- a/src/mkdir.cpp +++ b/src/mkdir.cpp @@ -32,7 +32,6 @@ #include #include "ugid.hpp" -#include "fileinfo.hpp" #include "fs.hpp" #include "config.hpp" #include "rwlock.hpp" diff --git a/src/open.cpp b/src/open.cpp index 8a04d86c..ac632ece 100644 --- a/src/open.cpp +++ b/src/open.cpp @@ -32,14 +32,12 @@ #include #include "ugid.hpp" -#include "fileinfo.hpp" #include "fs.hpp" #include "config.hpp" #include "rwlock.hpp" using std::string; using std::vector; -using mergerfs::FileInfo; static int @@ -61,7 +59,7 @@ _open(const fs::find::Func searchFunc, if(fd == -1) return -errno; - fh = (uint64_t)new FileInfo(fd,flags,path[0].full); + fh = fd; return 0; } diff --git a/src/read.cpp b/src/read.cpp index 351f92c1..107ec58f 100644 --- a/src/read.cpp +++ b/src/read.cpp @@ -30,8 +30,6 @@ #include -#include "fileinfo.hpp" - static int _read(const int fd, @@ -57,7 +55,7 @@ namespace mergerfs off_t offset, struct fuse_file_info *ffi) { - return _read(((FileInfo*)ffi->fh)->fd, + return _read(ffi->fh, buf, count, offset); diff --git a/src/read_buf.cpp b/src/read_buf.cpp index 79df8d38..ac79d4a8 100644 --- a/src/read_buf.cpp +++ b/src/read_buf.cpp @@ -30,8 +30,6 @@ #include #include -#include "fileinfo.hpp" - static int _read_buf(const int fd, @@ -67,7 +65,7 @@ namespace mergerfs off_t offset, struct fuse_file_info *ffi) { - return _read_buf(((FileInfo*)ffi->fh)->fd, + return _read_buf(ffi->fh, bufp, size, offset); diff --git a/src/release.cpp b/src/release.cpp index 26253c35..9bf29d0e 100644 --- a/src/release.cpp +++ b/src/release.cpp @@ -29,19 +29,11 @@ #include -#include "fileinfo.hpp" - -using mergerfs::FileInfo; - static int _release(uint64_t &fh) { - const FileInfo *fileinfo = (FileInfo*)fh; - - ::close(fileinfo->fd); - - delete fileinfo; + ::close(fh); fh = 0; diff --git a/src/write.cpp b/src/write.cpp index a6e8d9a3..2cf42058 100644 --- a/src/write.cpp +++ b/src/write.cpp @@ -27,8 +27,6 @@ #include #include -#include "fileinfo.hpp" - static int _write(const int fd, @@ -54,7 +52,7 @@ namespace mergerfs off_t offset, struct fuse_file_info *ffi) { - return _write(((FileInfo*)ffi->fh)->fd, + return _write(ffi->fh, buf, count, offset); diff --git a/src/write_buf.cpp b/src/write_buf.cpp index 7950a093..139d4d77 100644 --- a/src/write_buf.cpp +++ b/src/write_buf.cpp @@ -28,7 +28,6 @@ #include -#include "fileinfo.hpp" #include "write.hpp" static @@ -59,7 +58,7 @@ namespace mergerfs off_t offset, struct fuse_file_info *ffi) { - return _write_buf(((FileInfo*)ffi->fh)->fd, + return _write_buf(ffi->fh, *src, offset); }