Remove unused parameter from statfs()

This commit is contained in:
Sebastian Messmer 2018-09-22 14:24:31 -07:00
parent 3697e9eff4
commit 5da8eac56e
11 changed files with 14 additions and 15 deletions

View File

@ -235,9 +235,7 @@ CryDevice::BlobWithParent CryDevice::LoadBlobWithParent(const bf::path &path) {
// Possible reason: Many parallel changes to a directory blob are a race condition. Need something like ParallelAccessStore! // Possible reason: Many parallel changes to a directory blob are a race condition. Need something like ParallelAccessStore!
} }
CryDevice::statvfs CryDevice::statfs(const bf::path &path) { CryDevice::statvfs CryDevice::statfs() {
// TODO Do we need path for something? What does it represent from fuse side?
UNUSED(path);
callFsActionCallbacks(); callFsActionCallbacks();
uint64_t numUsedBlocks = _fsBlobStore->numBlocks(); uint64_t numUsedBlocks = _fsBlobStore->numBlocks();

View File

@ -21,7 +21,7 @@ class CryDevice final: public fspp::Device {
public: public:
CryDevice(CryConfigFile config, cpputils::unique_ref<blockstore::BlockStore2> blockStore, const LocalStateDir& localStateDir, uint32_t myClientId, bool allowIntegrityViolations, bool missingBlockIsIntegrityViolation); CryDevice(CryConfigFile config, cpputils::unique_ref<blockstore::BlockStore2> blockStore, const LocalStateDir& localStateDir, uint32_t myClientId, bool allowIntegrityViolations, bool missingBlockIsIntegrityViolation);
statvfs statfs(const boost::filesystem::path &path) override; statvfs statfs() override;
cpputils::unique_ref<parallelaccessfsblobstore::FileBlobRef> CreateFileBlob(const blockstore::BlockId &parent); cpputils::unique_ref<parallelaccessfsblobstore::FileBlobRef> CreateFileBlob(const blockstore::BlockId &parent);
cpputils::unique_ref<parallelaccessfsblobstore::DirBlobRef> CreateDirBlob(const blockstore::BlockId &parent); cpputils::unique_ref<parallelaccessfsblobstore::DirBlobRef> CreateDirBlob(const blockstore::BlockId &parent);

View File

@ -18,7 +18,7 @@ public:
using statvfs = fspp::statvfs; using statvfs = fspp::statvfs;
virtual statvfs statfs(const boost::filesystem::path &path) = 0; virtual statvfs statfs() = 0;
virtual boost::optional<cpputils::unique_ref<Node>> Load(const boost::filesystem::path &path) = 0; virtual boost::optional<cpputils::unique_ref<Node>> Load(const boost::filesystem::path &path) = 0;
//TODO Test default implementation (Device.cpp) //TODO Test default implementation (Device.cpp)

View File

@ -43,7 +43,7 @@ public:
virtual void unlink(const boost::filesystem::path &path) = 0; virtual void unlink(const boost::filesystem::path &path) = 0;
virtual void rename(const boost::filesystem::path &from, const boost::filesystem::path &to) = 0; virtual void rename(const boost::filesystem::path &from, const boost::filesystem::path &to) = 0;
virtual void utimens(const boost::filesystem::path &path, timespec lastAccessTime, timespec lastModificationTime) = 0; virtual void utimens(const boost::filesystem::path &path, timespec lastAccessTime, timespec lastModificationTime) = 0;
virtual void statfs(const boost::filesystem::path &path, struct ::statvfs *fsstat) = 0; virtual void statfs(struct ::statvfs *fsstat) = 0;
//TODO We shouldn't use Dir::Entry here, that's in another layer //TODO We shouldn't use Dir::Entry here, that's in another layer
virtual cpputils::unique_ref<std::vector<Dir::Entry>> readDir(const boost::filesystem::path &path) = 0; virtual cpputils::unique_ref<std::vector<Dir::Entry>> readDir(const boost::filesystem::path &path) = 0;
//TODO Test createSymlink //TODO Test createSymlink

View File

@ -718,9 +718,10 @@ int Fuse::statfs(const bf::path &path, struct ::statvfs *fsstat) {
#ifdef FSPP_LOG #ifdef FSPP_LOG
LOG(DEBUG, "statfs({}, _)", path); LOG(DEBUG, "statfs({}, _)", path);
#endif #endif
UNUSED(path);
try { try {
ASSERT(is_valid_fspp_path(path), "has to be an absolute path"); ASSERT(is_valid_fspp_path(path), "has to be an absolute path");
_fs->statfs(path, fsstat); _fs->statfs(fsstat);
return 0; return 0;
} catch(const cpputils::AssertFailed &e) { } catch(const cpputils::AssertFailed &e) {
LOG(ERR, "AssertFailed in Fuse::statfs: {}", e.what()); LOG(ERR, "AssertFailed in Fuse::statfs: {}", e.what());

View File

@ -293,9 +293,9 @@ void FilesystemImpl::utimens(const bf::path &path, timespec lastAccessTime, time
} }
} }
void FilesystemImpl::statfs(const bf::path &path, struct ::statvfs *fsstat) { void FilesystemImpl::statfs(struct ::statvfs *fsstat) {
PROFILE(_statfsNanosec); PROFILE(_statfsNanosec);
Device::statvfs stat = _device->statfs(path); Device::statvfs stat = _device->statfs();
fsstat->f_bsize = stat.blocksize; fsstat->f_bsize = stat.blocksize;
fsstat->f_blocks = stat.num_total_blocks; fsstat->f_blocks = stat.num_total_blocks;

View File

@ -45,7 +45,7 @@ public:
void rename(const boost::filesystem::path &from, const boost::filesystem::path &to) override; void rename(const boost::filesystem::path &from, const boost::filesystem::path &to) override;
cpputils::unique_ref<std::vector<Dir::Entry>> readDir(const boost::filesystem::path &path) override; cpputils::unique_ref<std::vector<Dir::Entry>> readDir(const boost::filesystem::path &path) override;
void utimens(const boost::filesystem::path &path, timespec lastAccessTime, timespec lastModificationTime) override; void utimens(const boost::filesystem::path &path, timespec lastAccessTime, timespec lastModificationTime) override;
void statfs(const boost::filesystem::path &path, struct ::statvfs *fsstat) override; void statfs(struct ::statvfs *fsstat) override;
void createSymlink(const boost::filesystem::path &to, const boost::filesystem::path &from, ::uid_t uid, ::gid_t gid) override; void createSymlink(const boost::filesystem::path &to, const boost::filesystem::path &from, ::uid_t uid, ::gid_t gid) override;
void readSymlink(const boost::filesystem::path &path, char *buf, fspp::num_bytes_t size) override; void readSymlink(const boost::filesystem::path &path, char *buf, fspp::num_bytes_t size) override;

View File

@ -18,14 +18,14 @@ INSTANTIATE_TEST_CASE_P(FuseStatfsErrorTest, FuseStatfsErrorTest, Values(EACCES,
TEST_F(FuseStatfsErrorTest, ReturnNoError) { TEST_F(FuseStatfsErrorTest, ReturnNoError) {
ReturnIsFileOnLstat(FILENAME); ReturnIsFileOnLstat(FILENAME);
EXPECT_CALL(fsimpl, statfs(StrEq(FILENAME), _)).Times(1).WillOnce(Return()); EXPECT_CALL(fsimpl, statfs(_)).Times(1).WillOnce(Return());
int error = StatfsReturnError(FILENAME); int error = StatfsReturnError(FILENAME);
EXPECT_EQ(0, error); EXPECT_EQ(0, error);
} }
TEST_P(FuseStatfsErrorTest, ReturnError) { TEST_P(FuseStatfsErrorTest, ReturnError) {
ReturnIsFileOnLstat(FILENAME); ReturnIsFileOnLstat(FILENAME);
EXPECT_CALL(fsimpl, statfs(StrEq(FILENAME), _)).Times(1).WillOnce(Throw(FuseErrnoException(GetParam()))); EXPECT_CALL(fsimpl, statfs( _)).Times(1).WillOnce(Throw(FuseErrnoException(GetParam())));
int error = StatfsReturnError(FILENAME); int error = StatfsReturnError(FILENAME);
EXPECT_EQ(GetParam(), error); EXPECT_EQ(GetParam(), error);
} }

View File

@ -34,7 +34,7 @@ int FuseStatfsTest::StatfsReturnError(const std::string &path, struct ::statvfs
struct ::statvfs FuseStatfsTest::CallStatfsWithImpl(function<void(struct ::statvfs*)> implementation) { struct ::statvfs FuseStatfsTest::CallStatfsWithImpl(function<void(struct ::statvfs*)> implementation) {
ReturnIsFileOnLstat(FILENAME); ReturnIsFileOnLstat(FILENAME);
EXPECT_CALL(fsimpl, statfs(StrEq(FILENAME), _)).WillRepeatedly(Invoke([implementation](const char*, struct ::statvfs *stat) { EXPECT_CALL(fsimpl, statfs(_)).WillRepeatedly(Invoke([implementation](struct ::statvfs *stat) {
implementation(stat); implementation(stat);
})); }));

View File

@ -37,7 +37,7 @@ FuseTest::FuseTest(): fsimpl() {
ON_CALL(fsimpl, rename(_,_)).WillByDefault(defaultAction); ON_CALL(fsimpl, rename(_,_)).WillByDefault(defaultAction);
ON_CALL(fsimpl, readDir(_)).WillByDefault(defaultAction); ON_CALL(fsimpl, readDir(_)).WillByDefault(defaultAction);
ON_CALL(fsimpl, utimens(_,_,_)).WillByDefault(defaultAction); ON_CALL(fsimpl, utimens(_,_,_)).WillByDefault(defaultAction);
ON_CALL(fsimpl, statfs(_,_)).WillByDefault(Invoke([](const char */*path*/, struct statvfs *result) { ON_CALL(fsimpl, statfs(_)).WillByDefault(Invoke([](struct statvfs *result) {
::statvfs("/", result); // As dummy value take the values from the root filesystem ::statvfs("/", result); // As dummy value take the values from the root filesystem
})); }));
ON_CALL(fsimpl, chmod(_,_)).WillByDefault(defaultAction); ON_CALL(fsimpl, chmod(_,_)).WillByDefault(defaultAction);

View File

@ -72,7 +72,7 @@ public:
return utimens(path.string().c_str(), lastAccessTime, lastModificationTime); return utimens(path.string().c_str(), lastAccessTime, lastModificationTime);
} }
MOCK_METHOD3(utimens, void(const char*, timespec, timespec)); MOCK_METHOD3(utimens, void(const char*, timespec, timespec));
MOCK_PATH_METHOD2(statfs, void, struct statvfs*); MOCK_METHOD1(statfs, void(struct statvfs*));
void createSymlink(const boost::filesystem::path &to, const boost::filesystem::path &from, uid_t uid, gid_t gid) override { void createSymlink(const boost::filesystem::path &to, const boost::filesystem::path &from, uid_t uid, gid_t gid) override {
return createSymlink(to.string().c_str(), from.string().c_str(), uid, gid); return createSymlink(to.string().c_str(), from.string().c_str(), uid, gid);
} }