From 6ac4ec601dee0e49320810f0af8aa8ab6c9e4c56 Mon Sep 17 00:00:00 2001 From: "Justin C. Miller" Date: Sat, 22 Oct 2022 16:49:25 -0700 Subject: [PATCH] [kernel] standardize static constexpr order in kobject headers The kobject headers flip-flopped the class constants between "static constexpr" and "constexpr static". --- src/kernel/objects/channel.h | 5 ++--- src/kernel/objects/event.h | 4 +--- src/kernel/objects/mailbox.h | 3 +-- src/kernel/objects/process.h | 14 +++++++------- src/kernel/objects/system.h | 3 +-- src/kernel/objects/thread.h | 8 ++++---- src/kernel/objects/vm_area.h | 3 +-- 7 files changed, 17 insertions(+), 23 deletions(-) diff --git a/src/kernel/objects/channel.h b/src/kernel/objects/channel.h index cbfd1f7..6312aea 100644 --- a/src/kernel/objects/channel.h +++ b/src/kernel/objects/channel.h @@ -18,13 +18,12 @@ class channel : { public: /// Capabilities on a newly constructed channel handle - constexpr static j6_cap_t creation_caps = j6_cap_channel_all; + static constexpr j6_cap_t creation_caps = j6_cap_channel_all; + static constexpr kobject::type type = kobject::type::channel; channel(); virtual ~channel(); - static constexpr kobject::type type = kobject::type::channel; - /// Put a message into the channel /// \arg data Buffer of data to write /// \returns The number of bytes successfully written diff --git a/src/kernel/objects/event.h b/src/kernel/objects/event.h index 88d6dc4..2620625 100644 --- a/src/kernel/objects/event.h +++ b/src/kernel/objects/event.h @@ -10,14 +10,12 @@ namespace obj { -class thread; - class event : public kobject { public: /// Capabilities on a newly constructed event handle - constexpr static j6_cap_t creation_caps = j6_cap_event_all; + static constexpr j6_cap_t creation_caps = j6_cap_event_all; static constexpr kobject::type type = kobject::type::event; event(); diff --git a/src/kernel/objects/mailbox.h b/src/kernel/objects/mailbox.h index 470791c..99f5f1e 100644 --- a/src/kernel/objects/mailbox.h +++ b/src/kernel/objects/mailbox.h @@ -26,8 +26,7 @@ public: using reply_tag_t = uint64_t; /// Capabilities on a newly constructed mailbox handle - constexpr static j6_cap_t creation_caps = j6_cap_mailbox_all; - + static constexpr j6_cap_t creation_caps = j6_cap_mailbox_all; static constexpr kobject::type type = kobject::type::mailbox; /// Max message handle count diff --git a/src/kernel/objects/process.h b/src/kernel/objects/process.h index 8f30a3b..0986bf6 100644 --- a/src/kernel/objects/process.h +++ b/src/kernel/objects/process.h @@ -19,19 +19,21 @@ class process : { public: /// Capabilities on a newly constructed process handle - constexpr static j6_cap_t creation_caps = j6_cap_process_all; + static constexpr j6_cap_t creation_caps = j6_cap_process_all; /// Capabilities on a process to itself - constexpr static j6_cap_t self_caps = j6_cap_process_all; + static constexpr j6_cap_t self_caps = j6_cap_process_all; /// Top of memory area where thread stacks are allocated - constexpr static uintptr_t stacks_top = 0x0000800000000000; + static constexpr uintptr_t stacks_top = 0x0000800000000000; /// Size of userspace thread stacks - constexpr static size_t stack_size = 0x4000000; // 64MiB + static constexpr size_t stack_size = 0x4000000; // 64MiB /// Value that represents default priority - constexpr static uint8_t default_priority = 0xff; + static constexpr uint8_t default_priority = 0xff; + + static constexpr kobject::type type = kobject::type::process; /// Constructor. process(); @@ -39,8 +41,6 @@ public: /// Destructor. virtual ~process(); - static constexpr kobject::type type = kobject::type::process; - /// Get the currently executing process. static process & current(); diff --git a/src/kernel/objects/system.h b/src/kernel/objects/system.h index 1526445..55afdd3 100644 --- a/src/kernel/objects/system.h +++ b/src/kernel/objects/system.h @@ -12,8 +12,7 @@ class system : { public: /// Capabilities on system given to init - constexpr static j6_cap_t init_caps = j6_cap_system_all; - + static constexpr j6_cap_t init_caps = j6_cap_system_all; static constexpr kobject::type type = kobject::type::system; inline static system & get() { return s_instance; } diff --git a/src/kernel/objects/thread.h b/src/kernel/objects/thread.h index 5fb1e12..241f382 100644 --- a/src/kernel/objects/thread.h +++ b/src/kernel/objects/thread.h @@ -55,10 +55,12 @@ class thread : { public: /// Capabilities on a newly constructed thread handle - constexpr static j6_cap_t creation_caps = j6_cap_thread_all; + static constexpr j6_cap_t creation_caps = j6_cap_thread_all; /// Capabilities the parent process gets on new thread handles - constexpr static j6_cap_t parent_caps = j6_cap_thread_all; + static constexpr j6_cap_t parent_caps = j6_cap_thread_all; + + static constexpr kobject::type type = kobject::type::thread; enum class state : uint8_t { none = 0x00, @@ -71,8 +73,6 @@ public: /// Destructor virtual ~thread(); - static constexpr kobject::type type = kobject::type::thread; - /// Get the currently executing thread. static thread & current(); diff --git a/src/kernel/objects/vm_area.h b/src/kernel/objects/vm_area.h index 367270a..8bc57c3 100644 --- a/src/kernel/objects/vm_area.h +++ b/src/kernel/objects/vm_area.h @@ -35,8 +35,7 @@ class vm_area : { public: /// Capabilities on a newly constructed vma handle - constexpr static j6_cap_t creation_caps = j6_cap_vma_all; - + static constexpr j6_cap_t creation_caps = j6_cap_vma_all; static constexpr kobject::type type = kobject::type::vma; /// Constructor.