Skip to content

Commit

Permalink
Kernel: Rename Lock to Mutex
Browse files Browse the repository at this point in the history
Let's be explicit about what kind of lock this is meant to be.
  • Loading branch information
awesomekling committed Jul 17, 2021
1 parent a803c40 commit cee9528
Show file tree
Hide file tree
Showing 51 changed files with 140 additions and 140 deletions.
2 changes: 1 addition & 1 deletion Kernel/ACPI/DynamicParser.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#include <AK/RefPtr.h>
#include <Kernel/ACPI/Parser.h>
#include <Kernel/Interrupts/IRQHandler.h>
#include <Kernel/Lock.h>
#include <Kernel/Mutex.h>
#include <Kernel/PhysicalAddress.h>
#include <Kernel/VM/PhysicalPage.h>

Expand Down
2 changes: 1 addition & 1 deletion Kernel/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ set(KERNEL_SOURCES
KLexicalPath.cpp
KString.cpp
KSyms.cpp
Lock.cpp
Mutex.cpp
Net/E1000ENetworkAdapter.cpp
Net/E1000NetworkAdapter.cpp
Net/IPv4Socket.cpp
Expand Down
2 changes: 1 addition & 1 deletion Kernel/Devices/Device.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#include <AK/HashMap.h>
#include <Kernel/Devices/AsyncDeviceRequest.h>
#include <Kernel/FileSystem/File.h>
#include <Kernel/Lock.h>
#include <Kernel/Mutex.h>
#include <Kernel/UnixTypes.h>

namespace Kernel {
Expand Down
4 changes: 2 additions & 2 deletions Kernel/DoubleBuffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

#include <AK/Types.h>
#include <Kernel/KBuffer.h>
#include <Kernel/Lock.h>
#include <Kernel/Mutex.h>
#include <Kernel/Thread.h>
#include <Kernel/UserOrKernelBuffer.h>

Expand Down Expand Up @@ -66,7 +66,7 @@ class DoubleBuffer {
size_t m_read_buffer_index { 0 };
size_t m_space_for_writing { 0 };
bool m_empty { true };
mutable Lock m_lock { "DoubleBuffer" };
mutable Mutex m_lock { "DoubleBuffer" };
};

}
2 changes: 1 addition & 1 deletion Kernel/FileSystem/BlockBasedFileSystem.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class BlockBasedFileSystem : public FileBackedFileSystem {
DiskCache& cache() const;
void flush_specific_block_if_needed(BlockIndex index);

mutable Lock m_cache_lock;
mutable Mutex m_cache_lock;
mutable OwnPtr<DiskCache> m_cache;
};

Expand Down
2 changes: 1 addition & 1 deletion Kernel/FileSystem/FIFO.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#include <AK/StdLibExtras.h>
#include <Kernel/FileSystem/FIFO.h>
#include <Kernel/FileSystem/FileDescription.h>
#include <Kernel/Lock.h>
#include <Kernel/Mutex.h>
#include <Kernel/Process.h>
#include <Kernel/Thread.h>

Expand Down
4 changes: 2 additions & 2 deletions Kernel/FileSystem/FIFO.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

#include <Kernel/DoubleBuffer.h>
#include <Kernel/FileSystem/File.h>
#include <Kernel/Lock.h>
#include <Kernel/Mutex.h>
#include <Kernel/UnixTypes.h>
#include <Kernel/WaitQueue.h>

Expand Down Expand Up @@ -61,7 +61,7 @@ class FIFO final : public File {

WaitQueue m_read_open_queue;
WaitQueue m_write_open_queue;
Lock m_open_lock;
Mutex m_open_lock;
};

}
2 changes: 1 addition & 1 deletion Kernel/FileSystem/FileDescription.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ KResultOr<NonnullOwnPtr<KBuffer>> FileDescription::read_entire_file()

