mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 09:48:11 +00:00
Kernel: Use DistinctNumeric for filesystem ID's
This patch adds the FileSystemID type, which is a distinct u32. This prevents accidental conversion from arbitrary integers.
This commit is contained in:
parent
7c57961c61
commit
e08d213830
18 changed files with 36 additions and 35 deletions
|
@ -41,7 +41,7 @@ ErrorOr<size_t> Process::procfs_get_thread_stack(ThreadID thread_id, KBufferBuil
|
|||
return 0;
|
||||
}
|
||||
|
||||
ErrorOr<void> Process::traverse_stacks_directory(unsigned fsid, Function<ErrorOr<void>(FileSystem::DirectoryEntryView const&)> callback) const
|
||||
ErrorOr<void> Process::traverse_stacks_directory(FileSystemID fsid, Function<ErrorOr<void>(FileSystem::DirectoryEntryView const&)> callback) const
|
||||
{
|
||||
TRY(callback({ ".", { fsid, SegmentedProcFSIndex::build_segmented_index_for_main_property(pid(), SegmentedProcFSIndex::ProcessSubDirectory::Stacks, SegmentedProcFSIndex::MainProcessProperty::Reserved) }, 0 }));
|
||||
TRY(callback({ "..", { fsid, m_procfs_traits->component_index() }, 0 }));
|
||||
|
@ -89,7 +89,7 @@ ErrorOr<size_t> Process::procfs_get_file_description_link(unsigned fd, KBufferBu
|
|||
return data->length();
|
||||
}
|
||||
|
||||
ErrorOr<void> Process::traverse_file_descriptions_directory(unsigned fsid, Function<ErrorOr<void>(FileSystem::DirectoryEntryView const&)> callback) const
|
||||
ErrorOr<void> Process::traverse_file_descriptions_directory(FileSystemID fsid, Function<ErrorOr<void>(FileSystem::DirectoryEntryView const&)> callback) const
|
||||
{
|
||||
TRY(callback({ ".", { fsid, m_procfs_traits->component_index() }, 0 }));
|
||||
TRY(callback({ "..", { fsid, m_procfs_traits->component_index() }, 0 }));
|
||||
|
@ -205,7 +205,7 @@ ErrorOr<void> Process::procfs_get_fds_stats(KBufferBuilder& builder) const
|
|||
Inode* inode = description->inode();
|
||||
if (inode != nullptr) {
|
||||
auto inode_object = description_object.add_object("inode");
|
||||
inode_object.add("fsid", inode->fsid());
|
||||
inode_object.add("fsid", inode->fsid().value());
|
||||
inode_object.add("index", inode->index().value());
|
||||
inode_object.finish();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue