1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-20 13:45:06 +00:00

Kernel: Rename FileDescriptor to FileDescription.

After reading a bunch of POSIX specs, I've learned that a file descriptor
is the number that refers to a file description, not the description itself.
So this patch renames FileDescriptor to FileDescription, and Process now has
FileDescription* file_description(int fd).
This commit is contained in:
Andreas Kling 2019-06-07 09:36:51 +02:00
parent 69a6ce90df
commit 08cd75ac4b
70 changed files with 373 additions and 373 deletions

View file

@ -1,7 +1,7 @@
#include "ProcFS.h"
#include "Process.h"
#include <Kernel/FileSystem/Custody.h>
#include <Kernel/FileSystem/FileDescriptor.h>
#include <Kernel/FileSystem/FileDescription.h>
#include <Kernel/FileSystem/VirtualFileSystem.h>
#include <Kernel/VM/MemoryManager.h>
#include "StdLib.h"
@ -189,7 +189,7 @@ ByteBuffer procfs$pid_fds(InodeIdentifier identifier)
return { };
StringBuilder builder;
for (int i = 0; i < process.max_open_file_descriptors(); ++i) {
auto* descriptor = process.file_descriptor(i);
auto* descriptor = process.file_description(i);
if (!descriptor)
continue;
builder.appendf("% 3u %s\n", i, descriptor->absolute_path().characters());
@ -204,7 +204,7 @@ ByteBuffer procfs$pid_fd_entry(InodeIdentifier identifier)
return { };
auto& process = handle->process();
int fd = to_fd(identifier);
auto* descriptor = process.file_descriptor(fd);
auto* descriptor = process.file_description(fd);
if (!descriptor)
return { };
return descriptor->absolute_path().to_byte_buffer();
@ -835,7 +835,7 @@ InodeMetadata ProcFSInode::metadata() const
return metadata;
}
ssize_t ProcFSInode::read_bytes(off_t offset, ssize_t count, byte* buffer, FileDescriptor* descriptor) const
ssize_t ProcFSInode::read_bytes(off_t offset, ssize_t count, byte* buffer, FileDescription* descriptor) const
{
#ifdef PROCFS_DEBUG
dbgprintf("ProcFS: read_bytes %u\n", index());
@ -941,7 +941,7 @@ bool ProcFSInode::traverse_as_directory(Function<bool(const FS::DirectoryEntry&)
return false;
auto& process = handle->process();
for (int i = 0; i < process.max_open_file_descriptors(); ++i) {
auto* descriptor = process.file_descriptor(i);
auto* descriptor = process.file_description(i);
if (!descriptor)
continue;
char name[16];
@ -1027,7 +1027,7 @@ InodeIdentifier ProcFSInode::lookup(StringView name)
{
InterruptDisabler disabler;
if (auto* process = Process::from_pid(to_pid(identifier())))
fd_exists = process->file_descriptor(name_as_number);
fd_exists = process->file_description(name_as_number);
}
if (fd_exists)
@ -1041,7 +1041,7 @@ void ProcFSInode::flush_metadata()
{
}
ssize_t ProcFSInode::write_bytes(off_t offset, ssize_t size, const byte* buffer, FileDescriptor*)
ssize_t ProcFSInode::write_bytes(off_t offset, ssize_t size, const byte* buffer, FileDescription*)
{
auto* directory_entry = fs().get_directory_entry(identifier());
if (!directory_entry || !directory_entry->write_callback)