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:
parent
526d4369ce
commit
318ce5dec8
|
@ -193,7 +193,7 @@ namespace BAN
|
|||
|
||||
}
|
||||
|
||||
inline constexpr BAN::StringView operator""sv(const char* str, BAN::StringView::size_type len) { return BAN::StringView(str, len); }
|
||||
inline constexpr BAN::StringView operator""_sv(const char* str, BAN::StringView::size_type len) { return BAN::StringView(str, len); }
|
||||
|
||||
namespace BAN::Formatter
|
||||
{
|
||||
|
|
|
@ -66,6 +66,7 @@ set(KERNEL_SOURCES
|
|||
kernel/Networking/E1000/E1000E.cpp
|
||||
kernel/Networking/IPv4Layer.cpp
|
||||
kernel/Networking/NetworkInterface.cpp
|
||||
kernel/Networking/NetworkLayer.cpp
|
||||
kernel/Networking/NetworkManager.cpp
|
||||
kernel/Networking/NetworkSocket.cpp
|
||||
kernel/Networking/TCPSocket.cpp
|
||||
|
|
|
@ -48,7 +48,7 @@ namespace Kernel::ACPI::AML
|
|||
AML_ERROR("IndexOp index is out of buffer bounds");
|
||||
return ParseResult::Failure;
|
||||
}
|
||||
auto buffer_field = MUST(BAN::RefPtr<BufferField>::create(NameSeg(""sv), buffer, index.value() * 8, 8));
|
||||
auto buffer_field = MUST(BAN::RefPtr<BufferField>::create(NameSeg(""_sv), buffer, index.value() * 8, 8));
|
||||
result = MUST(BAN::RefPtr<AML::Reference>::create(buffer_field));
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -21,8 +21,8 @@ namespace Kernel::ACPI::AML
|
|||
static BAN::RefPtr<Integer> Ones;
|
||||
};
|
||||
|
||||
const bool constant;
|
||||
uint64_t value;
|
||||
const bool constant;
|
||||
|
||||
Integer(uint64_t value, bool constant = false)
|
||||
: Node(Node::Type::Integer)
|
||||
|
|
|
@ -45,7 +45,7 @@ namespace Kernel::ACPI::AML
|
|||
|
||||
[[nodiscard]] BAN::Optional<uint64_t> as_integer();
|
||||
[[nodiscard]] virtual BAN::RefPtr<AML::Node> evaluate() { AML_TODO("evaluate, type {}", static_cast<uint8_t>(type)); return nullptr; }
|
||||
[[nodiscard]] virtual bool store(BAN::RefPtr<AML::Node> source) { AML_TODO("store, type {}", static_cast<uint8_t>(type)); return false; }
|
||||
[[nodiscard]] virtual bool store(BAN::RefPtr<AML::Node>) { AML_TODO("store, type {}", static_cast<uint8_t>(type)); return false; }
|
||||
|
||||
virtual void debug_print(int indent) const = 0;
|
||||
};
|
||||
|
|
|
@ -41,20 +41,20 @@ namespace Kernel::ACPI::AML
|
|||
switch (object->type)
|
||||
{
|
||||
case AML::Node::Type::Device:
|
||||
object_type_sv = "Device"sv;
|
||||
object_type_sv = "Device"_sv;
|
||||
object_name_sv = static_cast<AML::Device*>(object.ptr())->name.sv();
|
||||
break;
|
||||
case AML::Node::Type::Processor:
|
||||
object_type_sv = "Processor"sv;
|
||||
object_type_sv = "Processor"_sv;
|
||||
object_name_sv = static_cast<AML::Processor*>(object.ptr())->name.sv();
|
||||
break;
|
||||
case AML::Node::Type::ThermalZone:
|
||||
object_type_sv = "ThermalZone"sv;
|
||||
object_type_sv = "ThermalZone"_sv;
|
||||
object_name_sv = static_cast<AML::ThermalZone*>(object.ptr())->name.sv();
|
||||
break;
|
||||
default:
|
||||
object_type_sv = "Unknown"sv;
|
||||
object_name_sv = "????"sv;
|
||||
object_type_sv = "Unknown"_sv;
|
||||
object_name_sv = "????"_sv;
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -60,7 +60,6 @@ namespace Kernel::ACPI::AML
|
|||
PackageElement(BAN::RefPtr<AML::Package> parent)
|
||||
: Node(Node::Type::PackageElement)
|
||||
, parent(parent)
|
||||
, unresolved_name(unresolved_name)
|
||||
{
|
||||
resolved = false;
|
||||
initialized = false;
|
||||
|
|
|
@ -82,18 +82,18 @@ namespace Kernel::ACPI::AML
|
|||
BAN::StringView region_space_name;
|
||||
switch (region_space)
|
||||
{
|
||||
case RegionSpace::SystemMemory: region_space_name = "SystemMemory"sv; break;
|
||||
case RegionSpace::SystemIO: region_space_name = "SystemIO"sv; break;
|
||||
case RegionSpace::PCIConfig: region_space_name = "PCIConfig"sv; break;
|
||||
case RegionSpace::EmbeddedController: region_space_name = "EmbeddedController"sv; break;
|
||||
case RegionSpace::SMBus: region_space_name = "SMBus"sv; break;
|
||||
case RegionSpace::SystemCMOS: region_space_name = "SystemCMOS"sv; break;
|
||||
case RegionSpace::PCIBarTarget: region_space_name = "PCIBarTarget"sv; break;
|
||||
case RegionSpace::IPMI: region_space_name = "IPMI"sv; break;
|
||||
case RegionSpace::GeneralPurposeIO: region_space_name = "GeneralPurposeIO"sv; break;
|
||||
case RegionSpace::GenericSerialBus: region_space_name = "GenericSerialBus"sv; break;
|
||||
case RegionSpace::PlatformCommunicationChannel: region_space_name = "PlatformCommunicationChannel"sv; break;
|
||||
default: region_space_name = "Unknown"sv; break;
|
||||
case RegionSpace::SystemMemory: region_space_name = "SystemMemory"_sv; break;
|
||||
case RegionSpace::SystemIO: region_space_name = "SystemIO"_sv; break;
|
||||
case RegionSpace::PCIConfig: region_space_name = "PCIConfig"_sv; break;
|
||||
case RegionSpace::EmbeddedController: region_space_name = "EmbeddedController"_sv; break;
|
||||
case RegionSpace::SMBus: region_space_name = "SMBus"_sv; break;
|
||||
case RegionSpace::SystemCMOS: region_space_name = "SystemCMOS"_sv; break;
|
||||
case RegionSpace::PCIBarTarget: region_space_name = "PCIBarTarget"_sv; break;
|
||||
case RegionSpace::IPMI: region_space_name = "IPMI"_sv; break;
|
||||
case RegionSpace::GeneralPurposeIO: region_space_name = "GeneralPurposeIO"_sv; break;
|
||||
case RegionSpace::GenericSerialBus: region_space_name = "GenericSerialBus"_sv; break;
|
||||
case RegionSpace::PlatformCommunicationChannel: region_space_name = "PlatformCommunicationChannel"_sv; break;
|
||||
default: region_space_name = "Unknown"_sv; break;
|
||||
}
|
||||
AML_DEBUG_PRINT_INDENT(indent);
|
||||
AML_DEBUG_PRINT("OperationRegion(");
|
||||
|
|
|
@ -10,7 +10,7 @@ namespace Kernel
|
|||
|
||||
virtual dev_t rdev() const override { return m_rdev; }
|
||||
|
||||
virtual BAN::StringView name() const override { return "debug"sv; }
|
||||
virtual BAN::StringView name() const override { return "debug"_sv; }
|
||||
|
||||
protected:
|
||||
DebugDevice(mode_t mode, uid_t uid, gid_t gid, dev_t rdev)
|
||||
|
|
|
@ -16,7 +16,7 @@ namespace Kernel
|
|||
virtual bool is_partition() const { return false; }
|
||||
virtual bool is_storage_device() const { return false; }
|
||||
|
||||
virtual BAN::ErrorOr<BAN::UniqPtr<MemoryRegion>> mmap_region(PageTable&, off_t offset, size_t len, AddressRange, MemoryRegion::Type, PageTable::flags_t) { return BAN::Error::from_errno(EINVAL); }
|
||||
virtual BAN::ErrorOr<BAN::UniqPtr<MemoryRegion>> mmap_region(PageTable&, off_t offset, size_t len, AddressRange, MemoryRegion::Type, PageTable::flags_t) { (void)offset; (void)len; return BAN::Error::from_errno(EINVAL); }
|
||||
|
||||
virtual dev_t rdev() const override = 0;
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ namespace Kernel
|
|||
|
||||
virtual dev_t rdev() const override { return m_rdev; }
|
||||
|
||||
virtual BAN::StringView name() const override { return "null"sv; }
|
||||
virtual BAN::StringView name() const override { return "null"_sv; }
|
||||
|
||||
protected:
|
||||
NullDevice(mode_t mode, uid_t uid, gid_t gid, dev_t rdev)
|
||||
|
|
|
@ -10,7 +10,7 @@ namespace Kernel
|
|||
|
||||
virtual dev_t rdev() const override { return m_rdev; }
|
||||
|
||||
virtual BAN::StringView name() const override { return "zero"sv; }
|
||||
virtual BAN::StringView name() const override { return "zero"_sv; }
|
||||
|
||||
protected:
|
||||
ZeroDevice(mode_t mode, uid_t uid, gid_t gid, dev_t rdev)
|
||||
|
|
|
@ -53,12 +53,12 @@ namespace Kernel
|
|||
uint32_t first_fat_sector() const { return m_bpb.reserved_sector_count; }
|
||||
|
||||
private:
|
||||
const FAT::BPB m_bpb;
|
||||
const Type m_type;
|
||||
|
||||
BAN::RefPtr<BlockDevice> m_block_device;
|
||||
BAN::RefPtr<FATInode> m_root_inode;
|
||||
|
||||
const FAT::BPB m_bpb;
|
||||
const Type m_type;
|
||||
|
||||
BAN::HashMap<ino_t, BAN::WeakPtr<FATInode>> m_inode_cache;
|
||||
|
||||
BAN::Vector<uint8_t> m_fat_two_sector_buffer;
|
||||
|
|
|
@ -155,7 +155,7 @@ namespace Kernel
|
|||
virtual bool can_write_impl() const = 0;
|
||||
virtual bool has_error_impl() const = 0;
|
||||
|
||||
virtual BAN::ErrorOr<long> ioctl_impl(int request, void* arg) { return BAN::Error::from_errno(ENOTSUP); }
|
||||
virtual BAN::ErrorOr<long> ioctl_impl(int, void*) { return BAN::Error::from_errno(ENOTSUP); }
|
||||
|
||||
protected:
|
||||
mutable PriorityMutex m_mutex;
|
||||
|
|
|
@ -14,9 +14,9 @@ namespace Kernel
|
|||
mode_t mode { 0 };
|
||||
uid_t uid { 0 };
|
||||
gid_t gid { 0 };
|
||||
timespec atime { 0 };
|
||||
timespec ctime { 0 };
|
||||
timespec mtime { 0 };
|
||||
timespec atime { 0, 0 };
|
||||
timespec ctime { 0, 0 };
|
||||
timespec mtime { 0, 0 };
|
||||
nlink_t nlink { 0 };
|
||||
size_t size { 0 };
|
||||
blkcnt_t blocks { 0 };
|
||||
|
|
|
@ -154,7 +154,7 @@ namespace Kernel
|
|||
#endif
|
||||
TaskStateSegment m_tss;
|
||||
const GDTR m_gdtr {
|
||||
.size = m_gdt.size() * sizeof(SegmentDescriptor) - 1,
|
||||
.size = static_cast<uint16_t>(m_gdt.size() * sizeof(SegmentDescriptor) - 1),
|
||||
.address = reinterpret_cast<uintptr_t>(m_gdt.data())
|
||||
};
|
||||
};
|
||||
|
|
|
@ -72,8 +72,8 @@ namespace Kernel
|
|||
private:
|
||||
BAN::Array<GateDescriptor, 0x100> m_idt;
|
||||
IDTR m_idtr {
|
||||
.size = m_idt.size() * sizeof(GateDescriptor) - 1,
|
||||
.offset = reinterpret_cast<uint64_t>(m_idt.data())
|
||||
.size = static_cast<uint16_t>(m_idt.size() * sizeof(GateDescriptor) - 1),
|
||||
.offset = reinterpret_cast<uintptr_t>(m_idt.data())
|
||||
};
|
||||
};
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ namespace Kernel::Input
|
|||
static BAN::ErrorOr<PS2Mouse*> create(PS2Controller&);
|
||||
virtual void send_initialize() override;
|
||||
|
||||
virtual void command_timedout(uint8_t* command_data, uint8_t command_size) final override {}
|
||||
virtual void command_timedout(uint8_t* command_data, uint8_t command_size) final override { (void)command_data; (void)command_size; }
|
||||
|
||||
virtual void handle_byte(uint8_t) final override;
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@ namespace Kernel
|
|||
|
||||
protected:
|
||||
Interruptable() = default;
|
||||
~Interruptable() {}
|
||||
virtual ~Interruptable() {}
|
||||
|
||||
private:
|
||||
int m_irq { -1 };
|
||||
|
|
|
@ -35,18 +35,6 @@ namespace Kernel
|
|||
NetworkLayer() = default;
|
||||
};
|
||||
|
||||
static uint16_t calculate_internet_checksum(BAN::ConstByteSpan packet, const PseudoHeader& pseudo_header)
|
||||
{
|
||||
uint32_t checksum = 0;
|
||||
for (size_t i = 0; i < sizeof(pseudo_header) / sizeof(uint16_t); i++)
|
||||
checksum += BAN::host_to_network_endian(reinterpret_cast<const uint16_t*>(&pseudo_header)[i]);
|
||||
for (size_t i = 0; i < packet.size() / sizeof(uint16_t); i++)
|
||||
checksum += BAN::host_to_network_endian(reinterpret_cast<const uint16_t*>(packet.data())[i]);
|
||||
if (packet.size() % 2)
|
||||
checksum += (uint16_t)packet[packet.size() - 1] << 8;
|
||||
while (checksum >> 16)
|
||||
checksum = (checksum >> 16) + (checksum & 0xFFFF);
|
||||
return ~(uint16_t)checksum;
|
||||
}
|
||||
uint16_t calculate_internet_checksum(BAN::ConstByteSpan packet, const PseudoHeader& pseudo_header);
|
||||
|
||||
}
|
||||
|
|
|
@ -38,7 +38,7 @@ namespace Kernel
|
|||
BAN::ErrorOr<void> add_packet(BAN::ConstByteSpan);
|
||||
|
||||
bool is_bound() const { return !m_bound_path.empty(); }
|
||||
bool is_bound_to_unused() const { return m_bound_path == "X"sv; }
|
||||
bool is_bound_to_unused() const { return m_bound_path == "X"_sv; }
|
||||
|
||||
bool is_streaming() const;
|
||||
|
||||
|
|
|
@ -25,6 +25,7 @@ namespace Kernel
|
|||
Debug::dump_stack_trace();
|
||||
}
|
||||
asm volatile("ud2");
|
||||
__builtin_unreachable();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -132,7 +132,7 @@ acpi_release_global_lock:
|
|||
if (!access_type.has_value())
|
||||
return {};
|
||||
|
||||
auto op_region = MUST(BAN::RefPtr<AML::OpRegion>::create(""sv, address_space_id, (uint64_t)address, 0xFFFFFFFF));
|
||||
auto op_region = MUST(BAN::RefPtr<AML::OpRegion>::create(""_sv, address_space_id, (uint64_t)address, 0xFFFFFFFF));
|
||||
|
||||
auto field_rules = AML::FieldRules {
|
||||
.access_type = access_type.value(),
|
||||
|
@ -141,7 +141,7 @@ acpi_release_global_lock:
|
|||
.access_attrib = AML::FieldRules::AccessAttrib::Normal,
|
||||
.access_length = 0
|
||||
};
|
||||
auto field_element = MUST(BAN::RefPtr<AML::FieldElement>::create(""sv, register_bit_offset, register_bit_width, field_rules));
|
||||
auto field_element = MUST(BAN::RefPtr<AML::FieldElement>::create(""_sv, register_bit_offset, register_bit_width, field_rules));
|
||||
field_element->op_region = op_region;
|
||||
|
||||
auto result = field_element->as_integer();
|
||||
|
@ -156,7 +156,7 @@ acpi_release_global_lock:
|
|||
if (!access_type.has_value())
|
||||
return {};
|
||||
|
||||
auto op_region = MUST(BAN::RefPtr<AML::OpRegion>::create(""sv, address_space_id, (uint64_t)address, 0xFFFFFFFF));
|
||||
auto op_region = MUST(BAN::RefPtr<AML::OpRegion>::create(""_sv, address_space_id, (uint64_t)address, 0xFFFFFFFF));
|
||||
|
||||
auto field_rules = AML::FieldRules {
|
||||
.access_type = access_type.value(),
|
||||
|
@ -165,7 +165,7 @@ acpi_release_global_lock:
|
|||
.access_attrib = AML::FieldRules::AccessAttrib::Normal,
|
||||
.access_length = 0
|
||||
};
|
||||
auto field_element = MUST(BAN::RefPtr<AML::FieldElement>::create(""sv, register_bit_offset, register_bit_width, field_rules));
|
||||
auto field_element = MUST(BAN::RefPtr<AML::FieldElement>::create(""_sv, register_bit_offset, register_bit_width, field_rules));
|
||||
field_element->op_region = op_region;
|
||||
|
||||
return field_element->store(MUST(BAN::RefPtr<AML::Integer>::create(value)));
|
||||
|
@ -214,7 +214,7 @@ acpi_release_global_lock:
|
|||
|
||||
{
|
||||
ASSERT(!s_global_lock);
|
||||
const auto* fadt = static_cast<const FADT*>(ACPI::get().get_header("FACP"sv, 0));
|
||||
const auto* fadt = static_cast<const FADT*>(ACPI::get().get_header("FACP"_sv, 0));
|
||||
ASSERT(fadt);
|
||||
|
||||
uintptr_t facs_addr = fadt->firmware_ctrl;
|
||||
|
@ -679,7 +679,7 @@ acpi_release_global_lock:
|
|||
return;
|
||||
|
||||
auto name = path.sv().substring(path.size() - 4);
|
||||
if (name.substring(0, 2) != "_L"sv && name.substring(0, 2) != "_E"sv)
|
||||
if (name.substring(0, 2) != "_L"_sv && name.substring(0, 2) != "_E"_sv)
|
||||
return;
|
||||
|
||||
auto index = hex_sv_to_int(name.substring(2));
|
||||
|
|
|
@ -41,7 +41,7 @@ namespace Kernel::ACPI
|
|||
LockGuard _(m_object_mutex);
|
||||
|
||||
// Base must be non-empty absolute path
|
||||
ASSERT(relative_base.prefix == "\\"sv || relative_base.path.empty());
|
||||
ASSERT(relative_base.prefix == "\\"_sv || relative_base.path.empty());
|
||||
|
||||
// Do absolute path lookup
|
||||
if (!relative_path.prefix.empty() || relative_path.path.size() != 1 || mode == FindMode::ForceAbsolute)
|
||||
|
@ -50,7 +50,7 @@ namespace Kernel::ACPI
|
|||
MUST(absolute_path.push_back('\\'));
|
||||
|
||||
// Resolve root and parent references
|
||||
if (relative_path.prefix == "\\"sv)
|
||||
if (relative_path.prefix == "\\"_sv)
|
||||
;
|
||||
else
|
||||
{
|
||||
|
@ -76,7 +76,7 @@ namespace Kernel::ACPI
|
|||
if (absolute_path.back() == '.')
|
||||
absolute_path.pop_back();
|
||||
|
||||
if (!check_existence || absolute_path == "\\"sv || m_objects.contains(absolute_path))
|
||||
if (!check_existence || absolute_path == "\\"_sv || m_objects.contains(absolute_path))
|
||||
return absolute_path;
|
||||
return {};
|
||||
}
|
||||
|
@ -125,7 +125,7 @@ namespace Kernel::ACPI
|
|||
if (!canonical_path.has_value())
|
||||
return nullptr;
|
||||
|
||||
if (canonical_path->sv() == "\\"sv)
|
||||
if (canonical_path->sv() == "\\"_sv)
|
||||
return this;
|
||||
|
||||
auto it = m_objects.find(canonical_path.value());
|
||||
|
@ -191,28 +191,28 @@ namespace Kernel::ACPI
|
|||
BAN::RefPtr<AML::Namespace> AML::Namespace::create_root_namespace()
|
||||
{
|
||||
ASSERT(!s_root_namespace);
|
||||
s_root_namespace = MUST(BAN::RefPtr<Namespace>::create(NameSeg("\\"sv)));
|
||||
s_root_namespace->scope = AML::NameString("\\"sv);
|
||||
s_root_namespace = MUST(BAN::RefPtr<Namespace>::create(NameSeg("\\"_sv)));
|
||||
s_root_namespace->scope = AML::NameString("\\"_sv);
|
||||
|
||||
Integer::Constants::Zero = MUST(BAN::RefPtr<Integer>::create(0, true));
|
||||
Integer::Constants::One = MUST(BAN::RefPtr<Integer>::create(1, true));
|
||||
Integer::Constants::Ones = MUST(BAN::RefPtr<Integer>::create(0xFFFFFFFFFFFFFFFF, true));
|
||||
|
||||
AML::ParseContext context;
|
||||
context.scope = AML::NameString("\\"sv);
|
||||
context.scope = AML::NameString("\\"_sv);
|
||||
|
||||
// Add predefined namespaces
|
||||
#define ADD_PREDEFIED_NAMESPACE(NAME) \
|
||||
ASSERT(s_root_namespace->add_named_object(context, AML::NameString("\\" NAME), MUST(BAN::RefPtr<AML::Device>::create(NameSeg(NAME)))));
|
||||
ADD_PREDEFIED_NAMESPACE("_GPE"sv);
|
||||
ADD_PREDEFIED_NAMESPACE("_PR"sv);
|
||||
ADD_PREDEFIED_NAMESPACE("_SB"sv);
|
||||
ADD_PREDEFIED_NAMESPACE("_SI"sv);
|
||||
ADD_PREDEFIED_NAMESPACE("_TZ"sv);
|
||||
ADD_PREDEFIED_NAMESPACE("_GPE"_sv);
|
||||
ADD_PREDEFIED_NAMESPACE("_PR"_sv);
|
||||
ADD_PREDEFIED_NAMESPACE("_SB"_sv);
|
||||
ADD_PREDEFIED_NAMESPACE("_SI"_sv);
|
||||
ADD_PREDEFIED_NAMESPACE("_TZ"_sv);
|
||||
#undef ADD_PREDEFIED_NAMESPACE
|
||||
|
||||
// Add \_OSI that returns true for Linux compatibility
|
||||
auto osi = MUST(BAN::RefPtr<AML::Method>::create(NameSeg("_OSI"sv), 1, false, 0));
|
||||
auto osi = MUST(BAN::RefPtr<AML::Method>::create(NameSeg("_OSI"_sv), 1, false, 0));
|
||||
osi->override_function = [](AML::ParseContext& context) -> BAN::RefPtr<AML::Node> {
|
||||
ASSERT(context.method_args[0]);
|
||||
auto arg = context.method_args[0]->evaluate();
|
||||
|
@ -234,7 +234,7 @@ namespace Kernel::ACPI
|
|||
ASSERT(this == s_root_namespace.ptr());
|
||||
|
||||
AML::ParseContext context;
|
||||
context.scope = AML::NameString("\\"sv);
|
||||
context.scope = AML::NameString("\\"_sv);
|
||||
context.aml_data = BAN::ConstByteSpan(reinterpret_cast<const uint8_t*>(&header), header.length).slice(sizeof(header));
|
||||
|
||||
while (context.aml_data.size() > 0)
|
||||
|
|
|
@ -94,7 +94,7 @@ namespace Kernel::ACPI
|
|||
AML_DEBUG_PRINTLN("Initializing {}", scope->scope);
|
||||
#endif
|
||||
|
||||
if (auto reg = Namespace::root_namespace()->find_object(scope->scope, AML::NameString("_REG"sv), Namespace::FindMode::ForceAbsolute))
|
||||
if (auto reg = Namespace::root_namespace()->find_object(scope->scope, AML::NameString("_REG"_sv), Namespace::FindMode::ForceAbsolute))
|
||||
{
|
||||
bool embedded_controller = false;
|
||||
Namespace::for_each_child(scope->scope,
|
||||
|
@ -135,7 +135,7 @@ namespace Kernel::ACPI
|
|||
bool run_ini = true;
|
||||
bool init_children = true;
|
||||
|
||||
if (auto sta = Namespace::root_namespace()->find_object(scope->scope, AML::NameString("_STA"sv), Namespace::FindMode::ForceAbsolute))
|
||||
if (auto sta = Namespace::root_namespace()->find_object(scope->scope, AML::NameString("_STA"_sv), Namespace::FindMode::ForceAbsolute))
|
||||
{
|
||||
auto result = evaluate_or_invoke(sta);
|
||||
if (!result.has_value())
|
||||
|
@ -150,7 +150,7 @@ namespace Kernel::ACPI
|
|||
|
||||
if (run_ini)
|
||||
{
|
||||
auto ini = Namespace::root_namespace()->find_object(scope->scope, AML::NameString("_INI"sv), Namespace::FindMode::ForceAbsolute);
|
||||
auto ini = Namespace::root_namespace()->find_object(scope->scope, AML::NameString("_INI"_sv), Namespace::FindMode::ForceAbsolute);
|
||||
if (ini)
|
||||
{
|
||||
if (ini->type != AML::Node::Type::Method)
|
||||
|
|
|
@ -132,7 +132,7 @@ namespace Kernel
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
const MADT* madt = (const MADT*)ACPI::ACPI::get().get_header("APIC"sv, 0);
|
||||
const MADT* madt = (const MADT*)ACPI::ACPI::get().get_header("APIC"_sv, 0);
|
||||
if (madt == nullptr)
|
||||
{
|
||||
dprintln("Could not find MADT header");
|
||||
|
|
|
@ -21,7 +21,7 @@ namespace Kernel
|
|||
|
||||
BAN::ErrorOr<BAN::String> Credentials::find_username() const
|
||||
{
|
||||
auto inode = TRY(VirtualFileSystem::get().file_from_absolute_path(*this, "/etc/passwd"sv, O_RDONLY)).inode;
|
||||
auto inode = TRY(VirtualFileSystem::get().file_from_absolute_path(*this, "/etc/passwd"_sv, O_RDONLY)).inode;
|
||||
|
||||
BAN::String line;
|
||||
off_t offset = 0;
|
||||
|
|
|
@ -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--;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
{
|
||||
|
|
|
@ -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())
|
||||
{
|
||||
|
|
|
@ -244,7 +244,7 @@ namespace Kernel::Input
|
|||
// FIXME: Initialise USB Controllers
|
||||
|
||||
// Determine if the PS/2 Controller Exists
|
||||
auto* fadt = static_cast<const ACPI::FADT*>(ACPI::ACPI::get().get_header("FACP"sv, 0));
|
||||
auto* fadt = static_cast<const ACPI::FADT*>(ACPI::ACPI::get().get_header("FACP"_sv, 0));
|
||||
if (fadt && fadt->revision > 1 && !(fadt->iapc_boot_arch & (1 << 1)))
|
||||
{
|
||||
dwarnln_if(DEBUG_PS2, "No PS/2 available");
|
||||
|
|
|
@ -0,0 +1,20 @@
|
|||
#include <kernel/Networking/NetworkLayer.h>
|
||||
|
||||
namespace Kernel
|
||||
{
|
||||
|
||||
uint16_t calculate_internet_checksum(BAN::ConstByteSpan packet, const PseudoHeader& pseudo_header)
|
||||
{
|
||||
uint32_t checksum = 0;
|
||||
for (size_t i = 0; i < sizeof(pseudo_header) / sizeof(uint16_t); i++)
|
||||
checksum += BAN::host_to_network_endian(reinterpret_cast<const uint16_t*>(&pseudo_header)[i]);
|
||||
for (size_t i = 0; i < packet.size() / sizeof(uint16_t); i++)
|
||||
checksum += BAN::host_to_network_endian(reinterpret_cast<const uint16_t*>(packet.data())[i]);
|
||||
if (packet.size() % 2)
|
||||
checksum += (uint16_t)packet[packet.size() - 1] << 8;
|
||||
while (checksum >> 16)
|
||||
checksum = (checksum >> 16) + (checksum & 0xFFFF);
|
||||
return ~(uint16_t)checksum;
|
||||
}
|
||||
|
||||
}
|
|
@ -65,7 +65,7 @@ namespace Kernel
|
|||
|
||||
int fd = TRY(get_free_fd());
|
||||
// FIXME: path?
|
||||
m_open_files[fd] = TRY(BAN::RefPtr<OpenFileDescription>::create(inode, ""sv, 0, flags));
|
||||
m_open_files[fd] = TRY(BAN::RefPtr<OpenFileDescription>::create(inode, ""_sv, 0, flags));
|
||||
|
||||
return fd;
|
||||
}
|
||||
|
@ -141,7 +141,7 @@ namespace Kernel
|
|||
auto socket = TRY(NetworkManager::get().create_socket(sock_domain, sock_type, 0777, m_credentials.euid(), m_credentials.egid()));
|
||||
|
||||
int fd = TRY(get_free_fd());
|
||||
m_open_files[fd] = TRY(BAN::RefPtr<OpenFileDescription>::create(socket, "no-path"sv, 0, O_RDWR));
|
||||
m_open_files[fd] = TRY(BAN::RefPtr<OpenFileDescription>::create(socket, "no-path"_sv, 0, O_RDWR));
|
||||
return fd;
|
||||
}
|
||||
|
||||
|
@ -150,8 +150,8 @@ namespace Kernel
|
|||
TRY(get_free_fd_pair(fds));
|
||||
|
||||
auto pipe = TRY(Pipe::create(m_credentials));
|
||||
m_open_files[fds[0]] = TRY(BAN::RefPtr<OpenFileDescription>::create(pipe, ""sv, 0, O_RDONLY));
|
||||
m_open_files[fds[1]] = TRY(BAN::RefPtr<OpenFileDescription>::create(pipe, ""sv, 0, O_WRONLY));
|
||||
m_open_files[fds[0]] = TRY(BAN::RefPtr<OpenFileDescription>::create(pipe, ""_sv, 0, O_RDONLY));
|
||||
m_open_files[fds[1]] = TRY(BAN::RefPtr<OpenFileDescription>::create(pipe, ""_sv, 0, O_WRONLY));
|
||||
|
||||
return {};
|
||||
}
|
||||
|
|
|
@ -118,7 +118,7 @@ namespace Kernel
|
|||
TRY(process->m_cmdline.push_back({}));
|
||||
TRY(process->m_cmdline.back().append(path));
|
||||
|
||||
process->m_loadable_elf = TRY(load_elf_for_exec(credentials, path, "/"sv, process->page_table()));
|
||||
process->m_loadable_elf = TRY(load_elf_for_exec(credentials, path, "/"_sv, process->page_table()));
|
||||
if (!process->m_loadable_elf->is_address_space_free())
|
||||
{
|
||||
dprintln("Could not load ELF address space");
|
||||
|
@ -1942,7 +1942,7 @@ namespace Kernel
|
|||
{
|
||||
LockGuard _(m_process_lock);
|
||||
|
||||
if (path.empty() || path == "."sv)
|
||||
if (path.empty() || path == "."_sv)
|
||||
return m_working_directory;
|
||||
|
||||
BAN::String absolute_path;
|
||||
|
|
|
@ -30,11 +30,11 @@ namespace Kernel
|
|||
s_tty = this;
|
||||
clear();
|
||||
|
||||
auto inode_or_error = DevFileSystem::get().root_inode()->find_inode("tty"sv);
|
||||
auto inode_or_error = DevFileSystem::get().root_inode()->find_inode("tty"_sv);
|
||||
if (inode_or_error.is_error())
|
||||
{
|
||||
if (inode_or_error.error().get_error_code() == ENOENT)
|
||||
DevFileSystem::get().add_inode("tty"sv, MUST(TmpSymlinkInode::create_new(DevFileSystem::get(), 0666, 0, 0, s_tty->name())));
|
||||
DevFileSystem::get().add_inode("tty"_sv, MUST(TmpSymlinkInode::create_new(DevFileSystem::get(), 0666, 0, 0, s_tty->name())));
|
||||
else
|
||||
dwarnln("{}", inode_or_error.error());
|
||||
return;
|
||||
|
@ -82,7 +82,7 @@ namespace Kernel
|
|||
Process::create_kernel(
|
||||
[](void*)
|
||||
{
|
||||
auto file_or_error = VirtualFileSystem::get().file_from_absolute_path({ 0, 0, 0, 0 }, "/dev/input0"sv, O_RDONLY);
|
||||
auto file_or_error = VirtualFileSystem::get().file_from_absolute_path({ 0, 0, 0, 0 }, "/dev/input0"_sv, O_RDONLY);
|
||||
if (file_or_error.is_error())
|
||||
{
|
||||
dprintln("no input device found");
|
||||
|
|
|
@ -131,7 +131,7 @@ namespace Kernel
|
|||
|
||||
BAN::ErrorOr<void> HPET::initialize(bool force_pic)
|
||||
{
|
||||
auto* header = static_cast<const ACPI::HPET*>(ACPI::ACPI::get().get_header("HPET"sv, 0));
|
||||
auto* header = static_cast<const ACPI::HPET*>(ACPI::ACPI::get().get_header("HPET"_sv, 0));
|
||||
if (header == nullptr)
|
||||
return BAN::Error::from_errno(ENODEV);
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@ struct ParsedCommandLine
|
|||
{
|
||||
bool force_pic = false;
|
||||
bool disable_serial = false;
|
||||
BAN::StringView console = "tty0"sv;
|
||||
BAN::StringView console = "tty0"_sv;
|
||||
BAN::StringView root;
|
||||
};
|
||||
|
||||
|
@ -215,7 +215,7 @@ static void init2(void*)
|
|||
|
||||
TTY::initialize_devices();
|
||||
|
||||
MUST(Process::create_userspace({ 0, 0, 0, 0 }, "/usr/bin/init"sv));
|
||||
MUST(Process::create_userspace({ 0, 0, 0, 0 }, "/usr/bin/init"_sv));
|
||||
}
|
||||
|
||||
extern "C" void ap_main()
|
||||
|
|
|
@ -112,7 +112,7 @@ index 0000000..9161771
|
|||
+
|
||||
+void DG_Init()
|
||||
+{
|
||||
+ s_window = MUST(LibGUI::Window::create(DOOMGENERIC_RESX, DOOMGENERIC_RESY, "DOOM"sv));
|
||||
+ s_window = MUST(LibGUI::Window::create(DOOMGENERIC_RESX, DOOMGENERIC_RESY, "DOOM"_sv));
|
||||
+ s_window->set_key_event_callback(
|
||||
+ [](LibGUI::EventPacket::KeyEvent event)
|
||||
+ {
|
||||
|
|
|
@ -36,7 +36,7 @@ BAN::Optional<BAN::String> parse_dollar(BAN::StringView command, size_t& i)
|
|||
ASSERT(command[i] == '$');
|
||||
|
||||
if (++i >= command.size())
|
||||
return "$"sv;
|
||||
return "$"_sv;
|
||||
|
||||
if (command[i] == '?')
|
||||
{
|
||||
|
@ -54,7 +54,7 @@ BAN::Optional<BAN::String> parse_dollar(BAN::StringView command, size_t& i)
|
|||
|
||||
if (const char* value = getenv(name.data()))
|
||||
return BAN::StringView(value);
|
||||
return ""sv;
|
||||
return ""_sv;
|
||||
}
|
||||
else if (command[i] == '{')
|
||||
{
|
||||
|
@ -75,7 +75,7 @@ BAN::Optional<BAN::String> parse_dollar(BAN::StringView command, size_t& i)
|
|||
|
||||
if (const char* value = getenv(name.data()))
|
||||
return BAN::StringView(value);
|
||||
return ""sv;
|
||||
return ""_sv;
|
||||
}
|
||||
else if (command[i] == '[')
|
||||
{
|
||||
|
@ -156,7 +156,7 @@ BAN::Optional<BAN::String> parse_dollar(BAN::StringView command, size_t& i)
|
|||
return output;
|
||||
}
|
||||
|
||||
BAN::String temp = "$"sv;
|
||||
BAN::String temp = "$"_sv;
|
||||
MUST(temp.push_back(command[i]));
|
||||
return temp;
|
||||
}
|
||||
|
@ -288,16 +288,16 @@ BAN::Optional<int> execute_builtin(BAN::Vector<BAN::String>& args, int fd_in, in
|
|||
}
|
||||
BAN::ScopeGuard _([fout, should_close] { if (should_close) fclose(fout); });
|
||||
|
||||
if (args.front() == "clear"sv)
|
||||
if (args.front() == "clear"_sv)
|
||||
{
|
||||
fprintf(fout, "\e[H\e[2J");
|
||||
fflush(fout);
|
||||
}
|
||||
else if (args.front() == "exit"sv)
|
||||
else if (args.front() == "exit"_sv)
|
||||
{
|
||||
clean_exit();
|
||||
}
|
||||
else if (args.front() == "export"sv)
|
||||
else if (args.front() == "export"_sv)
|
||||
{
|
||||
bool first = false;
|
||||
for (const auto& arg : args)
|
||||
|
@ -316,7 +316,7 @@ BAN::Optional<int> execute_builtin(BAN::Vector<BAN::String>& args, int fd_in, in
|
|||
ERROR_RETURN("setenv", 1);
|
||||
}
|
||||
}
|
||||
else if (args.front() == "source"sv)
|
||||
else if (args.front() == "source"_sv)
|
||||
{
|
||||
if (args.size() != 2)
|
||||
{
|
||||
|
@ -325,13 +325,13 @@ BAN::Optional<int> execute_builtin(BAN::Vector<BAN::String>& args, int fd_in, in
|
|||
}
|
||||
return source_script(args[1]);
|
||||
}
|
||||
else if (args.front() == "env"sv)
|
||||
else if (args.front() == "env"_sv)
|
||||
{
|
||||
char** current = environ;
|
||||
while (*current)
|
||||
fprintf(fout, "%s\n", *current++);
|
||||
}
|
||||
else if (args.front() == "start-gui"sv)
|
||||
else if (args.front() == "start-gui"_sv)
|
||||
{
|
||||
pid_t pid = fork();
|
||||
if (pid == 0)
|
||||
|
@ -340,12 +340,12 @@ BAN::Optional<int> execute_builtin(BAN::Vector<BAN::String>& args, int fd_in, in
|
|||
execl("/bin/Terminal", "Terminal", NULL);
|
||||
waitpid(pid, nullptr, 0);
|
||||
}
|
||||
else if (args.front() == "page-fault-test"sv)
|
||||
else if (args.front() == "page-fault-test"_sv)
|
||||
{
|
||||
volatile int* ptr = nullptr;
|
||||
*ptr = 0;
|
||||
}
|
||||
else if (args.front() == "kill-test"sv)
|
||||
else if (args.front() == "kill-test"_sv)
|
||||
{
|
||||
pid_t pid = fork();
|
||||
if (pid == 0)
|
||||
|
@ -366,7 +366,7 @@ BAN::Optional<int> execute_builtin(BAN::Vector<BAN::String>& args, int fd_in, in
|
|||
return 1;
|
||||
}
|
||||
}
|
||||
else if (args.front() == "signal-test"sv)
|
||||
else if (args.front() == "signal-test"_sv)
|
||||
{
|
||||
pid_t pid = fork();
|
||||
if (pid == 0)
|
||||
|
@ -400,7 +400,7 @@ BAN::Optional<int> execute_builtin(BAN::Vector<BAN::String>& args, int fd_in, in
|
|||
return 1;
|
||||
}
|
||||
}
|
||||
else if (args.front() == "printf-test"sv)
|
||||
else if (args.front() == "printf-test"_sv)
|
||||
{
|
||||
fprintf(fout, " 0.0: %f\n", 0.0f);
|
||||
fprintf(fout, " 123.0: %f\n", 123.0f);
|
||||
|
@ -409,7 +409,7 @@ BAN::Optional<int> execute_builtin(BAN::Vector<BAN::String>& args, int fd_in, in
|
|||
fprintf(fout, "+INF: %f\n", INFINITY);
|
||||
fprintf(fout, "-INF: %f\n", -INFINITY);
|
||||
}
|
||||
else if (args.front() == "cd"sv)
|
||||
else if (args.front() == "cd"_sv)
|
||||
{
|
||||
if (args.size() > 2)
|
||||
{
|
||||
|
@ -432,7 +432,7 @@ BAN::Optional<int> execute_builtin(BAN::Vector<BAN::String>& args, int fd_in, in
|
|||
if (chdir(path.data()) == -1)
|
||||
ERROR_RETURN("chdir", 1);
|
||||
}
|
||||
else if (args.front() == "time"sv)
|
||||
else if (args.front() == "time"_sv)
|
||||
{
|
||||
args.remove(0);
|
||||
|
||||
|
@ -783,7 +783,7 @@ int source_shellrc()
|
|||
if (char* home = getenv("HOME"))
|
||||
{
|
||||
BAN::String path(home);
|
||||
MUST(path.append("/.shellrc"sv));
|
||||
MUST(path.append("/.shellrc"_sv));
|
||||
if (exists(path))
|
||||
return source_script(path);
|
||||
}
|
||||
|
@ -816,7 +816,7 @@ BAN::String get_prompt()
|
|||
{
|
||||
const char* raw_prompt = getenv("PS1");
|
||||
if (raw_prompt == nullptr)
|
||||
return "$ "sv;
|
||||
return "$ "_sv;
|
||||
|
||||
BAN::String prompt;
|
||||
for (int i = 0; raw_prompt[i]; i++)
|
||||
|
@ -962,7 +962,7 @@ int main(int argc, char** argv)
|
|||
tcsetattr(0, TCSANOW, &new_termios);
|
||||
|
||||
BAN::Vector<BAN::String> buffers, history;
|
||||
MUST(buffers.emplace_back(""sv));
|
||||
MUST(buffers.emplace_back(""_sv));
|
||||
size_t index = 0;
|
||||
size_t col = 0;
|
||||
|
||||
|
@ -1073,7 +1073,7 @@ int main(int argc, char** argv)
|
|||
last_return = parse_and_execute_command(buffers[index]);
|
||||
MUST(history.push_back(buffers[index]));
|
||||
buffers = history;
|
||||
MUST(buffers.emplace_back(""sv));
|
||||
MUST(buffers.emplace_back(""_sv));
|
||||
}
|
||||
print_prompt();
|
||||
index = buffers.size() - 1;
|
||||
|
|
|
@ -87,11 +87,11 @@ void Terminal::run()
|
|||
signal(SIGCHLD, [](int) { s_shell_exited = true; });
|
||||
start_shell();
|
||||
|
||||
m_window = MUST(LibGUI::Window::create(600, 400, "Terminal"sv));
|
||||
m_window = MUST(LibGUI::Window::create(600, 400, "Terminal"_sv));
|
||||
m_window->fill(m_bg_color);
|
||||
m_window->invalidate();
|
||||
|
||||
m_font = MUST(LibFont::Font::load("/usr/share/fonts/lat0-16.psfu"sv));
|
||||
m_font = MUST(LibFont::Font::load("/usr/share/fonts/lat0-16.psfu"_sv));
|
||||
|
||||
m_window->set_key_event_callback([&](LibGUI::EventPacket::KeyEvent event) { on_key_event(event); });
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ public:
|
|||
WindowServer(Framebuffer& framebuffer)
|
||||
: m_framebuffer(framebuffer)
|
||||
, m_cursor({ framebuffer.width / 2, framebuffer.height / 2 })
|
||||
, m_font(MUST(LibFont::Font::load("/usr/share/fonts/lat0-16.psfu"sv)))
|
||||
, m_font(MUST(LibFont::Font::load("/usr/share/fonts/lat0-16.psfu"_sv)))
|
||||
{
|
||||
invalidate(m_framebuffer.area());
|
||||
}
|
||||
|
|
|
@ -80,7 +80,7 @@ Config parse_config()
|
|||
auto variable = parts[0];
|
||||
auto value = parts[1];
|
||||
|
||||
if (variable == "bg"sv)
|
||||
if (variable == "bg"_sv)
|
||||
{
|
||||
auto image = LibImage::Image::load_from_file(value);
|
||||
if (image.is_error())
|
||||
|
@ -156,7 +156,7 @@ int main()
|
|||
atexit([]() { tty_ctrl(STDIN_FILENO, TTY_CMD_SET, TTY_FLAG_ENABLE_INPUT); });
|
||||
|
||||
MUST(LibInput::KeyboardLayout::initialize());
|
||||
MUST(LibInput::KeyboardLayout::get().load_from_file("/usr/share/keymaps/us.keymap"sv));
|
||||
MUST(LibInput::KeyboardLayout::get().load_from_file("/usr/share/keymaps/us.keymap"_sv));
|
||||
|
||||
int keyboard_fd = open("/dev/input0", O_RDONLY);
|
||||
if (keyboard_fd == -1)
|
||||
|
|
|
@ -168,9 +168,9 @@ bool is_accepted(const Item& item, const BAN::String& name, const Workflows& wor
|
|||
{
|
||||
if (!satifies_rule(item, rule))
|
||||
continue;
|
||||
if (rule.target == "A"sv)
|
||||
if (rule.target == "A"_sv)
|
||||
return true;
|
||||
if (rule.target == "R"sv)
|
||||
if (rule.target == "R"_sv)
|
||||
return false;
|
||||
return is_accepted(item, rule.target, workflows);
|
||||
}
|
||||
|
@ -185,7 +185,7 @@ i64 puzzle1(FILE* fp)
|
|||
BAN::Vector<Item> accepted;
|
||||
|
||||
for (const auto& item : items)
|
||||
if (is_accepted(item, "in"sv, workflows))
|
||||
if (is_accepted(item, "in"_sv, workflows))
|
||||
MUST(accepted.push_back(item));
|
||||
|
||||
i64 result = 0;
|
||||
|
@ -243,7 +243,7 @@ i64 puzzle2(FILE* fp)
|
|||
values_sorted[2][ai],
|
||||
values_sorted[3][si]
|
||||
}};
|
||||
if (!is_accepted(item, "in"sv, workflows))
|
||||
if (!is_accepted(item, "in"_sv, workflows))
|
||||
continue;
|
||||
|
||||
i64 x_count = values_sorted[0][xi + 1] - values_sorted[0][xi];
|
||||
|
|
|
@ -137,7 +137,7 @@ i64 puzzle1(FILE* fp)
|
|||
|
||||
for (size_t i = 0; i < 1000; i++)
|
||||
{
|
||||
MUST(signal_queue.push({ "broadcaster"sv, ""sv, false }));
|
||||
MUST(signal_queue.push({ "broadcaster"_sv, ""_sv, false }));
|
||||
while (!signal_queue.empty())
|
||||
{
|
||||
auto signal = signal_queue.front();
|
||||
|
|
|
@ -45,8 +45,8 @@ i64 puzzle1(FILE* fp)
|
|||
}
|
||||
}
|
||||
|
||||
u32 current = coord_to_u32("AAA"sv);
|
||||
u32 target = coord_to_u32("ZZZ"sv);
|
||||
u32 current = coord_to_u32("AAA"_sv);
|
||||
u32 target = coord_to_u32("ZZZ"_sv);
|
||||
|
||||
i64 steps = 0;
|
||||
for (; current != target; steps++)
|
||||
|
|
|
@ -44,7 +44,7 @@ typedef struct {
|
|||
|
||||
#define FD_ZERO(setp) \
|
||||
do { \
|
||||
for (int i = 0; i < FD_SETSIZE / __FD_MASK_SIZE; i++) \
|
||||
for (int i = 0; i < (int)FD_SETSIZE / (int)__FD_MASK_SIZE; i++) \
|
||||
(setp)->__bits[i] = (__fd_mask)0; \
|
||||
} while (0)
|
||||
|
||||
|
|
|
@ -8,10 +8,10 @@ __BEGIN_DECLS
|
|||
#define __need_pid_t
|
||||
#include <sys/types.h>
|
||||
|
||||
#define makedev(maj, min) ((dev_t)(maj) << 32 | (dev_t)(min))
|
||||
#define makedev(maj, min) ((dev_t)(maj) << 16 | (dev_t)(min))
|
||||
|
||||
#define major(dev) (((dev) >> 32) & 0xFFFFFFFF)
|
||||
#define minor(dev) ( (dev) & 0xFFFFFFFF)
|
||||
#define major(dev) (((dev) >> 16) & 0xFFFF)
|
||||
#define minor(dev) ( (dev) & 0xFFFF)
|
||||
|
||||
__END_DECLS
|
||||
|
||||
|
|
|
@ -74,7 +74,7 @@ __BEGIN_DECLS
|
|||
|
||||
#if !defined(__dev_t_defined) && (defined(__need_all_types) || defined(__need_dev_t))
|
||||
#define __dev_t_defined 1
|
||||
typedef unsigned long dev_t;
|
||||
typedef unsigned int dev_t;
|
||||
#endif
|
||||
#undef __need_dev_t
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@ namespace LibFont { class Font; }
|
|||
namespace LibGUI
|
||||
{
|
||||
|
||||
static constexpr BAN::StringView s_window_server_socket = "/tmp/window-server.socket"sv;
|
||||
static constexpr BAN::StringView s_window_server_socket = "/tmp/window-server.socket"_sv;
|
||||
|
||||
enum WindowPacketType : uint8_t
|
||||
{
|
||||
|
|
|
@ -608,12 +608,12 @@ namespace LibImage
|
|||
return BAN::Error::from_errno(EINVAL);
|
||||
}
|
||||
|
||||
if (chunk.name == "IHDR"sv)
|
||||
if (chunk.name == "IHDR"_sv)
|
||||
{
|
||||
dwarnln_if(DEBUG_PNG, "PNG stream has IDHR chunk defined multiple times");
|
||||
return BAN::Error::from_errno(EINVAL);
|
||||
}
|
||||
else if (chunk.name == "PLTE"sv)
|
||||
else if (chunk.name == "PLTE"_sv)
|
||||
{
|
||||
if (chunk.data.size() == 0 || chunk.data.size() % 3)
|
||||
{
|
||||
|
@ -639,15 +639,15 @@ namespace LibImage
|
|||
palette[i].a = 0xFF;
|
||||
}
|
||||
}
|
||||
else if (chunk.name == "IDAT"sv)
|
||||
else if (chunk.name == "IDAT"_sv)
|
||||
{
|
||||
TRY(zlib_stream.push_back(chunk.data));
|
||||
}
|
||||
else if (chunk.name == "IEND"sv)
|
||||
else if (chunk.name == "IEND"_sv)
|
||||
{
|
||||
break;
|
||||
}
|
||||
else if (chunk.name == "tEXt"sv)
|
||||
else if (chunk.name == "tEXt"_sv)
|
||||
{
|
||||
auto data_sv = BAN::StringView(chunk.data.as_span<const char>().data(), chunk.data.size());
|
||||
if (auto idx = data_sv.find('\0'); !idx.has_value())
|
||||
|
|
|
@ -63,9 +63,9 @@ namespace LibImage
|
|||
return false;
|
||||
if (height > static_cast<uint64_t>(BAN::numeric_limits<int64_t>::max()))
|
||||
return false;
|
||||
if (BAN::Math::will_multiplication_overflow(width, height))
|
||||
if (BAN::Math::will_multiplication_overflow<uint64_t>(width, height))
|
||||
return false;
|
||||
if (BAN::Math::will_multiplication_overflow(width * height, sizeof(Color)))
|
||||
if (BAN::Math::will_multiplication_overflow<uint64_t>(width * height, sizeof(Color)))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -162,7 +162,7 @@ namespace LibInput
|
|||
if (parts.empty() || parts.front().front() == '#')
|
||||
continue;
|
||||
|
||||
if (parts.front() == "include"sv)
|
||||
if (parts.front() == "include"_sv)
|
||||
{
|
||||
if (parts.size() != 2)
|
||||
{
|
||||
|
@ -228,7 +228,7 @@ namespace LibInput
|
|||
return BAN::Error::from_errno(EINVAL);
|
||||
}
|
||||
|
||||
if (parts.front() == "mod"sv)
|
||||
if (parts.front() == "mod"_sv)
|
||||
{
|
||||
if (parts.size() != 2)
|
||||
{
|
||||
|
@ -236,9 +236,9 @@ namespace LibInput
|
|||
dprintln(" format: mod MODIFIER");
|
||||
return BAN::Error::from_errno(EINVAL);
|
||||
}
|
||||
if (parts[1] == "shift"sv)
|
||||
if (parts[1] == "shift"_sv)
|
||||
shift_is_mod = true;
|
||||
else if (parts[1] == "altgr"sv)
|
||||
else if (parts[1] == "altgr"_sv)
|
||||
altgr_is_mod = true;
|
||||
else
|
||||
{
|
||||
|
@ -282,9 +282,9 @@ namespace LibInput
|
|||
return BAN::Error::from_errno(EINVAL);
|
||||
}
|
||||
|
||||
if (shift_is_mod && pair.front() == "shift"sv)
|
||||
if (shift_is_mod && pair.front() == "shift"_sv)
|
||||
new_layout->m_keycode_to_key_shift[*keycode] = *key;
|
||||
else if (altgr_is_mod && pair.front() == "altgr"sv)
|
||||
else if (altgr_is_mod && pair.front() == "altgr"_sv)
|
||||
new_layout->m_keycode_to_key_altgr[*keycode] = *key;
|
||||
else
|
||||
{
|
||||
|
@ -314,159 +314,159 @@ namespace LibInput
|
|||
static BAN::ErrorOr<void> initialize_name_to_key()
|
||||
{
|
||||
ASSERT(s_name_to_key.empty());
|
||||
TRY(s_name_to_key.insert("A_Ring"sv, Key::A_Ring));
|
||||
TRY(s_name_to_key.insert("A_Umlaut"sv, Key::A_Umlaut));
|
||||
TRY(s_name_to_key.insert("A"sv, Key::A));
|
||||
TRY(s_name_to_key.insert("Acute"sv, Key::Acute));
|
||||
TRY(s_name_to_key.insert("AltGr"sv, Key::AltGr));
|
||||
TRY(s_name_to_key.insert("Ampersand"sv, Key::Ampersand));
|
||||
TRY(s_name_to_key.insert("ArrowDown"sv, Key::ArrowDown));
|
||||
TRY(s_name_to_key.insert("ArrowLeft"sv, Key::ArrowLeft));
|
||||
TRY(s_name_to_key.insert("ArrowRight"sv, Key::ArrowRight));
|
||||
TRY(s_name_to_key.insert("ArrowUp"sv, Key::ArrowUp));
|
||||
TRY(s_name_to_key.insert("Asterix"sv, Key::Asterix));
|
||||
TRY(s_name_to_key.insert("AtSign"sv, Key::AtSign));
|
||||
TRY(s_name_to_key.insert("B"sv, Key::B));
|
||||
TRY(s_name_to_key.insert("BackSlash"sv, Key::BackSlash));
|
||||
TRY(s_name_to_key.insert("Backspace"sv, Key::Backspace));
|
||||
TRY(s_name_to_key.insert("BackTick"sv, Key::BackTick));
|
||||
TRY(s_name_to_key.insert("BrokenBar"sv, Key::BrokenBar));
|
||||
TRY(s_name_to_key.insert("C"sv, Key::C));
|
||||
TRY(s_name_to_key.insert("Calculator"sv, Key::Calculator));
|
||||
TRY(s_name_to_key.insert("CapsLock"sv, Key::CapsLock));
|
||||
TRY(s_name_to_key.insert("Caret"sv, Key::Caret));
|
||||
TRY(s_name_to_key.insert("Cedilla"sv, Key::Cedilla));
|
||||
TRY(s_name_to_key.insert("CloseCurlyBracket"sv, Key::CloseCurlyBracket));
|
||||
TRY(s_name_to_key.insert("CloseParenthesis"sv, Key::CloseParenthesis));
|
||||
TRY(s_name_to_key.insert("CloseSquareBracket"sv, Key::CloseSquareBracket));
|
||||
TRY(s_name_to_key.insert("Colon"sv, Key::Colon));
|
||||
TRY(s_name_to_key.insert("Comma"sv, Key::Comma));
|
||||
TRY(s_name_to_key.insert("Currency"sv, Key::Currency));
|
||||
TRY(s_name_to_key.insert("D"sv, Key::D));
|
||||
TRY(s_name_to_key.insert("Delete"sv, Key::Delete));
|
||||
TRY(s_name_to_key.insert("Dollar"sv, Key::Dollar));
|
||||
TRY(s_name_to_key.insert("DoubleQuote"sv, Key::DoubleQuote));
|
||||
TRY(s_name_to_key.insert("E"sv, Key::E));
|
||||
TRY(s_name_to_key.insert("End"sv, Key::End));
|
||||
TRY(s_name_to_key.insert("Enter"sv, Key::Enter));
|
||||
TRY(s_name_to_key.insert("Equals"sv, Key::Equals));
|
||||
TRY(s_name_to_key.insert("Escape"sv, Key::Escape));
|
||||
TRY(s_name_to_key.insert("Euro"sv, Key::Euro));
|
||||
TRY(s_name_to_key.insert("Exclamation"sv, Key::ExclamationMark));
|
||||
TRY(s_name_to_key.insert("ExclamationMark"sv, Key::ExclamationMark));
|
||||
TRY(s_name_to_key.insert("F"sv, Key::F));
|
||||
TRY(s_name_to_key.insert("F1"sv, Key::F1));
|
||||
TRY(s_name_to_key.insert("F10"sv, Key::F10));
|
||||
TRY(s_name_to_key.insert("F11"sv, Key::F11));
|
||||
TRY(s_name_to_key.insert("F12"sv, Key::F12));
|
||||
TRY(s_name_to_key.insert("F2"sv, Key::F2));
|
||||
TRY(s_name_to_key.insert("F3"sv, Key::F3));
|
||||
TRY(s_name_to_key.insert("F4"sv, Key::F4));
|
||||
TRY(s_name_to_key.insert("F5"sv, Key::F5));
|
||||
TRY(s_name_to_key.insert("F6"sv, Key::F6));
|
||||
TRY(s_name_to_key.insert("F7"sv, Key::F7));
|
||||
TRY(s_name_to_key.insert("F8"sv, Key::F8));
|
||||
TRY(s_name_to_key.insert("F9"sv, Key::F9));
|
||||
TRY(s_name_to_key.insert("G"sv, Key::G));
|
||||
TRY(s_name_to_key.insert("GreaterThan"sv, Key::GreaterThan));
|
||||
TRY(s_name_to_key.insert("H"sv, Key::H));
|
||||
TRY(s_name_to_key.insert("Half"sv, Key::Half));
|
||||
TRY(s_name_to_key.insert("Hashtag"sv, Key::Hashtag));
|
||||
TRY(s_name_to_key.insert("Home"sv, Key::Home));
|
||||
TRY(s_name_to_key.insert("Hyphen"sv, Key::Hyphen));
|
||||
TRY(s_name_to_key.insert("I"sv, Key::I));
|
||||
TRY(s_name_to_key.insert("Insert"sv, Key::Insert));
|
||||
TRY(s_name_to_key.insert("J"sv, Key::J));
|
||||
TRY(s_name_to_key.insert("K"sv, Key::K));
|
||||
TRY(s_name_to_key.insert("Key0"sv, Key::_0));
|
||||
TRY(s_name_to_key.insert("Key1"sv, Key::_1));
|
||||
TRY(s_name_to_key.insert("Key2"sv, Key::_2));
|
||||
TRY(s_name_to_key.insert("Key3"sv, Key::_3));
|
||||
TRY(s_name_to_key.insert("Key4"sv, Key::_4));
|
||||
TRY(s_name_to_key.insert("Key5"sv, Key::_5));
|
||||
TRY(s_name_to_key.insert("Key6"sv, Key::_6));
|
||||
TRY(s_name_to_key.insert("Key7"sv, Key::_7));
|
||||
TRY(s_name_to_key.insert("Key8"sv, Key::_8));
|
||||
TRY(s_name_to_key.insert("Key9"sv, Key::_9));
|
||||
TRY(s_name_to_key.insert("L"sv, Key::L));
|
||||
TRY(s_name_to_key.insert("LAlt"sv, Key::LeftAlt));
|
||||
TRY(s_name_to_key.insert("LControl"sv, Key::LeftCtrl));
|
||||
TRY(s_name_to_key.insert("LeftAlt"sv, Key::LeftAlt));
|
||||
TRY(s_name_to_key.insert("LeftControl"sv, Key::LeftCtrl));
|
||||
TRY(s_name_to_key.insert("LeftShift"sv, Key::LeftShift));
|
||||
TRY(s_name_to_key.insert("LessThan"sv, Key::LessThan));
|
||||
TRY(s_name_to_key.insert("LShift"sv, Key::LeftShift));
|
||||
TRY(s_name_to_key.insert("M"sv, Key::M));
|
||||
TRY(s_name_to_key.insert("MediaNext"sv, Key::MediaNext));
|
||||
TRY(s_name_to_key.insert("MediaPlayPause"sv, Key::MediaPlayPause));
|
||||
TRY(s_name_to_key.insert("MediaPrevious"sv, Key::MediaPrevious));
|
||||
TRY(s_name_to_key.insert("MediaStop"sv, Key::MediaStop));
|
||||
TRY(s_name_to_key.insert("N"sv, Key::N));
|
||||
TRY(s_name_to_key.insert("Negation"sv, Key::Negation));
|
||||
TRY(s_name_to_key.insert("None"sv, Key::None));
|
||||
TRY(s_name_to_key.insert("NumLock"sv, Key::NumLock));
|
||||
TRY(s_name_to_key.insert("Numpad0"sv, Key::Numpad0));
|
||||
TRY(s_name_to_key.insert("Numpad1"sv, Key::Numpad1));
|
||||
TRY(s_name_to_key.insert("Numpad2"sv, Key::Numpad2));
|
||||
TRY(s_name_to_key.insert("Numpad3"sv, Key::Numpad3));
|
||||
TRY(s_name_to_key.insert("Numpad4"sv, Key::Numpad4));
|
||||
TRY(s_name_to_key.insert("Numpad5"sv, Key::Numpad5));
|
||||
TRY(s_name_to_key.insert("Numpad6"sv, Key::Numpad6));
|
||||
TRY(s_name_to_key.insert("Numpad7"sv, Key::Numpad7));
|
||||
TRY(s_name_to_key.insert("Numpad8"sv, Key::Numpad8));
|
||||
TRY(s_name_to_key.insert("Numpad9"sv, Key::Numpad9));
|
||||
TRY(s_name_to_key.insert("NumpadDecimal"sv, Key::NumpadDecimal));
|
||||
TRY(s_name_to_key.insert("NumpadDivide"sv, Key::NumpadDivide));
|
||||
TRY(s_name_to_key.insert("NumpadEnter"sv, Key::NumpadEnter));
|
||||
TRY(s_name_to_key.insert("NumpadMinus"sv, Key::NumpadMinus));
|
||||
TRY(s_name_to_key.insert("NumpadMultiply"sv, Key::NumpadMultiply));
|
||||
TRY(s_name_to_key.insert("NumpadPlus"sv, Key::NumpadPlus));
|
||||
TRY(s_name_to_key.insert("O_Umlaut"sv, Key::O_Umlaut));
|
||||
TRY(s_name_to_key.insert("O"sv, Key::O));
|
||||
TRY(s_name_to_key.insert("OpenCurlyBracket"sv, Key::OpenCurlyBracket));
|
||||
TRY(s_name_to_key.insert("OpenParenthesis"sv, Key::OpenParenthesis));
|
||||
TRY(s_name_to_key.insert("OpenSquareBracket"sv, Key::OpenSquareBracket));
|
||||
TRY(s_name_to_key.insert("P"sv, Key::P));
|
||||
TRY(s_name_to_key.insert("PageDown"sv, Key::PageDown));
|
||||
TRY(s_name_to_key.insert("PageUp"sv, Key::PageUp));
|
||||
TRY(s_name_to_key.insert("Percent"sv, Key::Percent));
|
||||
TRY(s_name_to_key.insert("Period"sv, Key::Period));
|
||||
TRY(s_name_to_key.insert("Pipe"sv, Key::Pipe));
|
||||
TRY(s_name_to_key.insert("Plus"sv, Key::Plus));
|
||||
TRY(s_name_to_key.insert("Pound"sv, Key::Pound));
|
||||
TRY(s_name_to_key.insert("PrintScreen"sv, Key::PrintScreen));
|
||||
TRY(s_name_to_key.insert("Q"sv, Key::Q));
|
||||
TRY(s_name_to_key.insert("Question"sv, Key::QuestionMark));
|
||||
TRY(s_name_to_key.insert("QuestionMark"sv, Key::QuestionMark));
|
||||
TRY(s_name_to_key.insert("R"sv, Key::R));
|
||||
TRY(s_name_to_key.insert("RAlt"sv, Key::RightAlt));
|
||||
TRY(s_name_to_key.insert("RControl"sv, Key::RightCtrl));
|
||||
TRY(s_name_to_key.insert("RightAlt"sv, Key::RightAlt));
|
||||
TRY(s_name_to_key.insert("RightControl"sv, Key::RightCtrl));
|
||||
TRY(s_name_to_key.insert("RightShift"sv, Key::RightShift));
|
||||
TRY(s_name_to_key.insert("RShift"sv, Key::RightShift));
|
||||
TRY(s_name_to_key.insert("S"sv, Key::S));
|
||||
TRY(s_name_to_key.insert("ScrollLock"sv, Key::ScrollLock));
|
||||
TRY(s_name_to_key.insert("Section"sv, Key::Section));
|
||||
TRY(s_name_to_key.insert("Semicolon"sv, Key::Semicolon));
|
||||
TRY(s_name_to_key.insert("SingleQuote"sv, Key::SingleQuote));
|
||||
TRY(s_name_to_key.insert("Slash"sv, Key::Slash));
|
||||
TRY(s_name_to_key.insert("Space"sv, Key::Space));
|
||||
TRY(s_name_to_key.insert("Super"sv, Key::Super));
|
||||
TRY(s_name_to_key.insert("T"sv, Key::T));
|
||||
TRY(s_name_to_key.insert("Tab"sv, Key::Tab));
|
||||
TRY(s_name_to_key.insert("Tilde"sv, Key::Tilde));
|
||||
TRY(s_name_to_key.insert("TwoDots"sv, Key::TwoDots));
|
||||
TRY(s_name_to_key.insert("U"sv, Key::U));
|
||||
TRY(s_name_to_key.insert("Underscore"sv, Key::Underscore));
|
||||
TRY(s_name_to_key.insert("V"sv, Key::V));
|
||||
TRY(s_name_to_key.insert("VolumeDown"sv, Key::VolumeDown));
|
||||
TRY(s_name_to_key.insert("VolumeMute"sv, Key::VolumeMute));
|
||||
TRY(s_name_to_key.insert("VolumeUp"sv, Key::VolumeUp));
|
||||
TRY(s_name_to_key.insert("W"sv, Key::W));
|
||||
TRY(s_name_to_key.insert("X"sv, Key::X));
|
||||
TRY(s_name_to_key.insert("Y"sv, Key::Y));
|
||||
TRY(s_name_to_key.insert("Z"sv, Key::Z));
|
||||
TRY(s_name_to_key.insert("A_Ring"_sv, Key::A_Ring));
|
||||
TRY(s_name_to_key.insert("A_Umlaut"_sv, Key::A_Umlaut));
|
||||
TRY(s_name_to_key.insert("A"_sv, Key::A));
|
||||
TRY(s_name_to_key.insert("Acute"_sv, Key::Acute));
|
||||
TRY(s_name_to_key.insert("AltGr"_sv, Key::AltGr));
|
||||
TRY(s_name_to_key.insert("Ampersand"_sv, Key::Ampersand));
|
||||
TRY(s_name_to_key.insert("ArrowDown"_sv, Key::ArrowDown));
|
||||
TRY(s_name_to_key.insert("ArrowLeft"_sv, Key::ArrowLeft));
|
||||
TRY(s_name_to_key.insert("ArrowRight"_sv, Key::ArrowRight));
|
||||
TRY(s_name_to_key.insert("ArrowUp"_sv, Key::ArrowUp));
|
||||
TRY(s_name_to_key.insert("Asterix"_sv, Key::Asterix));
|
||||
TRY(s_name_to_key.insert("AtSign"_sv, Key::AtSign));
|
||||
TRY(s_name_to_key.insert("B"_sv, Key::B));
|
||||
TRY(s_name_to_key.insert("BackSlash"_sv, Key::BackSlash));
|
||||
TRY(s_name_to_key.insert("Backspace"_sv, Key::Backspace));
|
||||
TRY(s_name_to_key.insert("BackTick"_sv, Key::BackTick));
|
||||
TRY(s_name_to_key.insert("BrokenBar"_sv, Key::BrokenBar));
|
||||
TRY(s_name_to_key.insert("C"_sv, Key::C));
|
||||
TRY(s_name_to_key.insert("Calculator"_sv, Key::Calculator));
|
||||
TRY(s_name_to_key.insert("CapsLock"_sv, Key::CapsLock));
|
||||
TRY(s_name_to_key.insert("Caret"_sv, Key::Caret));
|
||||
TRY(s_name_to_key.insert("Cedilla"_sv, Key::Cedilla));
|
||||
TRY(s_name_to_key.insert("CloseCurlyBracket"_sv, Key::CloseCurlyBracket));
|
||||
TRY(s_name_to_key.insert("CloseParenthesis"_sv, Key::CloseParenthesis));
|
||||
TRY(s_name_to_key.insert("CloseSquareBracket"_sv, Key::CloseSquareBracket));
|
||||
TRY(s_name_to_key.insert("Colon"_sv, Key::Colon));
|
||||
TRY(s_name_to_key.insert("Comma"_sv, Key::Comma));
|
||||
TRY(s_name_to_key.insert("Currency"_sv, Key::Currency));
|
||||
TRY(s_name_to_key.insert("D"_sv, Key::D));
|
||||
TRY(s_name_to_key.insert("Delete"_sv, Key::Delete));
|
||||
TRY(s_name_to_key.insert("Dollar"_sv, Key::Dollar));
|
||||
TRY(s_name_to_key.insert("DoubleQuote"_sv, Key::DoubleQuote));
|
||||
TRY(s_name_to_key.insert("E"_sv, Key::E));
|
||||
TRY(s_name_to_key.insert("End"_sv, Key::End));
|
||||
TRY(s_name_to_key.insert("Enter"_sv, Key::Enter));
|
||||
TRY(s_name_to_key.insert("Equals"_sv, Key::Equals));
|
||||
TRY(s_name_to_key.insert("Escape"_sv, Key::Escape));
|
||||
TRY(s_name_to_key.insert("Euro"_sv, Key::Euro));
|
||||
TRY(s_name_to_key.insert("Exclamation"_sv, Key::ExclamationMark));
|
||||
TRY(s_name_to_key.insert("ExclamationMark"_sv, Key::ExclamationMark));
|
||||
TRY(s_name_to_key.insert("F"_sv, Key::F));
|
||||
TRY(s_name_to_key.insert("F1"_sv, Key::F1));
|
||||
TRY(s_name_to_key.insert("F10"_sv, Key::F10));
|
||||
TRY(s_name_to_key.insert("F11"_sv, Key::F11));
|
||||
TRY(s_name_to_key.insert("F12"_sv, Key::F12));
|
||||
TRY(s_name_to_key.insert("F2"_sv, Key::F2));
|
||||
TRY(s_name_to_key.insert("F3"_sv, Key::F3));
|
||||
TRY(s_name_to_key.insert("F4"_sv, Key::F4));
|
||||
TRY(s_name_to_key.insert("F5"_sv, Key::F5));
|
||||
TRY(s_name_to_key.insert("F6"_sv, Key::F6));
|
||||
TRY(s_name_to_key.insert("F7"_sv, Key::F7));
|
||||
TRY(s_name_to_key.insert("F8"_sv, Key::F8));
|
||||
TRY(s_name_to_key.insert("F9"_sv, Key::F9));
|
||||
TRY(s_name_to_key.insert("G"_sv, Key::G));
|
||||
TRY(s_name_to_key.insert("GreaterThan"_sv, Key::GreaterThan));
|
||||
TRY(s_name_to_key.insert("H"_sv, Key::H));
|
||||
TRY(s_name_to_key.insert("Half"_sv, Key::Half));
|
||||
TRY(s_name_to_key.insert("Hashtag"_sv, Key::Hashtag));
|
||||
TRY(s_name_to_key.insert("Home"_sv, Key::Home));
|
||||
TRY(s_name_to_key.insert("Hyphen"_sv, Key::Hyphen));
|
||||
TRY(s_name_to_key.insert("I"_sv, Key::I));
|
||||
TRY(s_name_to_key.insert("Insert"_sv, Key::Insert));
|
||||
TRY(s_name_to_key.insert("J"_sv, Key::J));
|
||||
TRY(s_name_to_key.insert("K"_sv, Key::K));
|
||||
TRY(s_name_to_key.insert("Key0"_sv, Key::_0));
|
||||
TRY(s_name_to_key.insert("Key1"_sv, Key::_1));
|
||||
TRY(s_name_to_key.insert("Key2"_sv, Key::_2));
|
||||
TRY(s_name_to_key.insert("Key3"_sv, Key::_3));
|
||||
TRY(s_name_to_key.insert("Key4"_sv, Key::_4));
|
||||
TRY(s_name_to_key.insert("Key5"_sv, Key::_5));
|
||||
TRY(s_name_to_key.insert("Key6"_sv, Key::_6));
|
||||
TRY(s_name_to_key.insert("Key7"_sv, Key::_7));
|
||||
TRY(s_name_to_key.insert("Key8"_sv, Key::_8));
|
||||
TRY(s_name_to_key.insert("Key9"_sv, Key::_9));
|
||||
TRY(s_name_to_key.insert("L"_sv, Key::L));
|
||||
TRY(s_name_to_key.insert("LAlt"_sv, Key::LeftAlt));
|
||||
TRY(s_name_to_key.insert("LControl"_sv, Key::LeftCtrl));
|
||||
TRY(s_name_to_key.insert("LeftAlt"_sv, Key::LeftAlt));
|
||||
TRY(s_name_to_key.insert("LeftControl"_sv, Key::LeftCtrl));
|
||||
TRY(s_name_to_key.insert("LeftShift"_sv, Key::LeftShift));
|
||||
TRY(s_name_to_key.insert("LessThan"_sv, Key::LessThan));
|
||||
TRY(s_name_to_key.insert("LShift"_sv, Key::LeftShift));
|
||||
TRY(s_name_to_key.insert("M"_sv, Key::M));
|
||||
TRY(s_name_to_key.insert("MediaNext"_sv, Key::MediaNext));
|
||||
TRY(s_name_to_key.insert("MediaPlayPause"_sv, Key::MediaPlayPause));
|
||||
TRY(s_name_to_key.insert("MediaPrevious"_sv, Key::MediaPrevious));
|
||||
TRY(s_name_to_key.insert("MediaStop"_sv, Key::MediaStop));
|
||||
TRY(s_name_to_key.insert("N"_sv, Key::N));
|
||||
TRY(s_name_to_key.insert("Negation"_sv, Key::Negation));
|
||||
TRY(s_name_to_key.insert("None"_sv, Key::None));
|
||||
TRY(s_name_to_key.insert("NumLock"_sv, Key::NumLock));
|
||||
TRY(s_name_to_key.insert("Numpad0"_sv, Key::Numpad0));
|
||||
TRY(s_name_to_key.insert("Numpad1"_sv, Key::Numpad1));
|
||||
TRY(s_name_to_key.insert("Numpad2"_sv, Key::Numpad2));
|
||||
TRY(s_name_to_key.insert("Numpad3"_sv, Key::Numpad3));
|
||||
TRY(s_name_to_key.insert("Numpad4"_sv, Key::Numpad4));
|
||||
TRY(s_name_to_key.insert("Numpad5"_sv, Key::Numpad5));
|
||||
TRY(s_name_to_key.insert("Numpad6"_sv, Key::Numpad6));
|
||||
TRY(s_name_to_key.insert("Numpad7"_sv, Key::Numpad7));
|
||||
TRY(s_name_to_key.insert("Numpad8"_sv, Key::Numpad8));
|
||||
TRY(s_name_to_key.insert("Numpad9"_sv, Key::Numpad9));
|
||||
TRY(s_name_to_key.insert("NumpadDecimal"_sv, Key::NumpadDecimal));
|
||||
TRY(s_name_to_key.insert("NumpadDivide"_sv, Key::NumpadDivide));
|
||||
TRY(s_name_to_key.insert("NumpadEnter"_sv, Key::NumpadEnter));
|
||||
TRY(s_name_to_key.insert("NumpadMinus"_sv, Key::NumpadMinus));
|
||||
TRY(s_name_to_key.insert("NumpadMultiply"_sv, Key::NumpadMultiply));
|
||||
TRY(s_name_to_key.insert("NumpadPlus"_sv, Key::NumpadPlus));
|
||||
TRY(s_name_to_key.insert("O_Umlaut"_sv, Key::O_Umlaut));
|
||||
TRY(s_name_to_key.insert("O"_sv, Key::O));
|
||||
TRY(s_name_to_key.insert("OpenCurlyBracket"_sv, Key::OpenCurlyBracket));
|
||||
TRY(s_name_to_key.insert("OpenParenthesis"_sv, Key::OpenParenthesis));
|
||||
TRY(s_name_to_key.insert("OpenSquareBracket"_sv, Key::OpenSquareBracket));
|
||||
TRY(s_name_to_key.insert("P"_sv, Key::P));
|
||||
TRY(s_name_to_key.insert("PageDown"_sv, Key::PageDown));
|
||||
TRY(s_name_to_key.insert("PageUp"_sv, Key::PageUp));
|
||||
TRY(s_name_to_key.insert("Percent"_sv, Key::Percent));
|
||||
TRY(s_name_to_key.insert("Period"_sv, Key::Period));
|
||||
TRY(s_name_to_key.insert("Pipe"_sv, Key::Pipe));
|
||||
TRY(s_name_to_key.insert("Plus"_sv, Key::Plus));
|
||||
TRY(s_name_to_key.insert("Pound"_sv, Key::Pound));
|
||||
TRY(s_name_to_key.insert("PrintScreen"_sv, Key::PrintScreen));
|
||||
TRY(s_name_to_key.insert("Q"_sv, Key::Q));
|
||||
TRY(s_name_to_key.insert("Question"_sv, Key::QuestionMark));
|
||||
TRY(s_name_to_key.insert("QuestionMark"_sv, Key::QuestionMark));
|
||||
TRY(s_name_to_key.insert("R"_sv, Key::R));
|
||||
TRY(s_name_to_key.insert("RAlt"_sv, Key::RightAlt));
|
||||
TRY(s_name_to_key.insert("RControl"_sv, Key::RightCtrl));
|
||||
TRY(s_name_to_key.insert("RightAlt"_sv, Key::RightAlt));
|
||||
TRY(s_name_to_key.insert("RightControl"_sv, Key::RightCtrl));
|
||||
TRY(s_name_to_key.insert("RightShift"_sv, Key::RightShift));
|
||||
TRY(s_name_to_key.insert("RShift"_sv, Key::RightShift));
|
||||
TRY(s_name_to_key.insert("S"_sv, Key::S));
|
||||
TRY(s_name_to_key.insert("ScrollLock"_sv, Key::ScrollLock));
|
||||
TRY(s_name_to_key.insert("Section"_sv, Key::Section));
|
||||
TRY(s_name_to_key.insert("Semicolon"_sv, Key::Semicolon));
|
||||
TRY(s_name_to_key.insert("SingleQuote"_sv, Key::SingleQuote));
|
||||
TRY(s_name_to_key.insert("Slash"_sv, Key::Slash));
|
||||
TRY(s_name_to_key.insert("Space"_sv, Key::Space));
|
||||
TRY(s_name_to_key.insert("Super"_sv, Key::Super));
|
||||
TRY(s_name_to_key.insert("T"_sv, Key::T));
|
||||
TRY(s_name_to_key.insert("Tab"_sv, Key::Tab));
|
||||
TRY(s_name_to_key.insert("Tilde"_sv, Key::Tilde));
|
||||
TRY(s_name_to_key.insert("TwoDots"_sv, Key::TwoDots));
|
||||
TRY(s_name_to_key.insert("U"_sv, Key::U));
|
||||
TRY(s_name_to_key.insert("Underscore"_sv, Key::Underscore));
|
||||
TRY(s_name_to_key.insert("V"_sv, Key::V));
|
||||
TRY(s_name_to_key.insert("VolumeDown"_sv, Key::VolumeDown));
|
||||
TRY(s_name_to_key.insert("VolumeMute"_sv, Key::VolumeMute));
|
||||
TRY(s_name_to_key.insert("VolumeUp"_sv, Key::VolumeUp));
|
||||
TRY(s_name_to_key.insert("W"_sv, Key::W));
|
||||
TRY(s_name_to_key.insert("X"_sv, Key::X));
|
||||
TRY(s_name_to_key.insert("Y"_sv, Key::Y));
|
||||
TRY(s_name_to_key.insert("Z"_sv, Key::Z));
|
||||
return {};
|
||||
}
|
||||
#pragma GCC diagnostic pop
|
||||
|
|
|
@ -11,7 +11,7 @@ namespace LibInput
|
|||
bits 7:5 row (from top)
|
||||
*/
|
||||
|
||||
#define BANAN_CONSTEVAL_STATIC_ASSERT(cond) do { int dummy = 1 / (cond); } while (false)
|
||||
#define BANAN_CONSTEVAL_STATIC_ASSERT(cond) do { int dummy = 1 / (cond); (void)dummy; } while (false)
|
||||
|
||||
consteval uint8_t keycode_function(uint8_t index)
|
||||
{
|
||||
|
|
|
@ -297,7 +297,7 @@ int main(int argc, const char* argv[])
|
|||
BAN::Vector<BAN::String> files;
|
||||
|
||||
if (i == argc)
|
||||
MUST(files.emplace_back("."sv));
|
||||
MUST(files.emplace_back("."_sv));
|
||||
else for (; i < argc; i++)
|
||||
MUST(files.emplace_back(BAN::StringView(argv[i])));
|
||||
|
||||
|
|
|
@ -212,6 +212,9 @@ int main(int, char**)
|
|||
|
||||
struct Client
|
||||
{
|
||||
Client(int socket)
|
||||
: socket(socket)
|
||||
{ }
|
||||
const int socket;
|
||||
bool close { false };
|
||||
uint16_t query_id { 0 };
|
||||
|
|
|
@ -66,7 +66,7 @@ int main(int argc, char** argv)
|
|||
|
||||
printf(" File: %s\n", argv[i]);
|
||||
printf(" Size: %-15ld Blocks: %-10ld IO Block: %-6ld %s\n", st.st_size, st.st_blocks, st.st_blksize, type);
|
||||
printf("Device: %lu,%-5lu Inode: %-11llu Links: %-5lu Device type: %lu,%lu\n", major(st.st_dev), minor(st.st_dev), st.st_ino, st.st_nlink, major(st.st_rdev), minor(st.st_rdev));
|
||||
printf("Device: %u,%-5u Inode: %-11llu Links: %-5lu Device type: %u,%u\n", major(st.st_dev), minor(st.st_dev), st.st_ino, st.st_nlink, major(st.st_rdev), minor(st.st_rdev));
|
||||
printf("Access: (%04o/%s) Uid: %5d Gid: %5d\n", st.st_mode & (S_IRWXU | S_IRWXG | S_IRWXO | S_ISUID | S_ISGID | S_ISVTX), access, st.st_uid, st.st_gid);
|
||||
printf("Access: "); print_timestamp(st.st_atim); printf("\n");
|
||||
printf("Modify: "); print_timestamp(st.st_mtim); printf("\n");
|
||||
|
|
Loading…
Reference in New Issue