KResultOr<size_t> FileDescription::get_dir_entries(UserOrKernelBuffer& output_buffer, size_t size)
{
Locker locker(m_lock, Lock::Mode::Shared);
Locker locker(m_lock, Mutex::Mode::Shared);
if (!is_directory())
return ENOTDIR;

Expand Down
2 changes: 1 addition & 1 deletion Kernel/FileSystem/FileDescription.h
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ class FileDescription : public RefCounted<FileDescription> {
bool m_direct : 1 { false };
FIFO::Direction m_fifo_direction { FIFO::Direction::Neither };

Lock m_lock { "FileDescription" };
Mutex m_lock { "FileDescription" };
};

}
4 changes: 2 additions & 2 deletions Kernel/FileSystem/FileSystem.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#include <Kernel/FileSystem/InodeIdentifier.h>
#include <Kernel/Forward.h>
#include <Kernel/KResult.h>
#include <Kernel/Lock.h>
#include <Kernel/Mutex.h>
#include <Kernel/UnixTypes.h>
#include <Kernel/UserOrKernelBuffer.h>

Expand Down Expand Up @@ -69,7 +69,7 @@ class FileSystem : public RefCounted<FileSystem> {
void set_block_size(u64 size) { m_block_size = size; }
void set_fragment_size(size_t size) { m_fragment_size = size; }

mutable Lock m_lock { "FS" };
mutable Mutex m_lock { "FS" };

private:
unsigned m_fsid { 0 };
Expand Down
4 changes: 2 additions & 2 deletions Kernel/FileSystem/Inode.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#include <Kernel/FileSystem/InodeMetadata.h>
#include <Kernel/Forward.h>
#include <Kernel/KResult.h>
#include <Kernel/Lock.h>
#include <Kernel/Mutex.h>

namespace Kernel {

Expand Down Expand Up @@ -109,7 +109,7 @@ class Inode : public RefCounted<Inode>
void did_modify_contents();
void did_delete_self();

mutable Lock m_lock { "Inode" };
mutable Mutex m_lock { "Inode" };

private:
FileSystem& m_file_system;
Expand Down
2 changes: 1 addition & 1 deletion Kernel/FileSystem/InodeWatcher.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ class InodeWatcher final : public File {
private:
explicit InodeWatcher() { }

mutable Lock m_lock;
mutable Mutex m_lock;

struct Event {
int wd { 0 };
Expand Down
2 changes: 1 addition & 1 deletion Kernel/FileSystem/Plan9FileSystem.h
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ class Plan9FS final : public FileBackedFileSystem {
ProtocolVersion m_remote_protocol_version { ProtocolVersion::v9P2000 };
size_t m_max_message_size { 4 * KiB };

Lock m_send_lock { "Plan9FS send" };
Mutex m_send_lock { "Plan9FS send" };
Plan9FSBlockCondition m_completion_blocker;
HashMap<u16, NonnullRefPtr<ReceiveCompletion>> m_completions;

Expand Down
2 changes: 1 addition & 1 deletion Kernel/FileSystem/ProcFS.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#include <Kernel/FileSystem/Inode.h>
#include <Kernel/Forward.h>
#include <Kernel/KBufferBuilder.h>
#include <Kernel/Lock.h>
#include <Kernel/Mutex.h>
#include <Kernel/ProcessExposed.h>

namespace Kernel {
Expand Down
4 changes: 2 additions & 2 deletions Kernel/FileSystem/SysFS.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@ class SysFSComponentRegistry {
void register_new_component(SysFSComponent&);

SysFSDirectory& root_folder() { return m_root_folder; }
Lock& get_lock() { return m_lock; }
Mutex& get_lock() { return m_lock; }

private:
Lock m_lock;
Mutex m_lock;
NonnullRefPtr<SysFSRootDirectory> m_root_folder;
};

Expand Down
12 changes: 6 additions & 6 deletions Kernel/FileSystem/TmpFS.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ unsigned TmpFS::next_inode_index()

RefPtr<Inode> TmpFS::get_inode(InodeIdentifier identifier) const
{
Locker locker(m_lock, Lock::Mode::Shared);
Locker locker(m_lock, Mutex::Mode::Shared);
VERIFY(identifier.fsid() == fsid());

auto it = m_inodes.find(identifier.index());
Expand Down Expand Up @@ -105,14 +105,14 @@ RefPtr<TmpFSInode> TmpFSInode::create_root(TmpFS& fs)

InodeMetadata TmpFSInode::metadata() const
{
Locker locker(m_lock, Lock::Mode::Shared);
Locker locker(m_lock, Mutex::Mode::Shared);

return m_metadata;
}

KResult TmpFSInode::traverse_as_directory(Function<bool(FileSystem::DirectoryEntryView const&)> callback) const
{
Locker locker(m_lock, Lock::Mode::Shared);
Locker locker(m_lock, Mutex::Mode::Shared);

if (!is_directory())
return ENOTDIR;
Expand All @@ -129,7 +129,7 @@ KResult TmpFSInode::traverse_as_directory(Function<bool(FileSystem::DirectoryEnt

KResultOr<size_t> TmpFSInode::read_bytes(off_t offset, size_t size, UserOrKernelBuffer& buffer, FileDescription*) const
{
Locker locker(m_lock, Lock::Mode::Shared);
Locker locker(m_lock, Mutex::Mode::Shared);
VERIFY(!is_directory());
VERIFY(offset >= 0);

Expand Down Expand Up @@ -198,7 +198,7 @@ KResultOr<size_t> TmpFSInode::write_bytes(off_t offset, size_t size, const UserO

RefPtr<Inode> TmpFSInode::lookup(StringView name)
{
Locker locker(m_lock, Lock::Mode::Shared);
Locker locker(m_lock, Mutex::Mode::Shared);
VERIFY(is_directory());

if (name == ".")
Expand All @@ -214,7 +214,7 @@ RefPtr<Inode> TmpFSInode::lookup(StringView name)

KResultOr<size_t> TmpFSInode::directory_entry_count() const
{
Locker locker(m_lock, Lock::Mode::Shared);
Locker locker(m_lock, Mutex::Mode::Shared);
VERIFY(is_directory());
return 2 + m_children.size();
}
Expand Down
2 changes: 1 addition & 1 deletion Kernel/FileSystem/VirtualFileSystem.h
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ class VirtualFileSystem {
Mount* find_mount_for_host(InodeIdentifier);
Mount* find_mount_for_guest(InodeIdentifier);

Lock m_lock { "VFSLock" };
Mutex m_lock { "VFSLock" };

RefPtr<Inode> m_root_inode;
Vector<Mount, 16> m_mounts;
Expand Down
2 changes: 1 addition & 1 deletion Kernel/Forward.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class InodeWatcher;
class KBuffer;
class KResult;
class LocalSocket;
class Lock;
class Mutex;
class MappedROM;
class MasterPTY;
class Mount;
Expand Down
8 changes: 4 additions & 4 deletions Kernel/GlobalProcessExposed.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ class ProcFSARP final : public ProcFSGlobalInformation {
virtual bool output(KBufferBuilder& builder) override
{
JsonArraySerializer array { builder };
Locker locker(arp_table().lock(), Lock::Mode::Shared);
Locker locker(arp_table().lock(), Mutex::Mode::Shared);
for (auto& it : arp_table().resource()) {
auto obj = array.add_object();
obj.add("mac_address", it.value.to_string());
Expand Down Expand Up @@ -247,7 +247,7 @@ class ProcFSDumpKmallocStacks : public ProcFSSystemBoolean {

private:
ProcFSDumpKmallocStacks();
mutable Lock m_lock;
mutable Mutex m_lock;
};

class ProcFSUBSanDeadly : public ProcFSSystemBoolean {
Expand All @@ -266,7 +266,7 @@ class ProcFSUBSanDeadly : public ProcFSSystemBoolean {

private:
ProcFSUBSanDeadly();
mutable Lock m_lock;
mutable Mutex m_lock;
};

class ProcFSCapsLockRemap : public ProcFSSystemBoolean {
Expand All @@ -285,7 +285,7 @@ class ProcFSCapsLockRemap : public ProcFSSystemBoolean {

private:
ProcFSCapsLockRemap();
mutable Lock m_lock;
mutable Mutex m_lock;
};

UNMAP_AFTER_INIT NonnullRefPtr<ProcFSDumpKmallocStacks> ProcFSDumpKmallocStacks::must_create(const ProcFSSystemDirectory&)
Expand Down
2 changes: 1 addition & 1 deletion Kernel/Graphics/VirtIOGPU/VirtIOGPU.h
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ class VirtIOGPU final

// Synchronous commands
WaitQueue m_outstanding_request;
Lock m_operation_lock;
Mutex m_operation_lock;
OwnPtr<Region> m_scratch_space;
};

Expand Down
Loading

0 comments on commit cee9528

Please sign in to comment.