mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-26 17:40:27 +00:00
Kernel: VFS::open/create should take base Inode& instead of InodeIdentifier.
This commit is contained in:
parent
6618411fba
commit
feed67ede2
Notes:
sideshowbarker
2024-07-19 15:54:09 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/feed67ede2c
4 changed files with 14 additions and 14 deletions
|
@ -122,7 +122,7 @@ void init_ksyms()
|
|||
void load_ksyms()
|
||||
{
|
||||
int error;
|
||||
auto descriptor = VFS::the().open("/kernel.map", error, 0, 0);
|
||||
auto descriptor = VFS::the().open("/kernel.map", error, 0, 0, *VFS::the().root_inode());
|
||||
if (!descriptor) {
|
||||
kprintf("Failed to open /kernel.map\n");
|
||||
} else {
|
||||
|
|
|
@ -292,7 +292,7 @@ int Process::do_exec(const String& path, Vector<String>&& arguments, Vector<Stri
|
|||
return -ENOENT;
|
||||
|
||||
int error;
|
||||
auto descriptor = VFS::the().open(path, error, 0, 0, m_cwd ? m_cwd->identifier() : InodeIdentifier());
|
||||
auto descriptor = VFS::the().open(path, error, 0, 0, *cwd_inode());
|
||||
if (!descriptor) {
|
||||
ASSERT(error != 0);
|
||||
return error;
|
||||
|
@ -1126,7 +1126,7 @@ int Process::sys$utime(const char* pathname, const utimbuf* buf)
|
|||
return -EFAULT;
|
||||
String path(pathname);
|
||||
int error;
|
||||
auto descriptor = VFS::the().open(move(path), error, 0, 0, cwd_inode()->identifier());
|
||||
auto descriptor = VFS::the().open(move(path), error, 0, 0, *cwd_inode());
|
||||
if (!descriptor)
|
||||
return error;
|
||||
auto& inode = *descriptor->inode();
|
||||
|
@ -1215,7 +1215,7 @@ int Process::sys$lstat(const char* path, stat* statbuf)
|
|||
if (!validate_write_typed(statbuf))
|
||||
return -EFAULT;
|
||||
int error;
|
||||
auto descriptor = VFS::the().open(move(path), error, O_NOFOLLOW_NOERROR | O_DONT_OPEN_DEVICE, 0, cwd_inode()->identifier());
|
||||
auto descriptor = VFS::the().open(move(path), error, O_NOFOLLOW_NOERROR | O_DONT_OPEN_DEVICE, 0, *cwd_inode());
|
||||
if (!descriptor)
|
||||
return error;
|
||||
descriptor->fstat(statbuf);
|
||||
|
@ -1227,7 +1227,7 @@ int Process::sys$stat(const char* path, stat* statbuf)
|
|||
if (!validate_write_typed(statbuf))
|
||||
return -EFAULT;
|
||||
int error;
|
||||
auto descriptor = VFS::the().open(move(path), error, O_DONT_OPEN_DEVICE, 0, cwd_inode()->identifier());
|
||||
auto descriptor = VFS::the().open(move(path), error, O_DONT_OPEN_DEVICE, 0, *cwd_inode());
|
||||
if (!descriptor)
|
||||
return error;
|
||||
descriptor->fstat(statbuf);
|
||||
|
@ -1242,7 +1242,7 @@ int Process::sys$readlink(const char* path, char* buffer, size_t size)
|
|||
return -EFAULT;
|
||||
|
||||
int error;
|
||||
auto descriptor = VFS::the().open(path, error, O_RDONLY | O_NOFOLLOW_NOERROR, 0, cwd_inode()->identifier());
|
||||
auto descriptor = VFS::the().open(path, error, O_RDONLY | O_NOFOLLOW_NOERROR, 0, *cwd_inode());
|
||||
if (!descriptor)
|
||||
return error;
|
||||
|
||||
|
@ -1264,7 +1264,7 @@ int Process::sys$chdir(const char* path)
|
|||
if (!validate_read_str(path))
|
||||
return -EFAULT;
|
||||
int error;
|
||||
auto descriptor = VFS::the().open(path, error, 0, 0, cwd_inode()->identifier());
|
||||
auto descriptor = VFS::the().open(path, error, 0, 0, *cwd_inode());
|
||||
if (!descriptor)
|
||||
return error;
|
||||
if (!descriptor->is_directory())
|
||||
|
@ -1308,7 +1308,7 @@ int Process::sys$open(const char* path, int options, mode_t mode)
|
|||
return -EMFILE;
|
||||
int error = -EWHYTHO;
|
||||
ASSERT(cwd_inode());
|
||||
auto descriptor = VFS::the().open(path, error, options, mode, cwd_inode()->identifier());
|
||||
auto descriptor = VFS::the().open(path, error, options, mode, *cwd_inode());
|
||||
if (!descriptor)
|
||||
return error;
|
||||
if (options & O_DIRECTORY && !descriptor->is_directory())
|
||||
|
|
|
@ -136,9 +136,9 @@ RetainPtr<FileDescriptor> VFS::open(RetainPtr<CharacterDevice>&& device, int& er
|
|||
return FileDescriptor::create(move(device));
|
||||
}
|
||||
|
||||
RetainPtr<FileDescriptor> VFS::open(const String& path, int& error, int options, mode_t mode, InodeIdentifier base)
|
||||
RetainPtr<FileDescriptor> VFS::open(const String& path, int& error, int options, mode_t mode, Inode& base)
|
||||
{
|
||||
auto inode_id = resolve_path(path, base, error, options);
|
||||
auto inode_id = resolve_path(path, base.identifier(), error, options);
|
||||
auto inode = get_inode(inode_id);
|
||||
if (!inode) {
|
||||
if (options & O_CREAT)
|
||||
|
@ -159,7 +159,7 @@ RetainPtr<FileDescriptor> VFS::open(const String& path, int& error, int options,
|
|||
return FileDescriptor::create(move(inode));
|
||||
}
|
||||
|
||||
RetainPtr<FileDescriptor> VFS::create(const String& path, int& error, int options, mode_t mode, InodeIdentifier base)
|
||||
RetainPtr<FileDescriptor> VFS::create(const String& path, int& error, int options, mode_t mode, Inode& base)
|
||||
{
|
||||
(void) options;
|
||||
error = -EWHYTHO;
|
||||
|
@ -177,7 +177,7 @@ RetainPtr<FileDescriptor> VFS::create(const String& path, int& error, int option
|
|||
}
|
||||
|
||||
InodeIdentifier parent_dir;
|
||||
auto existing_file = resolve_path(path, base, error, 0, &parent_dir);
|
||||
auto existing_file = resolve_path(path, base.identifier(), error, 0, &parent_dir);
|
||||
if (existing_file.is_valid()) {
|
||||
error = -EEXIST;
|
||||
return nullptr;
|
||||
|
|
|
@ -65,8 +65,8 @@ public:
|
|||
bool mount(RetainPtr<FS>&&, const String& path);
|
||||
|
||||
RetainPtr<FileDescriptor> open(RetainPtr<CharacterDevice>&&, int& error, int options);
|
||||
RetainPtr<FileDescriptor> open(const String& path, int& error, int options, mode_t mode, InodeIdentifier base = InodeIdentifier());
|
||||
RetainPtr<FileDescriptor> create(const String& path, int& error, int options, mode_t mode, InodeIdentifier base);
|
||||
RetainPtr<FileDescriptor> open(const String& path, int& error, int options, mode_t mode, Inode& base);
|
||||
RetainPtr<FileDescriptor> create(const String& path, int& error, int options, mode_t mode, Inode& base);
|
||||
bool mkdir(const String& path, mode_t mode, Inode& base, int& error);
|
||||
bool unlink(const String& path, Inode& base, int& error);
|
||||
bool rmdir(const String& path, Inode& base, int& error);
|
||||
|
|
Loading…
Reference in a new issue