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:
parent
f633ef2af7
commit
9c373b646b
2 changed files with 0 additions and 9 deletions
|
@ -430,14 +430,6 @@ KResultOr<size_t> PCIDeviceAttributeSysFSComponent::read_bytes(off_t offset, siz
|
||||||
return nread;
|
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
|
OwnPtr<KBuffer> PCIDeviceAttributeSysFSComponent::try_to_generate_buffer() const
|
||||||
{
|
{
|
||||||
String value;
|
String value;
|
||||||
|
|
|
@ -39,7 +39,6 @@ public:
|
||||||
|
|
||||||
virtual KResultOr<size_t> read_bytes(off_t, size_t, UserOrKernelBuffer&, FileDescription*) const override;
|
virtual KResultOr<size_t> read_bytes(off_t, size_t, UserOrKernelBuffer&, FileDescription*) const override;
|
||||||
virtual ~PCIDeviceAttributeSysFSComponent() {};
|
virtual ~PCIDeviceAttributeSysFSComponent() {};
|
||||||
virtual size_t size() const override;
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual OwnPtr<KBuffer> try_to_generate_buffer() const;
|
virtual OwnPtr<KBuffer> try_to_generate_buffer() const;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue