diff options
author | Sergey Bugaev <bugaevc@serenityos.org> | 2020-05-28 18:03:58 +0300 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-05-29 07:53:30 +0200 |
commit | 4b300e085d3fcad038b180ab90a9546bdfcc1335 (patch) | |
tree | 5c123b7077c2e3b0765d695a96273fceab7a6736 | |
parent | fdb71cdf8fa6c48b226e2242fbfdd75216e2f442 (diff) | |
download | serenity-4b300e085d3fcad038b180ab90a9546bdfcc1335.zip |
Userland+SystemMonitor: Recognize the MS_RDONLY mount flag
-rw-r--r-- | Applications/SystemMonitor/main.cpp | 9 | ||||
-rw-r--r-- | Userland/chroot.cpp | 2 | ||||
-rw-r--r-- | Userland/mount.cpp | 4 |
3 files changed, 11 insertions, 4 deletions
diff --git a/Applications/SystemMonitor/main.cpp b/Applications/SystemMonitor/main.cpp index 9bf95ca2dc..914fef186a 100644 --- a/Applications/SystemMonitor/main.cpp +++ b/Applications/SystemMonitor/main.cpp @@ -78,7 +78,7 @@ static NonnullRefPtr<GUI::Widget> build_graphs_tab(); class UnavailableProcessWidget final : public GUI::Frame { C_OBJECT(UnavailableProcessWidget) public: - virtual ~UnavailableProcessWidget() override {} + virtual ~UnavailableProcessWidget() override { } const String& text() const { return m_text; } void set_text(String text) { m_text = move(text); } @@ -285,7 +285,7 @@ int main(int argc, char** argv) class ProgressBarPaintingDelegate final : public GUI::TableCellPaintingDelegate { public: - virtual ~ProgressBarPaintingDelegate() override {} + virtual ~ProgressBarPaintingDelegate() override { } virtual void paint(GUI::Painter& painter, const Gfx::Rect& a_rect, const Palette& palette, const GUI::Model& model, const GUI::ModelIndex& index) override { @@ -357,7 +357,9 @@ NonnullRefPtr<GUI::Widget> build_file_systems_tab() return object.get("free_block_count").to_u32() * object.get("block_size").to_u32(); }); df_fields.empend("Access", Gfx::TextAlignment::CenterLeft, [](const JsonObject& object) { - return object.get("readonly").to_bool() ? "Read-only" : "Read/Write"; + bool readonly = object.get("readonly").to_bool(); + int mount_flags = object.get("mount_flags").to_int(); + return readonly || (mount_flags & MS_RDONLY) ? "Read-only" : "Read/Write"; }); df_fields.empend("Mount flags", Gfx::TextAlignment::CenterLeft, [](const JsonObject& object) { int mount_flags = object.get("mount_flags").to_int(); @@ -375,6 +377,7 @@ NonnullRefPtr<GUI::Widget> build_file_systems_tab() check(MS_NOEXEC, "noexec"); check(MS_NOSUID, "nosuid"); check(MS_BIND, "bind"); + check(MS_RDONLY, "ro"); if (builder.string_view().is_empty()) return String("defaults"); return builder.to_string(); diff --git a/Userland/chroot.cpp b/Userland/chroot.cpp index a739b8bbbc..d658fa80ef 100644 --- a/Userland/chroot.cpp +++ b/Userland/chroot.cpp @@ -57,6 +57,8 @@ int main(int argc, char** argv) flags |= MS_NOEXEC; else if (part == "nosuid") flags |= MS_NOSUID; + else if (part == "ro") + flags |= MS_RDONLY; else if (part == "bind") fprintf(stderr, "Ignoring -o bind, as it doesn't make sense for chroot\n"); else diff --git a/Userland/mount.cpp b/Userland/mount.cpp index 9601807353..35085a0f58 100644 --- a/Userland/mount.cpp +++ b/Userland/mount.cpp @@ -50,6 +50,8 @@ int parse_options(const StringView& options) flags |= MS_NOSUID; else if (part == "bind") flags |= MS_BIND; + else if (part == "ro") + flags |= MS_RDONLY; else fprintf(stderr, "Ignoring invalid option: %s\n", part.to_string().characters()); } @@ -157,7 +159,7 @@ bool print_mounts() printf("%s on %s type %s (", source.characters(), mount_point.characters(), class_name.characters()); - if (readonly) + if (readonly || mount_flags & MS_RDONLY) printf("ro"); else printf("rw"); |