mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 07:37:46 +00:00
Convert more RetainPtr use to Retained.
This commit is contained in:
parent
2cfcbdc735
commit
15fb917f28
16 changed files with 41 additions and 56 deletions
|
@ -1216,14 +1216,14 @@ RetainPtr<Inode> Ext2FSInode::parent() const
|
|||
unsigned group_index = fs().group_index_from_inode(index());
|
||||
unsigned first_inode_in_group = fs().inodes_per_group() * (group_index - 1);
|
||||
|
||||
Vector<RetainPtr<Ext2FSInode>> directories_in_group;
|
||||
Vector<Retained<Ext2FSInode>> directories_in_group;
|
||||
|
||||
for (unsigned i = 0; i < fs().inodes_per_group(); ++i) {
|
||||
auto group_member = fs().get_inode({ fsid(), first_inode_in_group + i });
|
||||
if (!group_member)
|
||||
continue;
|
||||
if (group_member->is_directory())
|
||||
directories_in_group.append(move(group_member));
|
||||
directories_in_group.append(*group_member);
|
||||
}
|
||||
|
||||
for (auto& directory : directories_in_group) {
|
||||
|
|
|
@ -596,7 +596,7 @@ bool MemoryManager::validate_user_write(const Process& process, LinearAddress la
|
|||
return region && region->is_writable();
|
||||
}
|
||||
|
||||
RetainPtr<Region> Region::clone()
|
||||
Retained<Region> Region::clone()
|
||||
{
|
||||
if (m_shared || (m_readable && !m_writable)) {
|
||||
dbgprintf("%s<%u> Region::clone(): sharing %s (L%x)\n",
|
||||
|
@ -645,7 +645,7 @@ Region::Region(LinearAddress a, size_t s, RetainPtr<Inode>&& inode, String&& n,
|
|||
MM.register_region(*this);
|
||||
}
|
||||
|
||||
Region::Region(LinearAddress a, size_t s, RetainPtr<VMObject>&& vmo, size_t offset_in_vmo, String&& n, bool r, bool w, bool cow)
|
||||
Region::Region(LinearAddress a, size_t s, Retained<VMObject>&& vmo, size_t offset_in_vmo, String&& n, bool r, bool w, bool cow)
|
||||
: m_laddr(a)
|
||||
, m_size(s)
|
||||
, m_offset_in_vmo(offset_in_vmo)
|
||||
|
|
|
@ -134,7 +134,7 @@ class Region : public Retainable<Region> {
|
|||
friend class MemoryManager;
|
||||
public:
|
||||
Region(LinearAddress, size_t, String&&, bool r, bool w, bool cow = false);
|
||||
Region(LinearAddress, size_t, RetainPtr<VMObject>&&, size_t offset_in_vmo, String&&, bool r, bool w, bool cow = false);
|
||||
Region(LinearAddress, size_t, Retained<VMObject>&&, size_t offset_in_vmo, String&&, bool r, bool w, bool cow = false);
|
||||
Region(LinearAddress, size_t, RetainPtr<Inode>&&, String&&, bool r, bool w);
|
||||
~Region();
|
||||
|
||||
|
@ -155,7 +155,7 @@ public:
|
|||
bool is_bitmap() const { return m_is_bitmap; }
|
||||
void set_is_bitmap(bool b) { m_is_bitmap = b; }
|
||||
|
||||
RetainPtr<Region> clone();
|
||||
Retained<Region> clone();
|
||||
bool contains(LinearAddress laddr) const
|
||||
{
|
||||
return laddr >= m_laddr && laddr < m_laddr.offset(size());
|
||||
|
@ -208,7 +208,7 @@ private:
|
|||
LinearAddress m_laddr;
|
||||
size_t m_size { 0 };
|
||||
size_t m_offset_in_vmo { 0 };
|
||||
RetainPtr<VMObject> m_vmo;
|
||||
Retained<VMObject> m_vmo;
|
||||
String m_name;
|
||||
bool m_readable { true };
|
||||
bool m_writable { true };
|
||||
|
@ -388,8 +388,8 @@ private:
|
|||
|
||||
LinearAddress m_quickmap_addr;
|
||||
|
||||
Vector<RetainPtr<PhysicalPage>> m_free_physical_pages;
|
||||
Vector<RetainPtr<PhysicalPage>> m_free_supervisor_physical_pages;
|
||||
Vector<Retained<PhysicalPage>> m_free_physical_pages;
|
||||
Vector<Retained<PhysicalPage>> m_free_supervisor_physical_pages;
|
||||
|
||||
HashTable<VMObject*> m_vmos;
|
||||
HashTable<Region*> m_regions;
|
||||
|
|
|
@ -102,9 +102,8 @@ Region* Process::allocate_file_backed_region(LinearAddress laddr, size_t size, R
|
|||
return m_regions.last().ptr();
|
||||
}
|
||||
|
||||
Region* Process::allocate_region_with_vmo(LinearAddress laddr, size_t size, RetainPtr<VMObject>&& vmo, size_t offset_in_vmo, String&& name, bool is_readable, bool is_writable)
|
||||
Region* Process::allocate_region_with_vmo(LinearAddress laddr, size_t size, Retained<VMObject>&& vmo, size_t offset_in_vmo, String&& name, bool is_readable, bool is_writable)
|
||||
{
|
||||
ASSERT(vmo);
|
||||
size = PAGE_ROUND_UP(size);
|
||||
// FIXME: This needs sanity checks. What if this overlaps existing regions?
|
||||
if (laddr.is_null()) {
|
||||
|
@ -2439,7 +2438,7 @@ struct SharedBuffer {
|
|||
unsigned m_pid2_retain_count { 0 };
|
||||
Region* m_pid1_region { nullptr };
|
||||
Region* m_pid2_region { nullptr };
|
||||
RetainPtr<VMObject> m_vmo;
|
||||
Retained<VMObject> m_vmo;
|
||||
};
|
||||
|
||||
static int s_next_shared_buffer_id;
|
||||
|
|
|
@ -237,7 +237,7 @@ public:
|
|||
void set_tty(TTY* tty) { m_tty = tty; }
|
||||
|
||||
size_t region_count() const { return m_regions.size(); }
|
||||
const Vector<RetainPtr<Region>>& regions() const { return m_regions; }
|
||||
const Vector<Retained<Region>>& regions() const { return m_regions; }
|
||||
void dump_regions();
|
||||
|
||||
void did_schedule() { ++m_times_scheduled; }
|
||||
|
@ -292,7 +292,7 @@ public:
|
|||
bool has_used_fpu() const { return m_has_used_fpu; }
|
||||
void set_has_used_fpu(bool b) { m_has_used_fpu = b; }
|
||||
|
||||
Region* allocate_region_with_vmo(LinearAddress, size_t, RetainPtr<VMObject>&&, size_t offset_in_vmo, String&& name, bool is_readable, bool is_writable);
|
||||
Region* allocate_region_with_vmo(LinearAddress, size_t, Retained<VMObject>&&, size_t offset_in_vmo, String&& name, bool is_readable, bool is_writable);
|
||||
Region* allocate_file_backed_region(LinearAddress, size_t, RetainPtr<Inode>&&, String&& name, bool is_readable, bool is_writable);
|
||||
Region* allocate_region(LinearAddress, size_t, String&& name, bool is_readable = true, bool is_writable = true, bool commit = true);
|
||||
bool deallocate_region(Region& region);
|
||||
|
@ -371,7 +371,7 @@ private:
|
|||
|
||||
Region* region_from_range(LinearAddress, size_t);
|
||||
|
||||
Vector<RetainPtr<Region>> m_regions;
|
||||
Vector<Retained<Region>> m_regions;
|
||||
|
||||
// FIXME: Implement some kind of ASLR?
|
||||
LinearAddress m_next_region;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue