mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 12:58:12 +00:00
AK: Rename adopt() to adopt_ref()
This makes it more symmetrical with adopt_own() (which is used to create a NonnullOwnPtr from the result of a naked new.)
This commit is contained in:
parent
b3db01e20e
commit
b91c49364d
228 changed files with 461 additions and 461 deletions
|
@ -14,7 +14,7 @@ class AnonymousFile final : public File {
|
|||
public:
|
||||
static NonnullRefPtr<AnonymousFile> create(NonnullRefPtr<AnonymousVMObject> vmobject)
|
||||
{
|
||||
return adopt(*new AnonymousFile(move(vmobject)));
|
||||
return adopt_ref(*new AnonymousFile(move(vmobject)));
|
||||
}
|
||||
|
||||
virtual ~AnonymousFile() override;
|
||||
|
|
|
@ -21,7 +21,7 @@ class Custody : public RefCounted<Custody> {
|
|||
public:
|
||||
static NonnullRefPtr<Custody> create(Custody* parent, const StringView& name, Inode& inode, int mount_flags)
|
||||
{
|
||||
return adopt(*new Custody(parent, name, inode, mount_flags));
|
||||
return adopt_ref(*new Custody(parent, name, inode, mount_flags));
|
||||
}
|
||||
|
||||
~Custody();
|
||||
|
|
|
@ -14,11 +14,11 @@ namespace Kernel {
|
|||
|
||||
NonnullRefPtr<DevFS> DevFS::create()
|
||||
{
|
||||
return adopt(*new DevFS);
|
||||
return adopt_ref(*new DevFS);
|
||||
}
|
||||
|
||||
DevFS::DevFS()
|
||||
: m_root_inode(adopt(*new DevFSRootDirectoryInode(*this)))
|
||||
: m_root_inode(adopt_ref(*new DevFSRootDirectoryInode(*this)))
|
||||
{
|
||||
LOCKER(m_lock);
|
||||
Device::for_each([&](Device& device) {
|
||||
|
@ -32,7 +32,7 @@ DevFS::DevFS()
|
|||
void DevFS::notify_new_device(Device& device)
|
||||
{
|
||||
LOCKER(m_lock);
|
||||
auto new_device_inode = adopt(*new DevFSDeviceInode(*this, device));
|
||||
auto new_device_inode = adopt_ref(*new DevFSDeviceInode(*this, device));
|
||||
m_nodes.append(new_device_inode);
|
||||
m_root_inode->m_devices.append(new_device_inode);
|
||||
}
|
||||
|
@ -274,7 +274,7 @@ KResultOr<NonnullRefPtr<Inode>> DevFSRootDirectoryInode::create_child(const Stri
|
|||
}
|
||||
if (name != "pts")
|
||||
return EROFS;
|
||||
auto new_directory_inode = adopt(*new DevFSPtsDirectoryInode(m_parent_fs));
|
||||
auto new_directory_inode = adopt_ref(*new DevFSPtsDirectoryInode(m_parent_fs));
|
||||
m_subfolders.append(new_directory_inode);
|
||||
m_parent_fs.m_nodes.append(new_directory_inode);
|
||||
return KResult(KSuccess);
|
||||
|
@ -284,7 +284,7 @@ KResultOr<NonnullRefPtr<Inode>> DevFSRootDirectoryInode::create_child(const Stri
|
|||
if (link.name() == name)
|
||||
return EEXIST;
|
||||
}
|
||||
auto new_link_inode = adopt(*new DevFSLinkInode(m_parent_fs, name));
|
||||
auto new_link_inode = adopt_ref(*new DevFSLinkInode(m_parent_fs, name));
|
||||
m_links.append(new_link_inode);
|
||||
m_parent_fs.m_nodes.append(new_link_inode);
|
||||
return new_link_inode;
|
||||
|
|
|
@ -15,7 +15,7 @@ namespace Kernel {
|
|||
|
||||
NonnullRefPtr<DevPtsFS> DevPtsFS::create()
|
||||
{
|
||||
return adopt(*new DevPtsFS);
|
||||
return adopt_ref(*new DevPtsFS);
|
||||
}
|
||||
|
||||
DevPtsFS::DevPtsFS()
|
||||
|
@ -30,7 +30,7 @@ static AK::Singleton<HashTable<unsigned>> s_ptys;
|
|||
|
||||
bool DevPtsFS::initialize()
|
||||
{
|
||||
m_root_inode = adopt(*new DevPtsFSInode(*this, 1, nullptr));
|
||||
m_root_inode = adopt_ref(*new DevPtsFSInode(*this, 1, nullptr));
|
||||
m_root_inode->m_metadata.inode = { fsid(), 1 };
|
||||
m_root_inode->m_metadata.mode = 0040555;
|
||||
m_root_inode->m_metadata.uid = 0;
|
||||
|
@ -66,7 +66,7 @@ RefPtr<Inode> DevPtsFS::get_inode(InodeIdentifier inode_id) const
|
|||
auto* device = Device::get_device(201, pty_index);
|
||||
VERIFY(device);
|
||||
|
||||
auto inode = adopt(*new DevPtsFSInode(const_cast<DevPtsFS&>(*this), inode_id.index(), static_cast<SlavePTY*>(device)));
|
||||
auto inode = adopt_ref(*new DevPtsFSInode(const_cast<DevPtsFS&>(*this), inode_id.index(), static_cast<SlavePTY*>(device)));
|
||||
inode->m_metadata.inode = inode_id;
|
||||
inode->m_metadata.size = 0;
|
||||
inode->m_metadata.uid = device->uid();
|
||||
|
|
|
@ -55,7 +55,7 @@ static unsigned divide_rounded_up(unsigned a, unsigned b)
|
|||
|
||||
NonnullRefPtr<Ext2FS> Ext2FS::create(FileDescription& file_description)
|
||||
{
|
||||
return adopt(*new Ext2FS(file_description));
|
||||
return adopt_ref(*new Ext2FS(file_description));
|
||||
}
|
||||
|
||||
Ext2FS::Ext2FS(FileDescription& file_description)
|
||||
|
@ -797,7 +797,7 @@ RefPtr<Inode> Ext2FS::get_inode(InodeIdentifier inode) const
|
|||
if (!find_block_containing_inode(inode.index(), block_index, offset))
|
||||
return {};
|
||||
|
||||
auto new_inode = adopt(*new Ext2FSInode(const_cast<Ext2FS&>(*this), inode.index()));
|
||||
auto new_inode = adopt_ref(*new Ext2FSInode(const_cast<Ext2FS&>(*this), inode.index()));
|
||||
auto buffer = UserOrKernelBuffer::for_kernel_buffer(reinterpret_cast<u8*>(&new_inode->m_raw_inode));
|
||||
if (auto result = read_block(block_index, &buffer, sizeof(ext2_inode), offset); result.is_error()) {
|
||||
// FIXME: Propagate the actual error.
|
||||
|
|
|
@ -27,7 +27,7 @@ static int s_next_fifo_id = 1;
|
|||
|
||||
NonnullRefPtr<FIFO> FIFO::create(uid_t uid)
|
||||
{
|
||||
return adopt(*new FIFO(uid));
|
||||
return adopt_ref(*new FIFO(uid));
|
||||
}
|
||||
|
||||
KResultOr<NonnullRefPtr<FileDescription>> FIFO::open_direction(FIFO::Direction direction)
|
||||
|
|
|
@ -25,7 +25,7 @@ namespace Kernel {
|
|||
|
||||
KResultOr<NonnullRefPtr<FileDescription>> FileDescription::create(Custody& custody)
|
||||
{
|
||||
auto description = adopt(*new FileDescription(InodeFile::create(custody.inode())));
|
||||
auto description = adopt_ref(*new FileDescription(InodeFile::create(custody.inode())));
|
||||
description->m_custody = custody;
|
||||
auto result = description->attach();
|
||||
if (result.is_error()) {
|
||||
|
@ -37,7 +37,7 @@ KResultOr<NonnullRefPtr<FileDescription>> FileDescription::create(Custody& custo
|
|||
|
||||
KResultOr<NonnullRefPtr<FileDescription>> FileDescription::create(File& file)
|
||||
{
|
||||
auto description = adopt(*new FileDescription(file));
|
||||
auto description = adopt_ref(*new FileDescription(file));
|
||||
auto result = description->attach();
|
||||
if (result.is_error()) {
|
||||
dbgln_if(FILEDESCRIPTION_DEBUG, "Failed to create file description for file: {}", result);
|
||||
|
|
|
@ -16,7 +16,7 @@ class InodeFile final : public File {
|
|||
public:
|
||||
static NonnullRefPtr<InodeFile> create(NonnullRefPtr<Inode>&& inode)
|
||||
{
|
||||
return adopt(*new InodeFile(move(inode)));
|
||||
return adopt_ref(*new InodeFile(move(inode)));
|
||||
}
|
||||
|
||||
virtual ~InodeFile() override;
|
||||
|
|
|
@ -12,7 +12,7 @@ namespace Kernel {
|
|||
|
||||
NonnullRefPtr<InodeWatcher> InodeWatcher::create(Inode& inode)
|
||||
{
|
||||
return adopt(*new InodeWatcher(inode));
|
||||
return adopt_ref(*new InodeWatcher(inode));
|
||||
}
|
||||
|
||||
InodeWatcher::InodeWatcher(Inode& inode)
|
||||
|
|
|
@ -11,7 +11,7 @@ namespace Kernel {
|
|||
|
||||
NonnullRefPtr<Plan9FS> Plan9FS::create(FileDescription& file_description)
|
||||
{
|
||||
return adopt(*new Plan9FS(file_description));
|
||||
return adopt_ref(*new Plan9FS(file_description));
|
||||
}
|
||||
|
||||
Plan9FS::Plan9FS(FileDescription& file_description)
|
||||
|
@ -597,7 +597,7 @@ KResult Plan9FS::post_message_and_wait_for_a_reply(Message& message)
|
|||
{
|
||||
auto request_type = message.type();
|
||||
auto tag = message.tag();
|
||||
auto completion = adopt(*new ReceiveCompletion(tag));
|
||||
auto completion = adopt_ref(*new ReceiveCompletion(tag));
|
||||
auto result = post_message(message, completion);
|
||||
if (result.is_error())
|
||||
return result;
|
||||
|
@ -680,7 +680,7 @@ Plan9FSInode::Plan9FSInode(Plan9FS& fs, u32 fid)
|
|||
|
||||
NonnullRefPtr<Plan9FSInode> Plan9FSInode::create(Plan9FS& fs, u32 fid)
|
||||
{
|
||||
return adopt(*new Plan9FSInode(fs, fid));
|
||||
return adopt_ref(*new Plan9FSInode(fs, fid));
|
||||
}
|
||||
|
||||
Plan9FSInode::~Plan9FSInode()
|
||||
|
|
|
@ -237,7 +237,7 @@ struct ProcFSInodeData : public FileDescriptionData {
|
|||
|
||||
NonnullRefPtr<ProcFS> ProcFS::create()
|
||||
{
|
||||
return adopt(*new ProcFS);
|
||||
return adopt_ref(*new ProcFS);
|
||||
}
|
||||
|
||||
ProcFS::~ProcFS()
|
||||
|
@ -1018,10 +1018,10 @@ RefPtr<Inode> ProcFS::get_inode(InodeIdentifier inode_id) const
|
|||
// and if that fails we cannot return this instance anymore and just
|
||||
// create a new one.
|
||||
if (it->value->try_ref())
|
||||
return adopt(*it->value);
|
||||
return adopt_ref(*it->value);
|
||||
// We couldn't ref it, so just create a new one and replace the entry
|
||||
}
|
||||
auto inode = adopt(*new ProcFSInode(const_cast<ProcFS&>(*this), inode_id.index()));
|
||||
auto inode = adopt_ref(*new ProcFSInode(const_cast<ProcFS&>(*this), inode_id.index()));
|
||||
auto result = m_inodes.set(inode_id.index().value(), inode.ptr());
|
||||
VERIFY(result == ((it == m_inodes.end()) ? AK::HashSetResult::InsertedNewEntry : AK::HashSetResult::ReplacedExistingEntry));
|
||||
return inode;
|
||||
|
@ -1677,7 +1677,7 @@ KResult ProcFSInode::chmod(mode_t)
|
|||
|
||||
ProcFS::ProcFS()
|
||||
{
|
||||
m_root_inode = adopt(*new ProcFSInode(*this, 1));
|
||||
m_root_inode = adopt_ref(*new ProcFSInode(*this, 1));
|
||||
m_entries.resize(FI_MaxStaticFileIndex);
|
||||
m_entries[FI_Root_df] = { "df", FI_Root_df, false, procfs$df };
|
||||
m_entries[FI_Root_all] = { "all", FI_Root_all, false, procfs$all };
|
||||
|
|
|
@ -132,7 +132,7 @@ private:
|
|||
ProcFSProxyInode(ProcFS&, FileDescription&);
|
||||
static NonnullRefPtr<ProcFSProxyInode> create(ProcFS& fs, FileDescription& fd)
|
||||
{
|
||||
return adopt(*new ProcFSProxyInode(fs, fd));
|
||||
return adopt_ref(*new ProcFSProxyInode(fs, fd));
|
||||
}
|
||||
|
||||
NonnullRefPtr<FileDescription> m_fd;
|
||||
|
|
|
@ -13,7 +13,7 @@ namespace Kernel {
|
|||
|
||||
NonnullRefPtr<TmpFS> TmpFS::create()
|
||||
{
|
||||
return adopt(*new TmpFS);
|
||||
return adopt_ref(*new TmpFS);
|
||||
}
|
||||
|
||||
TmpFS::TmpFS()
|
||||
|
@ -86,7 +86,7 @@ TmpFSInode::~TmpFSInode()
|
|||
|
||||
NonnullRefPtr<TmpFSInode> TmpFSInode::create(TmpFS& fs, InodeMetadata metadata, InodeIdentifier parent)
|
||||
{
|
||||
auto inode = adopt(*new TmpFSInode(fs, metadata, parent));
|
||||
auto inode = adopt_ref(*new TmpFSInode(fs, metadata, parent));
|
||||
fs.register_inode(inode);
|
||||
return inode;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue