From 85d36e56d2f6020fa12efdfed4febc8a8e8d8ec8 Mon Sep 17 00:00:00 2001 From: Brian Gianforcaro Date: Wed, 15 Sep 2021 23:46:45 -0700 Subject: [PATCH] Kernel: Pack Flock struct tighter Flagged by pvs-studio, ordering the members from largest to smallest allows us to save a few bytes in the size of the struct. --- Kernel/FileSystem/Inode.cpp | 2 +- Kernel/FileSystem/Inode.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Kernel/FileSystem/Inode.cpp b/Kernel/FileSystem/Inode.cpp index 4dd78267bb..799e6cbb7a 100644 --- a/Kernel/FileSystem/Inode.cpp +++ b/Kernel/FileSystem/Inode.cpp @@ -336,7 +336,7 @@ KResult Inode::apply_flock(Process const& process, OpenFileDescription const& de return EINVAL; } - m_flocks.append(Flock { new_lock.l_type, new_lock.l_start, new_lock.l_len, &description, process.pid().value() }); + m_flocks.append(Flock { new_lock.l_start, new_lock.l_len, &description, process.pid().value(), new_lock.l_type }); return KSuccess; } diff --git a/Kernel/FileSystem/Inode.h b/Kernel/FileSystem/Inode.h index 971a2f57ac..4356915a82 100644 --- a/Kernel/FileSystem/Inode.h +++ b/Kernel/FileSystem/Inode.h @@ -126,11 +126,11 @@ private: IntrusiveListNode m_inode_list_node; struct Flock { - short type; off_t start; off_t len; OpenFileDescription const* owner; pid_t pid; + short type; }; Vector m_flocks;