From 3275f6245ac336103244ee8a3f4fa162f6952c2c Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Thu, 5 Dec 2024 10:19:43 +0100 Subject: [PATCH] DevCachefiles: remove unused method IsInUse() Since "cull" has the same checks, I don't think we'll ever need the "inuse" command. --- src/DevCachefiles.cxx | 33 --------------------------------- src/DevCachefiles.hxx | 3 --- 2 files changed, 36 deletions(-) diff --git a/src/DevCachefiles.cxx b/src/DevCachefiles.cxx index 503c2cd..50499c2 100644 --- a/src/DevCachefiles.cxx +++ b/src/DevCachefiles.cxx @@ -10,39 +10,6 @@ #include // for NAME_MAX -#if 0 -// TODO does this now work because of the cachefiles CWD problem -[[gnu::pure]] -static Co::Task -IsInUse(Uring::Queue &uring, FileDescriptor dev_cachefiles, std::string_view filename) -try { - if (filename.size() >= NAME_MAX) - co_return false; - - // unfortunately, fscache is buggy with writev() - const auto buffer = FmtBuffer("inuse {}", filename); - - co_await Uring::CoWrite(uring, dev_cachefiles, - AsBytes(std::string_view{buffer}), 0); - co_return false; -} catch (const std::system_error &e) { - co_return IsErrno(e, EBUSY); -} -#endif - -bool -DevCachefiles::IsInUse(std::string_view filename) noexcept -{ - if (filename.size() >= NAME_MAX) - return false; - - // unfortunately, fscache is buggy with writev() - const auto buffer = FmtBuffer("inuse {}", filename); - - return fd.Write(AsBytes(std::string_view{buffer})) < 0 && - errno == EBUSY; -} - DevCachefiles::CullResult DevCachefiles::CullFile(std::string_view filename) noexcept { diff --git a/src/DevCachefiles.hxx b/src/DevCachefiles.hxx index 7bed9a0..a2517ac 100644 --- a/src/DevCachefiles.hxx +++ b/src/DevCachefiles.hxx @@ -22,9 +22,6 @@ public: DevCachefiles(const DevCachefiles &) = delete; DevCachefiles &operator=(const DevCachefiles &) = delete; - [[gnu::pure]] - bool IsInUse(std::string_view filename) noexcept; - enum class CullResult { SUCCESS, BUSY,