mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 04:37:44 +00:00
Kernel: mkdir() should use the containing directory's FS for inode creation.
This commit is contained in:
parent
33e7df5955
commit
6618411fba
3 changed files with 5 additions and 5 deletions
|
@ -1869,7 +1869,7 @@ int Process::sys$mkdir(const char* pathname, mode_t mode)
|
|||
if (pathname_length >= 255)
|
||||
return -ENAMETOOLONG;
|
||||
int error;
|
||||
if (!VFS::the().mkdir(String(pathname, pathname_length), mode, cwd_inode()->identifier(), error))
|
||||
if (!VFS::the().mkdir(String(pathname, pathname_length), mode, *cwd_inode(), error))
|
||||
return error;
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -198,7 +198,7 @@ RetainPtr<FileDescriptor> VFS::create(const String& path, int& error, int option
|
|||
return FileDescriptor::create(move(new_file));
|
||||
}
|
||||
|
||||
bool VFS::mkdir(const String& path, mode_t mode, InodeIdentifier base, int& error)
|
||||
bool VFS::mkdir(const String& path, mode_t mode, Inode& base, int& error)
|
||||
{
|
||||
error = -EWHYTHO;
|
||||
// FIXME: This won't work nicely across mount boundaries.
|
||||
|
@ -209,7 +209,7 @@ bool VFS::mkdir(const String& path, mode_t mode, InodeIdentifier base, int& erro
|
|||
}
|
||||
|
||||
InodeIdentifier parent_dir;
|
||||
auto existing_dir = resolve_path(path, base, error, 0, &parent_dir);
|
||||
auto existing_dir = resolve_path(path, base.identifier(), error, 0, &parent_dir);
|
||||
if (existing_dir.is_valid()) {
|
||||
error = -EEXIST;
|
||||
return false;
|
||||
|
@ -222,7 +222,7 @@ bool VFS::mkdir(const String& path, mode_t mode, InodeIdentifier base, int& erro
|
|||
return false;
|
||||
}
|
||||
dbgprintf("VFS::mkdir: '%s' in %u:%u\n", p.basename().characters(), parent_dir.fsid(), parent_dir.index());
|
||||
auto new_dir = base.fs()->create_directory(parent_dir, p.basename(), mode, error);
|
||||
auto new_dir = parent_dir.fs()->create_directory(parent_dir, p.basename(), mode, error);
|
||||
if (new_dir) {
|
||||
error = 0;
|
||||
return true;
|
||||
|
|
|
@ -67,7 +67,7 @@ public:
|
|||
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);
|
||||
bool mkdir(const String& path, mode_t mode, InodeIdentifier base, int& error);
|
||||
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);
|
||||
bool chmod(const String& path, mode_t, Inode& base, int& error);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue