mirror of
https://github.com/SerenityOS/serenity
synced 2024-09-06 17:06:31 +00:00
Kernel: Mark a bunch of NonnullRefPtrs also const to ensure immutability
These were easy to pick-up as these pointers are assigned during the construction point and are never changed afterwards. This small change to these pointers will ensure that our code will not accidentally assign these pointers with a new object which is always a kind of bug we will want to prevent.
This commit is contained in:
parent
e1f5aae632
commit
7b745a20f1
|
@ -38,7 +38,7 @@ protected:
|
|||
explicit Device(DeviceIdentifier const& pci_identifier);
|
||||
|
||||
private:
|
||||
NonnullRefPtr<DeviceIdentifier const> m_pci_identifier;
|
||||
NonnullRefPtr<DeviceIdentifier const> const m_pci_identifier;
|
||||
};
|
||||
|
||||
template<typename... Parameters>
|
||||
|
|
|
@ -80,7 +80,7 @@ private:
|
|||
ErrorOr<void> create_notes_metadata_data(auto&) const;
|
||||
|
||||
NonnullRefPtr<Process> const m_process;
|
||||
NonnullRefPtr<OpenFileDescription> m_description;
|
||||
NonnullRefPtr<OpenFileDescription> const m_description;
|
||||
size_t m_num_program_headers { 0 };
|
||||
Vector<FlatRegionData> m_regions;
|
||||
};
|
||||
|
|
|
@ -37,7 +37,7 @@ private:
|
|||
|
||||
RefPtr<Custody> m_parent;
|
||||
NonnullOwnPtr<KString> m_name;
|
||||
NonnullRefPtr<Inode> m_inode;
|
||||
NonnullRefPtr<Inode> const m_inode;
|
||||
int m_mount_flags { 0 };
|
||||
|
||||
mutable IntrusiveListNode<Custody> m_all_custodies_list_node;
|
||||
|
|
|
@ -38,6 +38,6 @@ private:
|
|||
virtual bool is_file_backed() const override { return true; }
|
||||
|
||||
IntrusiveListNode<FileBackedFileSystem> m_file_backed_file_system_node;
|
||||
NonnullRefPtr<OpenFileDescription> m_file_description;
|
||||
NonnullRefPtr<OpenFileDescription> const m_file_description;
|
||||
};
|
||||
}
|
||||
|
|
|
@ -52,7 +52,7 @@ private:
|
|||
virtual bool is_regular_file() const override;
|
||||
|
||||
explicit InodeFile(NonnullRefPtr<Inode>);
|
||||
NonnullRefPtr<Inode> m_inode;
|
||||
NonnullRefPtr<Inode> const m_inode;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -141,7 +141,7 @@ private:
|
|||
}
|
||||
|
||||
RefPtr<Inode> m_inode;
|
||||
NonnullRefPtr<File> m_file;
|
||||
NonnullRefPtr<File> const m_file;
|
||||
|
||||
struct State {
|
||||
OwnPtr<OpenFileDescriptionData> data;
|
||||
|
|
|
@ -23,7 +23,7 @@ public:
|
|||
private:
|
||||
PCIDeviceSysFSDirectory(NonnullOwnPtr<KString> device_directory_name, SysFSDirectory const&, PCI::DeviceIdentifier const&);
|
||||
|
||||
NonnullRefPtr<PCI::DeviceIdentifier const> m_device_identifier;
|
||||
NonnullRefPtr<PCI::DeviceIdentifier const> const m_device_identifier;
|
||||
|
||||
NonnullOwnPtr<KString> m_device_directory_name;
|
||||
};
|
||||
|
|
|
@ -52,7 +52,7 @@ public:
|
|||
using List = IntrusiveListRelaxedConst<&Jail::m_list_node>;
|
||||
|
||||
private:
|
||||
NonnullRefPtr<ProcessList> m_process_list;
|
||||
NonnullRefPtr<ProcessList> const m_process_list;
|
||||
|
||||
SpinlockProtected<size_t, LockRank::None> m_attach_count { 0 };
|
||||
};
|
||||
|
|
|
@ -37,7 +37,7 @@ protected:
|
|||
|
||||
virtual bool is_inode() const final { return true; }
|
||||
|
||||
NonnullRefPtr<Inode> m_inode;
|
||||
NonnullRefPtr<Inode> const m_inode;
|
||||
Bitmap m_dirty_pages;
|
||||
};
|
||||
|
||||
|
|
|
@ -123,7 +123,7 @@ private:
|
|||
// it's probably better to just "cache" this here instead.
|
||||
AHCI::HBADefinedCapabilities const m_hba_capabilities;
|
||||
|
||||
NonnullRefPtr<Memory::PhysicalPage> m_identify_buffer_page;
|
||||
NonnullRefPtr<Memory::PhysicalPage> const m_identify_buffer_page;
|
||||
|
||||
volatile AHCI::PortRegisters& m_port_registers;
|
||||
LockWeakPtr<AHCIController> m_parent_controller;
|
||||
|
|
|
@ -97,6 +97,6 @@ private:
|
|||
Span<NVMeCompletion> m_cqe_array;
|
||||
WaitQueue m_sync_wait_queue;
|
||||
Memory::TypedMapping<DoorbellRegister volatile> m_db_regs;
|
||||
NonnullRefPtr<Memory::PhysicalPage const> m_rw_dma_page;
|
||||
NonnullRefPtr<Memory::PhysicalPage const> const m_rw_dma_page;
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue