mirror of
https://github.com/RGBCube/serenity
synced 2025-05-16 19:05:08 +00:00
FileSystem: Don't create a temporary FileDescriptor every time we stat().
Instead, move the stat buffer population into InodeMetadata so we can call it directly from VFS::stat() once we have an Inode.
This commit is contained in:
parent
bba2c062fe
commit
00de8b9fc4
4 changed files with 30 additions and 29 deletions
|
@ -81,25 +81,7 @@ KResult FileDescriptor::fstat(stat& buffer)
|
|||
ASSERT(!is_fifo());
|
||||
if (!m_inode)
|
||||
return KResult(-EBADF);
|
||||
|
||||
auto metadata = this->metadata();
|
||||
if (!metadata.is_valid())
|
||||
return KResult(-EIO);
|
||||
|
||||
buffer.st_rdev = encoded_device(metadata.major_device, metadata.minor_device);
|
||||
buffer.st_ino = metadata.inode.index();
|
||||
buffer.st_mode = metadata.mode;
|
||||
buffer.st_nlink = metadata.link_count;
|
||||
buffer.st_uid = metadata.uid;
|
||||
buffer.st_gid = metadata.gid;
|
||||
buffer.st_dev = 0; // FIXME
|
||||
buffer.st_size = metadata.size;
|
||||
buffer.st_blksize = metadata.block_size;
|
||||
buffer.st_blocks = metadata.block_count;
|
||||
buffer.st_atime = metadata.atime;
|
||||
buffer.st_mtime = metadata.mtime;
|
||||
buffer.st_ctime = metadata.ctime;
|
||||
return KSuccess;
|
||||
return metadata().stat(buffer);
|
||||
}
|
||||
|
||||
KResult FileDescriptor::fchmod(mode_t mode)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue