forked from Bananymous/banan-os
Kernel: OpenFileDesctiptor can now return inode of fd
This commit is contained in:
parent
f7bf6d5e62
commit
9eb72f4392
|
@ -42,6 +42,7 @@ namespace Kernel
|
||||||
BAN::ErrorOr<void> read_dir_entries(int fd, DirectoryEntryList* list, size_t list_size);
|
BAN::ErrorOr<void> read_dir_entries(int fd, DirectoryEntryList* list, size_t list_size);
|
||||||
|
|
||||||
BAN::ErrorOr<BAN::StringView> path_of(int) const;
|
BAN::ErrorOr<BAN::StringView> path_of(int) const;
|
||||||
|
BAN::ErrorOr<BAN::RefPtr<Inode>> inode_of(int);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
struct OpenFileDescription : public BAN::RefCounted<OpenFileDescription>
|
struct OpenFileDescription : public BAN::RefCounted<OpenFileDescription>
|
||||||
|
|
|
@ -216,13 +216,17 @@ namespace Kernel
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
BAN::ErrorOr<BAN::StringView> OpenFileDescriptorSet::path_of(int fd) const
|
BAN::ErrorOr<BAN::StringView> OpenFileDescriptorSet::path_of(int fd) const
|
||||||
{
|
{
|
||||||
TRY(validate_fd(fd));
|
TRY(validate_fd(fd));
|
||||||
return m_open_files[fd]->path.sv();
|
return m_open_files[fd]->path.sv();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BAN::ErrorOr<BAN::RefPtr<Inode>> OpenFileDescriptorSet::inode_of(int fd)
|
||||||
|
{
|
||||||
|
TRY(validate_fd(fd));
|
||||||
|
return m_open_files[fd]->inode;
|
||||||
|
}
|
||||||
|
|
||||||
BAN::ErrorOr<void> OpenFileDescriptorSet::validate_fd(int fd) const
|
BAN::ErrorOr<void> OpenFileDescriptorSet::validate_fd(int fd) const
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue