1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 04:27:44 +00:00

Kernel/SysFS: Don't compute exact size of PCI files

There's no need for generated files in SysFS to tell you their precise
file size when you stat() them.

I noticed when profiling "find /" that we were spending a chunk of time
generating and throwing away SysFS content just so we could tell you
exactly how large it would be. :^)
This commit is contained in:
Andreas Kling 2021-08-15 18:58:50 +02:00
parent f633ef2af7
commit 9c373b646b
2 changed files with 0 additions and 9 deletions

View file

@ -430,14 +430,6 @@ KResultOr<size_t> PCIDeviceAttributeSysFSComponent::read_bytes(off_t offset, siz
return nread;
}
size_t PCIDeviceAttributeSysFSComponent::size() const
{
auto buffer = try_to_generate_buffer();
if (!buffer)
return 0;
return buffer->size();
}
OwnPtr<KBuffer> PCIDeviceAttributeSysFSComponent::try_to_generate_buffer() const
{
String value;

View file

@ -39,7 +39,6 @@ public:
virtual KResultOr<size_t> read_bytes(off_t, size_t, UserOrKernelBuffer&, FileDescription*) const override;
virtual ~PCIDeviceAttributeSysFSComponent() {};
virtual size_t size() const override;
protected:
virtual OwnPtr<KBuffer> try_to_generate_buffer() const;