summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2021-08-28 21:25:18 +0200
committerAndreas Kling <kling@serenityos.org>2021-08-29 01:09:19 +0200
commit59335bd8eaf7c4f11bb5a9ab96373dfe8eca0893 (patch)
tree12dd819aad4fcbdff12098c093615e58062cd06a
parent31bc9565f8a4afa5abfa3d50f4b02cdc697f26b1 (diff)
downloadserenity-59335bd8eaf7c4f11bb5a9ab96373dfe8eca0893.zip
Kernel: Rename FileDescription::create() => try_create()
-rw-r--r--Kernel/FileSystem/FIFO.cpp2
-rw-r--r--Kernel/FileSystem/File.cpp2
-rw-r--r--Kernel/FileSystem/FileDescription.cpp4
-rw-r--r--Kernel/FileSystem/FileDescription.h4
-rw-r--r--Kernel/FileSystem/VirtualFileSystem.cpp4
-rw-r--r--Kernel/Net/LocalSocket.cpp4
-rw-r--r--Kernel/Storage/StorageManagement.cpp2
-rw-r--r--Kernel/Syscalls/anon_create.cpp2
-rw-r--r--Kernel/Syscalls/inode_watcher.cpp2
-rw-r--r--Kernel/Syscalls/socket.cpp4
-rw-r--r--Kernel/TTY/PTYMultiplexer.cpp2
11 files changed, 16 insertions, 16 deletions
diff --git a/Kernel/FileSystem/FIFO.cpp b/Kernel/FileSystem/FIFO.cpp
index be6d236d09..1572436cfa 100644
--- a/Kernel/FileSystem/FIFO.cpp
+++ b/Kernel/FileSystem/FIFO.cpp
@@ -26,7 +26,7 @@ RefPtr<FIFO> FIFO::try_create(uid_t uid)
KResultOr<NonnullRefPtr<FileDescription>> FIFO::open_direction(FIFO::Direction direction)
{
- auto description = FileDescription::create(*this);
+ auto description = FileDescription::try_create(*this);
if (!description.is_error()) {
attach(direction);
description.value()->set_fifo_direction({}, direction);
diff --git a/Kernel/FileSystem/File.cpp b/Kernel/FileSystem/File.cpp
index 91311f639e..e9f44cefd2 100644
--- a/Kernel/FileSystem/File.cpp
+++ b/Kernel/FileSystem/File.cpp
@@ -30,7 +30,7 @@ bool File::unref() const
KResultOr<NonnullRefPtr<FileDescription>> File::open(int options)
{
- auto description = FileDescription::create(*this);
+ auto description = FileDescription::try_create(*this);
if (!description.is_error()) {
description.value()->set_rw_mode(options);
description.value()->set_file_flags(options);
diff --git a/Kernel/FileSystem/FileDescription.cpp b/Kernel/FileSystem/FileDescription.cpp
index 5b0062f74d..1bd5da16a0 100644
--- a/Kernel/FileSystem/FileDescription.cpp
+++ b/Kernel/FileSystem/FileDescription.cpp
@@ -24,7 +24,7 @@
namespace Kernel {
-KResultOr<NonnullRefPtr<FileDescription>> FileDescription::create(Custody& custody)
+KResultOr<NonnullRefPtr<FileDescription>> FileDescription::try_create(Custody& custody)
{
auto inode_file = InodeFile::create(custody.inode());
if (inode_file.is_error())
@@ -43,7 +43,7 @@ KResultOr<NonnullRefPtr<FileDescription>> FileDescription::create(Custody& custo
return description.release_nonnull();
}
-KResultOr<NonnullRefPtr<FileDescription>> FileDescription::create(File& file)
+KResultOr<NonnullRefPtr<FileDescription>> FileDescription::try_create(File& file)
{
auto description = adopt_ref_if_nonnull(new (nothrow) FileDescription(file));
if (!description)
diff --git a/Kernel/FileSystem/FileDescription.h b/Kernel/FileSystem/FileDescription.h
index 05bd10e4c4..6f2ddec7fb 100644
--- a/Kernel/FileSystem/FileDescription.h
+++ b/Kernel/FileSystem/FileDescription.h
@@ -26,8 +26,8 @@ public:
class FileDescription : public RefCounted<FileDescription> {
MAKE_SLAB_ALLOCATED(FileDescription)
public:
- static KResultOr<NonnullRefPtr<FileDescription>> create(Custody&);
- static KResultOr<NonnullRefPtr<FileDescription>> create(File&);
+ static KResultOr<NonnullRefPtr<FileDescription>> try_create(Custody&);
+ static KResultOr<NonnullRefPtr<FileDescription>> try_create(File&);
~FileDescription();
Thread::FileBlocker::BlockFlags should_unblock(Thread::FileBlocker::BlockFlags) const;
diff --git a/Kernel/FileSystem/VirtualFileSystem.cpp b/Kernel/FileSystem/VirtualFileSystem.cpp
index 3c23ea0a6f..8bba5d1f98 100644
--- a/Kernel/FileSystem/VirtualFileSystem.cpp
+++ b/Kernel/FileSystem/VirtualFileSystem.cpp
@@ -312,7 +312,7 @@ KResultOr<NonnullRefPtr<FileDescription>> VirtualFileSystem::open(StringView pat
if (auto result = inode.set_mtime(kgettimeofday().to_truncated_seconds()); result.is_error())
return result;
}
- auto description = FileDescription::create(custody);
+ auto description = FileDescription::try_create(custody);
if (!description.is_error()) {
description.value()->set_rw_mode(options);
description.value()->set_file_flags(options);
@@ -379,7 +379,7 @@ KResultOr<NonnullRefPtr<FileDescription>> VirtualFileSystem::create(StringView p
auto new_custody_or_error = Custody::try_create(&parent_custody, basename, inode_or_error.value(), parent_custody.mount_flags());
if (new_custody_or_error.is_error())
return new_custody_or_error.error();
- auto description = FileDescription::create(*new_custody_or_error.release_value());
+ auto description = FileDescription::try_create(*new_custody_or_error.release_value());
if (!description.is_error()) {
description.value()->set_rw_mode(options);
description.value()->set_file_flags(options);
diff --git a/Kernel/Net/LocalSocket.cpp b/Kernel/Net/LocalSocket.cpp
index 78264cb517..8226a962d7 100644
--- a/Kernel/Net/LocalSocket.cpp
+++ b/Kernel/Net/LocalSocket.cpp
@@ -55,7 +55,7 @@ KResultOr<SocketPair> LocalSocket::create_connected_pair(int type)
return socket_or_error.error();
auto socket = static_ptr_cast<LocalSocket>(socket_or_error.release_value());
- auto description1_result = FileDescription::create(*socket);
+ auto description1_result = FileDescription::try_create(*socket);
if (description1_result.is_error())
return description1_result.error();
@@ -69,7 +69,7 @@ KResultOr<SocketPair> LocalSocket::create_connected_pair(int type)
socket->set_connect_side_role(Role::Connected);
socket->m_role = Role::Accepted;
- auto description2_result = FileDescription::create(*socket);
+ auto description2_result = FileDescription::try_create(*socket);
if (description2_result.is_error())
return description2_result.error();
diff --git a/Kernel/Storage/StorageManagement.cpp b/Kernel/Storage/StorageManagement.cpp
index bb15f4c680..9b53b991e5 100644
--- a/Kernel/Storage/StorageManagement.cpp
+++ b/Kernel/Storage/StorageManagement.cpp
@@ -182,7 +182,7 @@ NonnullRefPtr<FileSystem> StorageManagement::root_filesystem() const
if (!boot_device_description) {
PANIC("StorageManagement: Couldn't find a suitable device to boot from");
}
- auto e2fs = Ext2FS::create(FileDescription::create(boot_device_description.release_nonnull()).value());
+ auto e2fs = Ext2FS::create(FileDescription::try_create(boot_device_description.release_nonnull()).value());
if (auto result = e2fs->initialize(); result.is_error()) {
PANIC("StorageManagement: Couldn't open root filesystem: {}", result);
}
diff --git a/Kernel/Syscalls/anon_create.cpp b/Kernel/Syscalls/anon_create.cpp
index 4ea569c973..ecbaa7e313 100644
--- a/Kernel/Syscalls/anon_create.cpp
+++ b/Kernel/Syscalls/anon_create.cpp
@@ -36,7 +36,7 @@ KResultOr<FlatPtr> Process::sys$anon_create(size_t size, int options)
auto anon_file = AnonymousFile::create(maybe_vmobject.release_value());
if (!anon_file)
return ENOMEM;
- auto description_or_error = FileDescription::create(*anon_file);
+ auto description_or_error = FileDescription::try_create(*anon_file);
if (description_or_error.is_error())
return description_or_error.error();
diff --git a/Kernel/Syscalls/inode_watcher.cpp b/Kernel/Syscalls/inode_watcher.cpp
index 32498cc876..f4b42d5b14 100644
--- a/Kernel/Syscalls/inode_watcher.cpp
+++ b/Kernel/Syscalls/inode_watcher.cpp
@@ -27,7 +27,7 @@ KResultOr<FlatPtr> Process::sys$create_inode_watcher(u32 flags)
if (watcher_or_error.is_error())
return watcher_or_error.error();
- auto description_or_error = FileDescription::create(*watcher_or_error.value());
+ auto description_or_error = FileDescription::try_create(*watcher_or_error.value());
if (description_or_error.is_error())
return description_or_error.error();
diff --git a/Kernel/Syscalls/socket.cpp b/Kernel/Syscalls/socket.cpp
index 5af6b526ce..0988a04153 100644
--- a/Kernel/Syscalls/socket.cpp
+++ b/Kernel/Syscalls/socket.cpp
@@ -45,7 +45,7 @@ KResultOr<FlatPtr> Process::sys$socket(int domain, int type, int protocol)
auto result = Socket::create(domain, type, protocol);
if (result.is_error())
return result.error();
- auto description_result = FileDescription::create(*result.value());
+ auto description_result = FileDescription::try_create(*result.value());
if (description_result.is_error())
return description_result.error();
setup_socket_fd(socket_fd.fd, description_result.value(), type);
@@ -133,7 +133,7 @@ KResultOr<FlatPtr> Process::sys$accept4(Userspace<const Syscall::SC_accept4_para
return EFAULT;
}
- auto accepted_socket_description_result = FileDescription::create(*accepted_socket);
+ auto accepted_socket_description_result = FileDescription::try_create(*accepted_socket);
if (accepted_socket_description_result.is_error())
return accepted_socket_description_result.error();
diff --git a/Kernel/TTY/PTYMultiplexer.cpp b/Kernel/TTY/PTYMultiplexer.cpp
index d786d74462..ebedf495c1 100644
--- a/Kernel/TTY/PTYMultiplexer.cpp
+++ b/Kernel/TTY/PTYMultiplexer.cpp
@@ -46,7 +46,7 @@ KResultOr<NonnullRefPtr<FileDescription>> PTYMultiplexer::open(int options)
if (!master)
return ENOMEM;
dbgln_if(PTMX_DEBUG, "PTYMultiplexer::open: Vending master {}", master->index());
- auto description = FileDescription::create(*master);
+ auto description = FileDescription::try_create(*master);
if (!description.is_error()) {
description.value()->set_rw_mode(options);
description.value()->set_file_flags(options);