1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 11:28:12 +00:00

Kernel: Robustify and rename Inode bound socket API

Rename the bound socket accessor from socket() to bound_socket().
Also return RefPtr<LocalSocket> instead of a raw pointer, to make it
harder for callers to mess up.
This commit is contained in:
Andreas Kling 2022-02-07 12:57:57 +01:00
parent 4bfed6a5ed
commit cda56f8049
4 changed files with 16 additions and 10 deletions

View file

@ -66,8 +66,7 @@ public:
virtual ErrorOr<int> get_block_address(int) { return ENOTSUP; }
LocalSocket* socket() { return m_socket.ptr(); }
const LocalSocket* socket() const { return m_socket.ptr(); }
RefPtr<LocalSocket> bound_socket() const;
bool bind_socket(LocalSocket&);
bool unbind_socket();
@ -117,7 +116,7 @@ private:
FileSystem& m_file_system;
InodeIndex m_index { 0 };
WeakPtr<Memory::SharedInodeVMObject> m_shared_vmobject;
RefPtr<LocalSocket> m_socket;
RefPtr<LocalSocket> m_bound_socket;
SpinlockProtected<HashTable<InodeWatcher*>> m_watchers;
bool m_metadata_dirty { false };
RefPtr<FIFO> m_fifo;