Kernel: Make all ProcFS and SysFS files zero-sized

There is no value in exposing particular sizes for these files.
This commit is contained in:
Andreas Kling 2021-08-28 23:53:29 +02:00
parent b959c1bfa9
commit 8ebf08b6c8
Notes: sideshowbarker 2024-07-18 05:07:00 +09:00
5 changed files with 2 additions and 6 deletions

View File

@ -70,7 +70,6 @@ protected:
class DMIEntryPointExposedBlob : public BIOSSysFSComponent {
public:
static NonnullRefPtr<DMIEntryPointExposedBlob> create(PhysicalAddress dmi_entry_point, size_t blob_size);
virtual size_t size() const override { return m_dmi_entry_point_length; }
private:
DMIEntryPointExposedBlob(PhysicalAddress dmi_entry_point, size_t blob_size);
@ -82,7 +81,6 @@ private:
class SMBIOSExposedTable : public BIOSSysFSComponent {
public:
static NonnullRefPtr<SMBIOSExposedTable> create(PhysicalAddress, size_t blob_size);
virtual size_t size() const override { return m_smbios_structure_table_length; }
private:
SMBIOSExposedTable(PhysicalAddress dmi_entry_point, size_t blob_size);

View File

@ -163,7 +163,7 @@ InodeMetadata ProcFSGlobalInode::metadata() const
metadata.mode = S_IFREG | m_associated_component->required_mode();
metadata.uid = m_associated_component->owner_user();
metadata.gid = m_associated_component->owner_group();
metadata.size = m_associated_component->size();
metadata.size = 0;
metadata.mtime = m_associated_component->modified_time();
return metadata;
}

View File

@ -119,7 +119,7 @@ InodeMetadata SysFSInode::metadata() const
metadata.mode = S_IFREG | S_IRUSR | S_IRGRP | S_IROTH;
metadata.uid = 0;
metadata.gid = 0;
metadata.size = m_associated_component->size();
metadata.size = 0;
metadata.mtime = mepoch;
return metadata;
}

View File

@ -25,7 +25,6 @@ public:
virtual KResult traverse_as_directory(unsigned, Function<bool(FileSystem::DirectoryEntryView const&)>) const { VERIFY_NOT_REACHED(); }
virtual RefPtr<SysFSComponent> lookup(StringView) { VERIFY_NOT_REACHED(); };
virtual KResultOr<size_t> write_bytes(off_t, size_t, UserOrKernelBuffer const&, FileDescription*) { return EROFS; }
virtual size_t size() const { return 0; }
virtual NonnullRefPtr<Inode> to_inode(SysFS const&) const;

View File

@ -70,7 +70,6 @@ public:
virtual KResult traverse_as_directory(unsigned, Function<bool(FileSystem::DirectoryEntryView const&)>) const { VERIFY_NOT_REACHED(); }
virtual KResultOr<NonnullRefPtr<ProcFSExposedComponent>> lookup(StringView) { VERIFY_NOT_REACHED(); };
virtual KResultOr<size_t> write_bytes(off_t, size_t, const UserOrKernelBuffer&, FileDescription*) { return KResult(EROFS); }
virtual size_t size() const { return 0; }
virtual mode_t required_mode() const { return 0444; }
virtual UserID owner_user() const { return 0; }