diff options
-rw-r--r-- | netfs/daemon/daemon.cpp | 4 | ||||
-rw-r--r-- | netfs/daemon/daemonDirectory.cpp | 3 | ||||
-rw-r--r-- | netfs/daemon/daemonFile.cpp | 3 | ||||
-rw-r--r-- | netfs/daemon/daemonVolume.cpp | 9 | ||||
-rw-r--r-- | netfs/daemon/modeCheck.cpp | 3 | ||||
-rw-r--r-- | netfs/fuse/fuseAppBase.h | 6 | ||||
-rw-r--r-- | netfs/ice/typeConverter.cpp | 6 | ||||
-rw-r--r-- | netfs/unittests/testCore.cpp | 69 | ||||
-rw-r--r-- | netfs/unittests/testEdgeCases.cpp | 18 | ||||
-rw-r--r-- | netfs/unittests/testFuse.cpp | 3 | ||||
-rw-r--r-- | netfs/unittests/testGlacier.cpp | 3 |
11 files changed, 45 insertions, 82 deletions
diff --git a/netfs/daemon/daemon.cpp b/netfs/daemon/daemon.cpp index e232aaa..4d245ac 100644 --- a/netfs/daemon/daemon.cpp +++ b/netfs/daemon/daemon.cpp @@ -68,8 +68,8 @@ NetFSDaemon::stop() extern "C" { DLL_PUBLIC IceBox::Service * - // NOLINTNEXTLINE(performance-unnecessary-value-param) - createNetFSDaemon(Ice::CommunicatorPtr) +// NOLINTNEXTLINE(performance-unnecessary-value-param) +createNetFSDaemon(Ice::CommunicatorPtr) { return new NetFSDaemon(); } diff --git a/netfs/daemon/daemonDirectory.cpp b/netfs/daemon/daemonDirectory.cpp index cf56c72..7b8905d 100644 --- a/netfs/daemon/daemonDirectory.cpp +++ b/netfs/daemon/daemonDirectory.cpp @@ -49,8 +49,7 @@ DirectoryServer::listdir(const Ice::Current &) throw NetFS::SystemError(errno); // LCOV_EXCL_STOP } - struct stat s { - }; + struct stat s { }; if (::fstatat(fd, d->d_name, &s, AT_SYMLINK_NOFOLLOW) != 0) { // LCOV_EXCL_START throw NetFS::SystemError(errno); diff --git a/netfs/daemon/daemonFile.cpp b/netfs/daemon/daemonFile.cpp index 56adcc5..ff4ad3e 100644 --- a/netfs/daemon/daemonFile.cpp +++ b/netfs/daemon/daemonFile.cpp @@ -24,8 +24,7 @@ NetFS::Attr FileServer::fgetattr(const NetFS::ReqEnv re, const Ice::Current &) { (void)re; - struct stat s { - }; + struct stat s { }; if (::fstat(fd, &s) != 0) { throw NetFS::SystemError(errno); } diff --git a/netfs/daemon/daemonVolume.cpp b/netfs/daemon/daemonVolume.cpp index ff75e06..9f23b38 100644 --- a/netfs/daemon/daemonVolume.cpp +++ b/netfs/daemon/daemonVolume.cpp @@ -33,8 +33,7 @@ Ice::Int VolumeServer::access(const NetFS::ReqEnv re, std::string path, Ice::Int mode, const Ice::Current &) { ModeCheck mc(re, root, userLookup, groupLookup); - struct stat s { - }; + struct stat s { }; std::filesystem::path p(resolvePath(std::move(path))); if (::stat(p.c_str(), &s) != 0) { return errno; @@ -60,8 +59,7 @@ NetFS::Attr VolumeServer::getattr(const NetFS::ReqEnv re, std::string path, const Ice::Current &) { ModeCheck mc(re, root, userLookup, groupLookup); - struct stat s { - }; + struct stat s { }; std::filesystem::path p(resolvePath(std::move(path))); mc.AssertReadParent(p); if (::lstat(p.c_str(), &s) != 0) { @@ -191,8 +189,7 @@ VolumeServer::statfs(const NetFS::ReqEnv re, std::string path, const Ice::Curren { ModeCheck mc(re, root, userLookup, groupLookup); errno = 0; - struct statvfs s { - }; + struct statvfs s { }; std::filesystem::path p(resolvePath(std::move(path))); mc.AssertRead(p); if (::statvfs(p.c_str(), &s) != 0) { diff --git a/netfs/daemon/modeCheck.cpp b/netfs/daemon/modeCheck.cpp index 652d8a4..a9096fd 100644 --- a/netfs/daemon/modeCheck.cpp +++ b/netfs/daemon/modeCheck.cpp @@ -75,8 +75,7 @@ ModeCheck::AssertWritePerms(const std::filesystem::path & p) const struct stat ModeCheck::lstat(const std::filesystem::path & p) { - struct stat s { - }; + struct stat s { }; if (::lstat(p.c_str(), &s) != 0) { throw NetFS::SystemError(errno); } diff --git a/netfs/fuse/fuseAppBase.h b/netfs/fuse/fuseAppBase.h index 4fdfb37..ab47476 100644 --- a/netfs/fuse/fuseAppBase.h +++ b/netfs/fuse/fuseAppBase.h @@ -136,7 +136,8 @@ public: private: template<typename BFunc, typename IFunc, BFunc bfunc, typename Rtn, typename... Args> - constexpr static auto getInternalHelper(Rtn (FuseAppBase::*)(Args...)) -> Rtn (*)(Args...) + constexpr static auto + getInternalHelper(Rtn (FuseAppBase::*)(Args...)) -> Rtn (*)(Args...) { if constexpr (!std::is_same<BFunc, IFunc>::value) { return [](Args... a) { @@ -147,7 +148,8 @@ private: return nullptr; } template<typename BFunc, typename IFunc, BFunc bfunc, typename Rtn, typename... Args> - constexpr static auto getHelper(Rtn (FuseAppBase::*)(Args...)) -> Rtn (*)(Args...) + constexpr static auto + getHelper(Rtn (FuseAppBase::*)(Args...)) -> Rtn (*)(Args...) { if constexpr (!std::is_same<BFunc, IFunc>::value) { return [](Args... a) -> Rtn { diff --git a/netfs/ice/typeConverter.cpp b/netfs/ice/typeConverter.cpp index b1ade2b..2d9914a 100644 --- a/netfs/ice/typeConverter.cpp +++ b/netfs/ice/typeConverter.cpp @@ -17,8 +17,7 @@ struct stat EntryTypeConverter::convert(const NetFS::Attr & a) const { auto map = mapper->mapTransport(a.uid, a.gid); - struct stat s { - }; + struct stat s { }; s.st_dev = a.dev; s.st_ino = a.inode; s.st_mode = a.mode & ~map.mask; @@ -44,8 +43,7 @@ EntryTypeConverter::convert(const NetFS::Attr & a) const struct statvfs TypeConverter::convert(const NetFS::VFS & v) const { - struct statvfs vfs { - }; + struct statvfs vfs { }; vfs.f_bsize = v.blockSize; vfs.f_frsize = v.fragmentSize; vfs.f_blocks = v.blocks; diff --git a/netfs/unittests/testCore.cpp b/netfs/unittests/testCore.cpp index 1e68be5..bb22858 100644 --- a/netfs/unittests/testCore.cpp +++ b/netfs/unittests/testCore.cpp @@ -119,8 +119,7 @@ BOOST_AUTO_TEST_CASE(testNavigation) { struct stat attr { }, rootattr {}, insideattr {}; - struct fuse_file_info fi { - }; + struct fuse_file_info fi { }; int fd = fuse->create("/inside", 0666, &fi); BOOST_REQUIRE(fd >= 0); fuse->release("/inside", &fi); @@ -155,8 +154,7 @@ BOOST_AUTO_TEST_CASE(testSandboxing) std::filesystem::remove(binDir / "outside"); std::filesystem::remove(binDir / "sub" / "outside"); std::filesystem::remove(binDir / "sub"); - struct fuse_file_info fi { - }; + struct fuse_file_info fi { }; BOOST_REQUIRE_EQUAL(fuse->create("../outside", 0666, &fi), -EPERM); BOOST_REQUIRE(!std::filesystem::exists(binDir / "outside")); BOOST_REQUIRE_EQUAL(fuse->create("/../outside", 0666, &fi), -EPERM); @@ -180,8 +178,7 @@ BOOST_AUTO_TEST_CASE(testSandboxing) void enableWriteOnDir(const fuse_operations * fuse, const char * dir) { - struct stat st { - }; + struct stat st { }; BOOST_REQUIRE_EQUAL(fuse->chmod(dir, 0700, nullptr), 0); BOOST_REQUIRE_EQUAL(fuse->getattr(dir, &st, nullptr), 0); BOOST_REQUIRE_EQUAL(st.st_mode, 0700 | S_IFDIR); @@ -190,8 +187,7 @@ enableWriteOnDir(const fuse_operations * fuse, const char * dir) void disableWriteOnDir(const fuse_operations * fuse, const char * dir) { - struct stat st { - }; + struct stat st { }; BOOST_REQUIRE_EQUAL(fuse->chmod(dir, 0500, nullptr), 0); BOOST_REQUIRE_EQUAL(fuse->getattr(dir, &st, nullptr), 0); BOOST_REQUIRE_EQUAL(st.st_mode, 0500 | S_IFDIR); @@ -199,10 +195,8 @@ disableWriteOnDir(const fuse_operations * fuse, const char * dir) BOOST_AUTO_TEST_CASE(directories) { - struct fuse_file_info fi { - }; - struct stat st { - }; + struct fuse_file_info fi { }; + struct stat st { }; BOOST_REQUIRE_EQUAL(fuse->mkdir("/test", 0700), 0); BOOST_REQUIRE(std::filesystem::is_directory(binDir / testExport / "test")); BOOST_REQUIRE_EQUAL(fuse->mkdir("/test", 0700), -EEXIST); @@ -245,8 +239,7 @@ BOOST_AUTO_TEST_CASE(directories) BOOST_AUTO_TEST_CASE(files) { - struct fuse_file_info fi { - }; + struct fuse_file_info fi { }; struct stat st { }, st2 {}; fi.flags = O_RDWR; @@ -319,10 +312,8 @@ BOOST_AUTO_TEST_CASE(files_copy_range) BOOST_AUTO_TEST_CASE(bgwriteOverlapped, *boost::unit_test::timeout(2)) { - struct fuse_file_info fi { - }; - struct stat st { - }; + struct fuse_file_info fi { }; + struct stat st { }; fi.flags = O_RDWR; constexpr auto s = sizeof(int32_t); auto N = 20; @@ -342,10 +333,8 @@ BOOST_AUTO_TEST_CASE(bgwriteOverlapped, *boost::unit_test::timeout(2)) BOOST_AUTO_TEST_CASE(bgwriteDistinct, *boost::unit_test::timeout(2)) { - struct fuse_file_info fi { - }; - struct stat st { - }; + struct fuse_file_info fi { }; + struct stat st { }; fi.flags = O_RDWR; constexpr auto s = sizeof(int32_t); auto N = 20; @@ -381,8 +370,7 @@ BOOST_AUTO_TEST_CASE(symlinks) BOOST_AUTO_TEST_CASE(access) { - struct stat st { - }; + struct stat st { }; BOOST_REQUIRE_EQUAL(fuse->access("/", F_OK), 0); BOOST_REQUIRE_EQUAL(fuse->access("/missing", F_OK), -ENOENT); // Basic assertions @@ -408,8 +396,7 @@ BOOST_AUTO_TEST_CASE(access) BOOST_AUTO_TEST_CASE(permissionsDirs) { - struct stat st { - }; + struct stat st { }; BOOST_REQUIRE_EQUAL(fuse->mkdir("/dir", 0700), 0); BOOST_REQUIRE_EQUAL(fuse->mkdir("/dir/yes", 0000), 0); BOOST_REQUIRE_EQUAL(fuse->getattr("/dir/yes", &st, nullptr), 0); @@ -425,10 +412,8 @@ BOOST_AUTO_TEST_CASE(permissionsDirs) BOOST_AUTO_TEST_CASE(permissionsFiles) { - struct stat st { - }; - struct fuse_file_info fi { - }; + struct stat st { }; + struct fuse_file_info fi { }; fi.flags = O_RDWR; BOOST_REQUIRE_EQUAL(fuse->mkdir("/dir", 0700), 0); BOOST_REQUIRE_NE(fuse->create("/dir/yes", 0000, &fi), -1); @@ -448,8 +433,7 @@ BOOST_AUTO_TEST_CASE(mknod) { BOOST_REQUIRE_EQUAL(fuse->mknod("/nod", 0600 | S_IFIFO, 0), 0); BOOST_REQUIRE_EQUAL(fuse->mknod("/nod", 0600 | S_IFIFO, 0), -EEXIST); - struct stat st { - }; + struct stat st { }; BOOST_REQUIRE_EQUAL(fuse->getattr("/nod", &st, nullptr), 0); BOOST_REQUIRE_EQUAL(st.st_mode, 0600 | S_IFIFO); BOOST_REQUIRE_EQUAL(fuse->unlink("/nod"), 0); @@ -461,8 +445,7 @@ BOOST_AUTO_TEST_CASE(mknod) BOOST_AUTO_TEST_CASE(renameToDir) { - struct fuse_file_info fi { - }; + struct fuse_file_info fi { }; BOOST_REQUIRE_EQUAL(fuse->create("/file", 0600, &fi), 0); BOOST_REQUIRE_EQUAL(fuse->release("/file", &fi), 0); BOOST_REQUIRE_EQUAL(fuse->mkdir("/dir", 0700), 0); @@ -481,8 +464,7 @@ BOOST_AUTO_TEST_CASE(renameToDir) BOOST_AUTO_TEST_CASE(renameFlags) { - struct fuse_file_info fi { - }; + struct fuse_file_info fi { }; BOOST_REQUIRE_EQUAL(fuse->create("/file", 0600, &fi), 0); BOOST_REQUIRE_EQUAL(fuse->release("/file", &fi), 0); BOOST_REQUIRE_EQUAL(fuse->create("/file2", 0600, &fi), 0); @@ -501,8 +483,7 @@ BOOST_AUTO_TEST_CASE(chown) { BOOST_REQUIRE_EQUAL(fuse->mkdir("/dir", 0777), 0); BOOST_REQUIRE_EQUAL(fuse->chown("/dir", getuid(), getgid(), nullptr), 0); - struct stat st { - }; + struct stat st { }; BOOST_REQUIRE_EQUAL(fuse->getattr("/dir", &st, nullptr), 0); BOOST_REQUIRE_EQUAL(st.st_uid, getuid()); BOOST_REQUIRE_EQUAL(st.st_gid, getgid()); @@ -517,8 +498,7 @@ BOOST_AUTO_TEST_CASE(utimens) BOOST_REQUIRE_EQUAL(fuse->utimens("/file", times.data(), nullptr), 0); times[1].tv_nsec = -200; BOOST_REQUIRE_EQUAL(fuse->utimens("/file", times.data(), nullptr), -EINVAL); - struct stat st { - }; + struct stat st { }; BOOST_REQUIRE_EQUAL(fuse->getattr("/file", &st, nullptr), 0); BOOST_REQUIRE_EQUAL(st.st_atime, 1); BOOST_REQUIRE_EQUAL(st.st_atim.tv_sec, 1); @@ -544,8 +524,7 @@ BOOST_FIXTURE_TEST_SUITE(NetfsAltCore, AltCore); BOOST_AUTO_TEST_CASE(noListDir) { - struct fuse_file_info fi { - }; + struct fuse_file_info fi { }; BOOST_REQUIRE_EQUAL(fuse->mkdir("/test", 0700), 0); BOOST_REQUIRE(std::filesystem::is_directory(binDir / testExport / "test")); BOOST_REQUIRE_EQUAL(fuse->mkdir("/test", 0700), -EEXIST); @@ -584,10 +563,8 @@ BOOST_AUTO_TEST_CASE(noListDir) BOOST_AUTO_TEST_CASE(testFGWrites) { - struct fuse_file_info fi { - }; - struct stat st { - }; + struct fuse_file_info fi { }; + struct stat st { }; fi.flags = O_RDWR; BOOST_REQUIRE_EQUAL(fuse->create("/test", 0600, &fi), 0); BOOST_REQUIRE_EQUAL(fuse->write("/test", "some test buffer", 16, 0, &fi), 16); diff --git a/netfs/unittests/testEdgeCases.cpp b/netfs/unittests/testEdgeCases.cpp index 2553a7f..51a1931 100644 --- a/netfs/unittests/testEdgeCases.cpp +++ b/netfs/unittests/testEdgeCases.cpp @@ -12,22 +12,19 @@ BOOST_AUTO_TEST_CASE(createAndDaemonRestart) MockDaemonHost daemon(testEndpoint, {"--NetFSD.ConfigPath=" + (rootDir / "defaultDaemon.xml").string()}); FuseMockHost fuse(testEndpoint, {(rootDir / "defaultFuse.xml:testvol").string(), (rootDir / "test").string()}); - struct statvfs s { - }; + struct statvfs s { }; BOOST_REQUIRE_EQUAL(0, fuse.fuse->statfs("/", &s)); const char * fileName = "/createMe"; BOOST_TEST_CHECKPOINT("Create a new file"); - struct fuse_file_info fh { - }; + struct fuse_file_info fh { }; memset(&fh, 0, sizeof(fh)); fh.flags = O_WRONLY | O_CREAT | O_APPEND; BOOST_REQUIRE_EQUAL(0, fuse.fuse->create(fileName, 0100644, &fh)); BOOST_REQUIRE(fh.fh); BOOST_TEST_CHECKPOINT("Fetch file attributes"); - struct stat st { - }; + struct stat st { }; BOOST_REQUIRE_EQUAL(0, fuse.fuse->getattr(fileName, &st, &fh)); BOOST_REQUIRE_EQUAL(st.st_size, 0); BOOST_REQUIRE_EQUAL(st.st_uid, getuid()); @@ -62,8 +59,7 @@ BOOST_AUTO_TEST_CASE(noDaemonAtStartUp) { FuseMockHost fuse(testEndpoint, {(rootDir / "defaultFuse.xml:testvol").string(), (rootDir / "test").string()}); - struct statvfs s { - }; + struct statvfs s { }; BOOST_REQUIRE_EQUAL(-EIO, fuse.fuse->statfs("/", &s)); MockDaemonHost daemon(testEndpoint, {"--NetFSD.ConfigPath=" + (rootDir / "defaultDaemon.xml").string()}); @@ -73,8 +69,7 @@ BOOST_AUTO_TEST_CASE(noDaemonAtStartUp) BOOST_AUTO_TEST_CASE(daemonUnavailableAfterUse) { FuseMockHost fuse(testEndpoint, {(rootDir / "defaultFuse.xml:testvol").string(), (rootDir / "test").string()}); - struct statvfs s { - }; + struct statvfs s { }; { MockDaemonHost daemon(testEndpoint, {"--NetFSD.ConfigPath=" + (rootDir / "defaultDaemon.xml").string()}); @@ -100,8 +95,7 @@ BOOST_AUTO_TEST_CASE(manyThreads) std::atomic<unsigned int> success {0}, failure {0}; for (int x = 0; x < 20; x++) { ths.emplace_back([&] { - struct statvfs s { - }; + struct statvfs s { }; while (running) { if (fuse.fuse->statfs("/", &s) == 0) { success++; diff --git a/netfs/unittests/testFuse.cpp b/netfs/unittests/testFuse.cpp index a95b956..cbd2d66 100644 --- a/netfs/unittests/testFuse.cpp +++ b/netfs/unittests/testFuse.cpp @@ -32,8 +32,7 @@ static auto get_lstat(const std::filesystem::path & p) { - struct stat st { - }; + struct stat st { }; BOOST_TEST_INFO(p); BOOST_REQUIRE_EQUAL(::lstat(p.c_str(), &st), 0); return st; diff --git a/netfs/unittests/testGlacier.cpp b/netfs/unittests/testGlacier.cpp index 5950e61..5467c41 100644 --- a/netfs/unittests/testGlacier.cpp +++ b/netfs/unittests/testGlacier.cpp @@ -29,8 +29,7 @@ BOOST_AUTO_TEST_CASE(withRouter) {(rootDir / "defaultFuse.xml:testvol").string(), (rootDir / "test").string(), "--Ice.Default.Router=Glacier2/router:tcp -h localhost -p 14063"}); - struct statvfs s { - }; + struct statvfs s { }; BOOST_REQUIRE_EQUAL(0, fuse.fuse->statfs("/", &s)); } } |