diff --git a/Userland/Applets/ResourceGraph/main.cpp b/Userland/Applets/ResourceGraph/main.cpp index 729551b059..6bf437d5e9 100644 --- a/Userland/Applets/ResourceGraph/main.cpp +++ b/Userland/Applets/ResourceGraph/main.cpp @@ -144,7 +144,7 @@ private: { if (m_proc_mem) { // Seeking to the beginning causes a data refresh! - if (!m_proc_mem->seek(0, Core::File::SeekMode::SetPosition)) + if (!m_proc_mem->seek(0, Core::SeekMode::SetPosition)) return false; } else { auto proc_memstat = Core::File::construct("/proc/memstat"); diff --git a/Userland/Libraries/LibCore/FileStream.h b/Userland/Libraries/LibCore/FileStream.h index e7bdde05e5..1011fd2662 100644 --- a/Userland/Libraries/LibCore/FileStream.h +++ b/Userland/Libraries/LibCore/FileStream.h @@ -63,7 +63,7 @@ public: return true; } - bool discard_or_error(size_t count) override { return m_file->seek(count, IODevice::SeekMode::FromCurrentPosition); } + bool discard_or_error(size_t count) override { return m_file->seek(count, SeekMode::FromCurrentPosition); } bool unreliable_eof() const override { return m_file->eof(); } diff --git a/Userland/Libraries/LibCore/IODevice.h b/Userland/Libraries/LibCore/IODevice.h index eb3805d80b..d625cf836e 100644 --- a/Userland/Libraries/LibCore/IODevice.h +++ b/Userland/Libraries/LibCore/IODevice.h @@ -44,6 +44,12 @@ enum class OpenMode : unsigned { MustBeNew = 16, }; +enum class SeekMode { + SetPosition, + FromCurrentPosition, + FromEndPosition, +}; + AK_ENUM_BITWISE_OPERATORS(OpenMode) class IODevice : public Object { @@ -76,12 +82,6 @@ public: bool can_read() const; - enum class SeekMode { - SetPosition, - FromCurrentPosition, - FromEndPosition, - }; - bool seek(i64, SeekMode = SeekMode::SetPosition, off_t* = nullptr); virtual bool open(OpenMode) = 0; diff --git a/Userland/Libraries/LibCore/ProcessStatisticsReader.cpp b/Userland/Libraries/LibCore/ProcessStatisticsReader.cpp index 9c7b679996..585088e92e 100644 --- a/Userland/Libraries/LibCore/ProcessStatisticsReader.cpp +++ b/Userland/Libraries/LibCore/ProcessStatisticsReader.cpp @@ -20,7 +20,7 @@ HashMap ProcessStatisticsReader::s_usernames; Optional> ProcessStatisticsReader::get_all(RefPtr& proc_all_file) { if (proc_all_file) { - if (!proc_all_file->seek(0, Core::File::SeekMode::SetPosition)) { + if (!proc_all_file->seek(0, Core::SeekMode::SetPosition)) { fprintf(stderr, "ProcessStatisticsReader: Failed to refresh /proc/all: %s\n", proc_all_file->error_string()); return {}; } diff --git a/Userland/Utilities/tail.cpp b/Userland/Utilities/tail.cpp index 84b7a5aac9..a1e6280abe 100644 --- a/Userland/Utilities/tail.cpp +++ b/Userland/Utilities/tail.cpp @@ -47,7 +47,7 @@ static off_t find_seek_pos(Core::File& file, int wanted_lines) // Rather than reading the whole file, start at the end and work backwards, // stopping when we've found the number of lines we want. off_t pos = 0; - if (!file.seek(0, Core::IODevice::SeekMode::FromEndPosition, &pos)) { + if (!file.seek(0, Core::SeekMode::FromEndPosition, &pos)) { fprintf(stderr, "Failed to find end of file: %s\n", file.error_string()); return 1; }