All: Fix a lot of compiler warnings from header files

While reworking build system, header files started to report warnings.
This commit is contained in:
2024-06-18 20:32:43 +03:00
parent 526d4369ce
commit 318ce5dec8
59 changed files with 339 additions and 326 deletions

View File

@@ -436,8 +436,8 @@ done:
auto inode = inode_or_error.release_value();
BAN::ScopeGuard cleanup([&] { inode->cleanup_from_fs(); });
TRY(inode->link_inode_to_directory(*inode, "."sv));
TRY(inode->link_inode_to_directory(*this, ".."sv));
TRY(inode->link_inode_to_directory(*inode, "."_sv));
TRY(inode->link_inode_to_directory(*this, ".."_sv));
TRY(link_inode_to_directory(*inode, name));
@@ -569,7 +569,7 @@ needs_new_block:
if (entry.inode)
{
BAN::StringView entry_name(entry.name, entry.name_len);
if (entry_name != "."sv && entry_name != ".."sv)
if (entry_name != "."_sv && entry_name != ".."_sv)
return false;
}
@@ -608,12 +608,12 @@ needs_new_block:
{
BAN::StringView entry_name(entry.name, entry.name_len);
if (entry_name == "."sv)
if (entry_name == "."_sv)
{
m_inode.links_count--;
sync();
}
else if (entry_name == ".."sv)
else if (entry_name == ".."_sv)
{
auto parent = TRY(Ext2Inode::create(m_fs, entry.inode));
parent->m_inode.links_count--;

View File

@@ -212,9 +212,10 @@ namespace Kernel
return valid_entry_count;
}
BAN::ErrorOr<size_t> FATInode::read_impl(off_t offset, BAN::ByteSpan buffer)
BAN::ErrorOr<size_t> FATInode::read_impl(off_t s_offset, BAN::ByteSpan buffer)
{
ASSERT(offset >= 0);
ASSERT(s_offset >= 0);
uint32_t offset = s_offset;
if (offset >= m_entry.file_size)
return 0;

View File

@@ -103,7 +103,7 @@ namespace Kernel
LockGuard _(m_mutex);
if (!mode().ifdir())
return BAN::Error::from_errno(ENOTDIR);
if (name == "."sv || name == ".."sv)
if (name == "."_sv || name == ".."_sv)
return BAN::Error::from_errno(EINVAL);
return unlink_impl(name);
}

View File

@@ -12,9 +12,9 @@ namespace Kernel
return BAN::Error::from_errno(ENOMEM);
auto inode = BAN::RefPtr<ProcPidInode>::adopt(inode_ptr);
TRY(inode->link_inode(*MUST(ProcROInode::create_new(process, &Process::proc_meminfo, fs, 0400, uid, gid)), "meminfo"sv));
TRY(inode->link_inode(*MUST(ProcROInode::create_new(process, &Process::proc_cmdline, fs, 0400, uid, gid)), "cmdline"sv));
TRY(inode->link_inode(*MUST(ProcROInode::create_new(process, &Process::proc_environ, fs, 0400, uid, gid)), "environ"sv));
TRY(inode->link_inode(*MUST(ProcROInode::create_new(process, &Process::proc_meminfo, fs, 0400, uid, gid)), "meminfo"_sv));
TRY(inode->link_inode(*MUST(ProcROInode::create_new(process, &Process::proc_cmdline, fs, 0400, uid, gid)), "cmdline"_sv));
TRY(inode->link_inode(*MUST(ProcROInode::create_new(process, &Process::proc_environ, fs, 0400, uid, gid)), "environ"_sv));
return inode;
}
@@ -27,9 +27,9 @@ namespace Kernel
void ProcPidInode::cleanup()
{
(void)TmpDirectoryInode::unlink_impl("meminfo"sv);
(void)TmpDirectoryInode::unlink_impl("cmdline"sv);
(void)TmpDirectoryInode::unlink_impl("environ"sv);
(void)TmpDirectoryInode::unlink_impl("meminfo"_sv);
(void)TmpDirectoryInode::unlink_impl("cmdline"_sv);
(void)TmpDirectoryInode::unlink_impl("environ"_sv);
}
BAN::ErrorOr<BAN::RefPtr<ProcROInode>> ProcROInode::create_new(Process& process, size_t (Process::*callback)(off_t, BAN::ByteSpan) const, TmpFileSystem& fs, mode_t mode, uid_t uid, gid_t gid)

