summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Kernel/Devices/DiskPartition.cpp4
-rw-r--r--Kernel/Devices/DiskPartition.h4
-rw-r--r--Kernel/Devices/MBRPartitionTable.cpp4
-rw-r--r--Kernel/Devices/MBRPartitionTable.h2
-rw-r--r--Kernel/FileSystem/Ext2FileSystem.cpp4
-rw-r--r--Kernel/FileSystem/Ext2FileSystem.h2
-rw-r--r--Kernel/FileSystem/FileDescription.cpp8
-rw-r--r--Kernel/FileSystem/FileDescription.h2
-rw-r--r--Kernel/Process.cpp18
-rw-r--r--Kernel/Process.h4
-rw-r--r--Kernel/VM/MemoryManager.cpp2
-rw-r--r--Kernel/VM/Region.cpp4
-rw-r--r--Kernel/VM/Region.h2
-rw-r--r--Kernel/init.cpp8
14 files changed, 34 insertions, 34 deletions
diff --git a/Kernel/Devices/DiskPartition.cpp b/Kernel/Devices/DiskPartition.cpp
index ec0db9275e..94921c8407 100644
--- a/Kernel/Devices/DiskPartition.cpp
+++ b/Kernel/Devices/DiskPartition.cpp
@@ -2,12 +2,12 @@
// #define OFFD_DEBUG
-NonnullRefPtr<DiskPartition> DiskPartition::create(NonnullRefPtr<DiskDevice>&& device, unsigned block_offset)
+NonnullRefPtr<DiskPartition> DiskPartition::create(NonnullRefPtr<DiskDevice> device, unsigned block_offset)
{
return adopt(*new DiskPartition(move(device), block_offset));
}
-DiskPartition::DiskPartition(NonnullRefPtr<DiskDevice>&& device, unsigned block_offset)
+DiskPartition::DiskPartition(NonnullRefPtr<DiskDevice> device, unsigned block_offset)
: m_device(move(device))
, m_block_offset(block_offset)
{
diff --git a/Kernel/Devices/DiskPartition.h b/Kernel/Devices/DiskPartition.h
index 36eea5a7eb..f4e83697c5 100644
--- a/Kernel/Devices/DiskPartition.h
+++ b/Kernel/Devices/DiskPartition.h
@@ -5,7 +5,7 @@
class DiskPartition final : public DiskDevice {
public:
- static NonnullRefPtr<DiskPartition> create(NonnullRefPtr<DiskDevice>&& device, unsigned block_offset);
+ static NonnullRefPtr<DiskPartition> create(NonnullRefPtr<DiskDevice>, unsigned block_offset);
virtual ~DiskPartition();
virtual unsigned block_size() const override;
@@ -17,7 +17,7 @@ public:
private:
virtual const char* class_name() const override;
- DiskPartition(NonnullRefPtr<DiskDevice>&&, unsigned);
+ DiskPartition(NonnullRefPtr<DiskDevice>, unsigned block_offset);
NonnullRefPtr<DiskDevice> m_device;
unsigned m_block_offset;
diff --git a/Kernel/Devices/MBRPartitionTable.cpp b/Kernel/Devices/MBRPartitionTable.cpp
index 2d4f733c93..72ebe9e906 100644
--- a/Kernel/Devices/MBRPartitionTable.cpp
+++ b/Kernel/Devices/MBRPartitionTable.cpp
@@ -3,7 +3,7 @@
#define MBR_DEBUG
-MBRPartitionTable::MBRPartitionTable(NonnullRefPtr<DiskDevice>&& device)
+MBRPartitionTable::MBRPartitionTable(NonnullRefPtr<DiskDevice> device)
: m_device(move(device))
{
}
@@ -65,5 +65,5 @@ RefPtr<DiskPartition> MBRPartitionTable::partition(unsigned index)
kprintf("MBRPartitionTable::partition: found partition index=%d type=%x\n", index, entry.type);
#endif
- return DiskPartition::create(m_device.copy_ref(), entry.offset);
+ return DiskPartition::create(m_device, entry.offset);
}
diff --git a/Kernel/Devices/MBRPartitionTable.h b/Kernel/Devices/MBRPartitionTable.h
index e6f7962343..35bb13db36 100644
--- a/Kernel/Devices/MBRPartitionTable.h
+++ b/Kernel/Devices/MBRPartitionTable.h
@@ -31,7 +31,7 @@ class MBRPartitionTable {
AK_MAKE_ETERNAL
public:
- MBRPartitionTable(NonnullRefPtr<DiskDevice>&& device);
+ MBRPartitionTable(NonnullRefPtr<DiskDevice>);
~MBRPartitionTable();
bool initialize();
diff --git a/Kernel/FileSystem/Ext2FileSystem.cpp b/Kernel/FileSystem/Ext2FileSystem.cpp
index e357baad5b..c16e43c575 100644
--- a/Kernel/FileSystem/Ext2FileSystem.cpp
+++ b/Kernel/FileSystem/Ext2FileSystem.cpp
@@ -31,7 +31,7 @@ static u8 to_ext2_file_type(mode_t mode)
return EXT2_FT_UNKNOWN;
}
-NonnullRefPtr<Ext2FS> Ext2FS::create(NonnullRefPtr<DiskDevice>&& device)
+NonnullRefPtr<Ext2FS> Ext2FS::create(NonnullRefPtr<DiskDevice> device)
{
return adopt(*new Ext2FS(move(device)));
}
@@ -475,7 +475,7 @@ RefPtr<Inode> Ext2FS::get_inode(InodeIdentifier inode) const
return (*it).value;
auto new_inode = adopt(*new Ext2FSInode(const_cast<Ext2FS&>(*this), inode.index()));
memcpy(&new_inode->m_raw_inode, reinterpret_cast<ext2_inode*>(block.offset_pointer(offset)), sizeof(ext2_inode));
- m_inode_cache.set(inode.index(), new_inode.copy_ref());
+ m_inode_cache.set(inode.index(), new_inode);
return new_inode;
}
diff --git a/Kernel/FileSystem/Ext2FileSystem.h b/Kernel/FileSystem/Ext2FileSystem.h
index e8a1f48feb..43b184b84e 100644
--- a/Kernel/FileSystem/Ext2FileSystem.h
+++ b/Kernel/FileSystem/Ext2FileSystem.h
@@ -60,7 +60,7 @@ class Ext2FS final : public DiskBackedFS {
friend class Ext2FSInode;
public:
- static NonnullRefPtr<Ext2FS> create(NonnullRefPtr<DiskDevice>&&);
+ static NonnullRefPtr<Ext2FS> create(NonnullRefPtr<DiskDevice>);
virtual ~Ext2FS() override;
virtual bool initialize() override;
diff --git a/Kernel/FileSystem/FileDescription.cpp b/Kernel/FileSystem/FileDescription.cpp
index 8d15d04b83..a8a35faf35 100644
--- a/Kernel/FileSystem/FileDescription.cpp
+++ b/Kernel/FileSystem/FileDescription.cpp
@@ -22,7 +22,7 @@ NonnullRefPtr<FileDescription> FileDescription::create(RefPtr<Custody>&& custody
return description;
}
-NonnullRefPtr<FileDescription> FileDescription::create(RefPtr<File>&& file, SocketRole role)
+NonnullRefPtr<FileDescription> FileDescription::create(RefPtr<File> file, SocketRole role)
{
return adopt(*new FileDescription(move(file), role));
}
@@ -64,9 +64,9 @@ NonnullRefPtr<FileDescription> FileDescription::clone()
if (is_fifo()) {
description = fifo()->open_direction(m_fifo_direction);
} else {
- description = FileDescription::create(m_file.copy_ref(), m_socket_role);
- description->m_custody = m_custody.copy_ref();
- description->m_inode = m_inode.copy_ref();
+ description = FileDescription::create(m_file, m_socket_role);
+ description->m_custody = m_custody;
+ description->m_inode = m_inode;
}
ASSERT(description);
description->m_current_offset = m_current_offset;
diff --git a/Kernel/FileSystem/FileDescription.h b/Kernel/FileSystem/FileDescription.h
index fb536ed3aa..6ef4309dec 100644
--- a/Kernel/FileSystem/FileDescription.h
+++ b/Kernel/FileSystem/FileDescription.h
@@ -22,7 +22,7 @@ class SharedMemory;
class FileDescription : public RefCounted<FileDescription> {
public:
static NonnullRefPtr<FileDescription> create(RefPtr<Custody>&&);
- static NonnullRefPtr<FileDescription> create(RefPtr<File>&&, SocketRole = SocketRole::None);
+ static NonnullRefPtr<FileDescription> create(RefPtr<File>, SocketRole = SocketRole::None);
~FileDescription();
NonnullRefPtr<FileDescription> clone();
diff --git a/Kernel/Process.cpp b/Kernel/Process.cpp
index 30ba9844a8..7f0581a63c 100644
--- a/Kernel/Process.cpp
+++ b/Kernel/Process.cpp
@@ -115,7 +115,7 @@ Region* Process::allocate_file_backed_region(VirtualAddress vaddr, size_t size,
return &m_regions.last();
}
-Region* Process::allocate_region_with_vmo(VirtualAddress vaddr, size_t size, NonnullRefPtr<VMObject>&& vmo, size_t offset_in_vmo, const String& name, int prot)
+Region* Process::allocate_region_with_vmo(VirtualAddress vaddr, size_t size, NonnullRefPtr<VMObject> vmo, size_t offset_in_vmo, const String& name, int prot)
{
auto range = allocate_range(vaddr, size);
if (!range.is_valid())
@@ -229,7 +229,7 @@ int Process::sys$gethostname(char* buffer, ssize_t size)
Process* Process::fork(RegisterDump& regs)
{
- auto* child = new Process(String(m_name), m_uid, m_gid, m_pid, m_ring, m_cwd.copy_ref(), m_executable.copy_ref(), m_tty, this);
+ auto* child = new Process(String(m_name), m_uid, m_gid, m_pid, m_ring, m_cwd, m_executable, m_tty, this);
if (!child)
return nullptr;
@@ -334,7 +334,7 @@ int Process::do_exec(String path, Vector<String> arguments, Vector<String> envir
auto vmo = VMObject::create_file_backed(description->inode());
vmo->set_name(description->absolute_path());
- RefPtr<Region> region = allocate_region_with_vmo(VirtualAddress(), metadata.size, vmo.copy_ref(), 0, vmo->name(), PROT_READ);
+ RefPtr<Region> region = allocate_region_with_vmo(VirtualAddress(), metadata.size, vmo, 0, vmo->name(), PROT_READ);
ASSERT(region);
if (this != &current->process()) {
@@ -358,7 +358,7 @@ int Process::do_exec(String path, Vector<String> arguments, Vector<String> envir
prot |= PROT_WRITE;
if (is_executable)
prot |= PROT_EXEC;
- (void)allocate_region_with_vmo(vaddr, size, vmo.copy_ref(), offset_in_image, String(name), prot);
+ (void)allocate_region_with_vmo(vaddr, size, vmo, offset_in_image, String(name), prot);
return vaddr.as_ptr();
};
loader->alloc_section_hook = [&](VirtualAddress vaddr, size_t size, size_t alignment, bool is_readable, bool is_writable, const String& name) {
@@ -520,7 +520,7 @@ Process* Process::create_user_process(const String& path, uid_t uid, gid_t gid,
{
InterruptDisabler disabler;
if (auto* parent = Process::from_pid(parent_pid))
- cwd = parent->m_cwd.copy_ref();
+ cwd = parent->m_cwd;
}
if (!cwd)
@@ -562,7 +562,7 @@ Process* Process::create_kernel_process(String&& name, void (*e)())
return process;
}
-Process::Process(String&& name, uid_t uid, gid_t gid, pid_t ppid, RingLevel ring, RefPtr<Custody>&& cwd, RefPtr<Custody>&& executable, TTY* tty, Process* fork_parent)
+Process::Process(String&& name, uid_t uid, gid_t gid, pid_t ppid, RingLevel ring, RefPtr<Custody> cwd, RefPtr<Custody> executable, TTY* tty, Process* fork_parent)
: m_name(move(name))
, m_pid(next_pid++) // FIXME: RACE: This variable looks racy!
, m_uid(uid)
@@ -2370,14 +2370,14 @@ struct SharedBuffer {
if (m_pid1 == process.pid()) {
++m_pid1_retain_count;
if (!m_pid1_region) {
- m_pid1_region = process.allocate_region_with_vmo(VirtualAddress(), size(), m_vmo.copy_ref(), 0, "SharedBuffer", PROT_READ | (m_pid1_writable ? PROT_WRITE : 0));
+ m_pid1_region = process.allocate_region_with_vmo(VirtualAddress(), size(), m_vmo, 0, "SharedBuffer", PROT_READ | (m_pid1_writable ? PROT_WRITE : 0));
m_pid1_region->set_shared(true);
}
return m_pid1_region->vaddr().as_ptr();
} else if (m_pid2 == process.pid()) {
++m_pid2_retain_count;
if (!m_pid2_region) {
- m_pid2_region = process.allocate_region_with_vmo(VirtualAddress(), size(), m_vmo.copy_ref(), 0, "SharedBuffer", PROT_READ | (m_pid2_writable ? PROT_WRITE : 0));
+ m_pid2_region = process.allocate_region_with_vmo(VirtualAddress(), size(), m_vmo, 0, "SharedBuffer", PROT_READ | (m_pid2_writable ? PROT_WRITE : 0));
m_pid2_region->set_shared(true);
}
return m_pid2_region->vaddr().as_ptr();
@@ -2506,7 +2506,7 @@ int Process::sys$create_shared_buffer(pid_t peer_pid, int size, void** buffer)
auto shared_buffer = make<SharedBuffer>(m_pid, peer_pid, size);
shared_buffer->m_shared_buffer_id = shared_buffer_id;
ASSERT((int)shared_buffer->size() >= size);
- shared_buffer->m_pid1_region = allocate_region_with_vmo(VirtualAddress(), shared_buffer->size(), shared_buffer->m_vmo.copy_ref(), 0, "SharedBuffer", PROT_READ | PROT_WRITE);
+ shared_buffer->m_pid1_region = allocate_region_with_vmo(VirtualAddress(), shared_buffer->size(), shared_buffer->m_vmo, 0, "SharedBuffer", PROT_READ | PROT_WRITE);
shared_buffer->m_pid1_region->set_shared(true);
*buffer = shared_buffer->m_pid1_region->vaddr().as_ptr();
#ifdef SHARED_BUFFER_DEBUG
diff --git a/Kernel/Process.h b/Kernel/Process.h
index 59491f31cb..c12814a37c 100644
--- a/Kernel/Process.h
+++ b/Kernel/Process.h
@@ -249,7 +249,7 @@ public:
bool is_superuser() const { return m_euid == 0; }
- Region* allocate_region_with_vmo(VirtualAddress, size_t, NonnullRefPtr<VMObject>&&, size_t offset_in_vmo, const String& name, int prot);
+ Region* allocate_region_with_vmo(VirtualAddress, size_t, NonnullRefPtr<VMObject>, size_t offset_in_vmo, const String& name, int prot);
Region* allocate_file_backed_region(VirtualAddress, size_t, RefPtr<Inode>&&, const String& name, int prot);
Region* allocate_region(VirtualAddress, size_t, const String& name, int prot = PROT_READ | PROT_WRITE, bool commit = true);
bool deallocate_region(Region& region);
@@ -274,7 +274,7 @@ private:
friend class Scheduler;
friend class Region;
- Process(String&& name, uid_t, gid_t, pid_t ppid, RingLevel, RefPtr<Custody>&& cwd = nullptr, RefPtr<Custody>&& executable = nullptr, TTY* = nullptr, Process* fork_parent = nullptr);
+ Process(String&& name, uid_t, gid_t, pid_t ppid, RingLevel, RefPtr<Custody> cwd = nullptr, RefPtr<Custody> executable = nullptr, TTY* = nullptr, Process* fork_parent = nullptr);
Range allocate_range(VirtualAddress, size_t);
diff --git a/Kernel/VM/MemoryManager.cpp b/Kernel/VM/MemoryManager.cpp
index 954bb871d1..adccf9a7a7 100644
--- a/Kernel/VM/MemoryManager.cpp
+++ b/Kernel/VM/MemoryManager.cpp
@@ -155,7 +155,7 @@ RefPtr<PhysicalPage> MemoryManager::allocate_page_table(PageDirectory& page_dire
auto physical_page = allocate_supervisor_physical_page();
if (!physical_page)
return nullptr;
- page_directory.m_physical_pages.set(index, physical_page.copy_ref());
+ page_directory.m_physical_pages.set(index, physical_page);
return physical_page;
}
diff --git a/Kernel/VM/Region.cpp b/Kernel/VM/Region.cpp
index b18aa639cd..d0c8426239 100644
--- a/Kernel/VM/Region.cpp
+++ b/Kernel/VM/Region.cpp
@@ -25,7 +25,7 @@ Region::Region(const Range& range, RefPtr<Inode>&& inode, const String& name, u8
MM.register_region(*this);
}
-Region::Region(const Range& range, NonnullRefPtr<VMObject>&& vmo, size_t offset_in_vmo, const String& name, u8 access, bool cow)
+Region::Region(const Range& range, NonnullRefPtr<VMObject> vmo, size_t offset_in_vmo, const String& name, u8 access, bool cow)
: m_range(range)
, m_offset_in_vmo(offset_in_vmo)
, m_vmo(move(vmo))
@@ -78,7 +78,7 @@ NonnullRefPtr<Region> Region::clone()
vaddr().get());
#endif
// Create a new region backed by the same VMObject.
- return adopt(*new Region(m_range, m_vmo.copy_ref(), m_offset_in_vmo, String(m_name), m_access));
+ return adopt(*new Region(m_range, m_vmo, m_offset_in_vmo, String(m_name), m_access));
}
#ifdef MM_DEBUG
diff --git a/Kernel/VM/Region.h b/Kernel/VM/Region.h
index 3e9f02a490..c5c26d5c2c 100644
--- a/Kernel/VM/Region.h
+++ b/Kernel/VM/Region.h
@@ -19,7 +19,7 @@ public:
};
Region(const Range&, const String&, u8 access, bool cow = false);
- Region(const Range&, NonnullRefPtr<VMObject>&&, size_t offset_in_vmo, const String&, u8 access, bool cow = false);
+ Region(const Range&, NonnullRefPtr<VMObject>, size_t offset_in_vmo, const String&, u8 access, bool cow = false);
Region(const Range&, RefPtr<Inode>&&, const String&, u8 access);
~Region();
diff --git a/Kernel/init.cpp b/Kernel/init.cpp
index f68aaef4c3..e3e8eb2367 100644
--- a/Kernel/init.cpp
+++ b/Kernel/init.cpp
@@ -86,7 +86,7 @@ VFS* vfs;
auto dev_hd0 = IDEDiskDevice::create(IDEDiskDevice::DriveType::MASTER);
- NonnullRefPtr<DiskDevice> root_dev = dev_hd0.copy_ref();
+ NonnullRefPtr<DiskDevice> root_dev = dev_hd0;
root = root.substring(strlen("/dev/hda"), root.length() - strlen("/dev/hda"));
@@ -104,7 +104,7 @@ VFS* vfs;
hang();
}
- MBRPartitionTable mbr(root_dev.copy_ref());
+ MBRPartitionTable mbr(root_dev);
if (!mbr.initialize()) {
kprintf("init_stage2: couldn't read MBR from disk\n");
hang();
@@ -119,13 +119,13 @@ VFS* vfs;
root_dev = *partition;
}
- auto e2fs = Ext2FS::create(root_dev.copy_ref());
+ auto e2fs = Ext2FS::create(root_dev);
if (!e2fs->initialize()) {
kprintf("init_stage2: couldn't open root filesystem\n");
hang();
}
- vfs->mount_root(e2fs.copy_ref());
+ vfs->mount_root(e2fs);
dbgprintf("Load ksyms\n");
load_ksyms();