View File

@@ -342,8 +342,8 @@ namespace Kernel
return BAN::Error::from_errno(ENOMEM);
auto inode = BAN::RefPtr<TmpDirectoryInode>::adopt(inode_ptr);
TRY(inode->link_inode(*inode, "."sv));
TRY(inode->link_inode(*inode, ".."sv));
TRY(inode->link_inode(*inode, "."_sv));
TRY(inode->link_inode(*inode, ".."_sv));
return inode;
}
@@ -358,8 +358,8 @@ namespace Kernel
return BAN::Error::from_errno(ENOMEM);
auto inode = BAN::RefPtr<TmpDirectoryInode>::adopt(inode_ptr);
TRY(inode->link_inode(*inode, "."sv));
TRY(inode->link_inode(parent, ".."sv));
TRY(inode->link_inode(*inode, "."_sv));
TRY(inode->link_inode(parent, ".."_sv));
return inode;
}
@@ -381,9 +381,9 @@ namespace Kernel
bool is_empty = true;
for_each_valid_entry([&](TmpDirectoryEntry& entry) {
if (entry.name_sv() == "."sv)
if (entry.name_sv() == "."_sv)
dot_ino = entry.ino;
else if (entry.name_sv() == ".."sv)
else if (entry.name_sv() == ".."_sv)
dotdot_ino = entry.ino;
else
{

View File

@@ -17,7 +17,7 @@ namespace Kernel
ASSERT(!s_instance);
s_instance = MUST(BAN::RefPtr<VirtualFileSystem>::create());
ASSERT(root_path.size() >= 5 && root_path.substring(0, 5) == "/dev/"sv);;
ASSERT(root_path.size() >= 5 && root_path.substring(0, 5) == "/dev/"_sv);;
root_path = root_path.substring(5);
auto root_inode = MUST(DevFileSystem::get().root_inode()->find_inode(root_path));
@@ -26,12 +26,12 @@ namespace Kernel
s_instance->m_root_fs = MUST(FileSystem::from_block_device(static_cast<BlockDevice*>(root_inode.ptr())));
Credentials root_creds { 0, 0, 0, 0 };
MUST(s_instance->mount(root_creds, &DevFileSystem::get(), "/dev"sv));
MUST(s_instance->mount(root_creds, &DevFileSystem::get(), "/dev"_sv));
MUST(s_instance->mount(root_creds, &ProcFileSystem::get(), "/proc"sv));
MUST(s_instance->mount(root_creds, &ProcFileSystem::get(), "/proc"_sv));
auto tmpfs = MUST(TmpFileSystem::create(1024, 0777, 0, 0));
MUST(s_instance->mount(root_creds, tmpfs, "/tmp"sv));
MUST(s_instance->mount(root_creds, tmpfs, "/tmp"_sv));
}
VirtualFileSystem& VirtualFileSystem::get()
@@ -109,16 +109,16 @@ namespace Kernel
const auto& path_part = path_parts.back();
auto orig = inode;
if (path_part.empty() || path_part == "."sv)
if (path_part.empty() || path_part == "."_sv)
{
}
else if (path_part == ".."sv)
else if (path_part == ".."_sv)
{
if (auto* mount_point = mount_from_root_inode(inode))
inode = TRY(mount_point->host.inode->find_inode(".."sv));
inode = TRY(mount_point->host.inode->find_inode(".."_sv));
else
inode = TRY(inode->find_inode(".."sv));
inode = TRY(inode->find_inode(".."_sv));
if (!canonical_path.empty())
{