From 921d95d18fff7be1c74365cd5d47bf58e59f1025 Mon Sep 17 00:00:00 2001 From: Bananymous Date: Sat, 9 Sep 2023 22:52:03 +0300 Subject: [PATCH] All: Clear lines with only whitspace in them --- BAN/BAN/String.cpp | 2 +- BAN/BAN/StringView.cpp | 2 +- BAN/BAN/Time.cpp | 2 +- BAN/include/BAN/Formatter.h | 9 ++++----- BAN/include/BAN/ForwardList.h | 2 +- BAN/include/BAN/HashSet.h | 4 ---- BAN/include/BAN/LinkedList.h | 8 ++------ BAN/include/BAN/Optional.h | 4 ++-- BAN/include/BAN/Traits.h | 4 ++-- BAN/include/BAN/Vector.h | 2 +- LibELF/LibELF/ELF.cpp | 6 ++---- LibELF/include/LibELF/Types.h | 1 - bochs.sh | 2 +- kernel/arch/i386/IDT.cpp | 2 +- kernel/arch/i386/MMU.cpp | 1 - kernel/arch/x86_64/PageTable.cpp | 2 +- kernel/arch/x86_64/boot.S | 2 +- kernel/icxxabi.cpp | 10 ++++------ kernel/include/kernel/API/DirectoryEntry.h | 2 +- kernel/include/kernel/CPUID.h | 2 +- kernel/include/kernel/CriticalScope.h | 2 +- kernel/include/kernel/Device/NullDevice.h | 2 +- kernel/include/kernel/Device/ZeroDevice.h | 2 +- kernel/include/kernel/FS/DevFS/FileSystem.h | 4 ++-- kernel/include/kernel/FS/FileSystem.h | 2 +- kernel/include/kernel/FS/RamFS/FileSystem.h | 2 +- kernel/include/kernel/FS/RamFS/Inode.h | 8 ++++---- kernel/include/kernel/LockGuard.h | 2 +- kernel/include/kernel/Memory/Heap.h | 2 +- kernel/include/kernel/Memory/Types.h | 2 +- kernel/include/kernel/Storage/ATAController.h | 2 +- kernel/include/kernel/Storage/StorageDevice.h | 2 +- kernel/include/kernel/Terminal/Serial.h | 4 ++-- kernel/include/kernel/Terminal/VirtualTTY.h | 2 +- kernel/include/kernel/Terminal/termios.h | 2 +- kernel/include/kernel/Thread.h | 2 +- kernel/include/kernel/Timer/RTC.h | 2 +- kernel/kernel/Device/ZeroDevice.cpp | 1 - kernel/kernel/FS/Pipe.cpp | 8 ++++---- kernel/kernel/FS/RamFS/Inode.cpp | 6 +++--- kernel/kernel/FS/VirtualFileSystem.cpp | 2 +- kernel/kernel/Font.cpp | 2 +- kernel/kernel/Input/PS2Keyboard.cpp | 2 +- kernel/kernel/Memory/Heap.cpp | 2 +- kernel/kernel/Memory/kmalloc.cpp | 4 ++-- kernel/kernel/OpenFileDescriptorSet.cpp | 1 - kernel/kernel/Process.cpp | 2 +- kernel/kernel/SSP.cpp | 4 ++-- kernel/kernel/Scheduler.cpp | 2 +- kernel/kernel/Storage/ATABus.cpp | 2 +- kernel/kernel/Terminal/Serial.cpp | 6 +++--- kernel/kernel/Terminal/VesaTerminalDriver.cpp | 1 - kernel/kernel/Thread.cpp | 1 - kernel/kernel/Timer/PIT.cpp | 2 +- kernel/kernel/kernel.cpp | 2 +- kernel/ubsan.cpp | 6 +++--- libc/dirent.cpp | 2 +- libc/include/string.h | 1 - libc/include/sys/stat.h | 1 - libc/printf_impl.cpp | 9 ++++----- libc/pwd.cpp | 2 +- libc/stdio.cpp | 16 ++++++++-------- libc/stdlib.cpp | 1 - libc/string.cpp | 1 - libc/unistd.cpp | 6 +++--- qemu.sh | 2 +- userspace/ls/main.cpp | 4 ++-- 67 files changed, 95 insertions(+), 119 deletions(-) diff --git a/BAN/BAN/String.cpp b/BAN/BAN/String.cpp index 24d67892a7..96f2693618 100644 --- a/BAN/BAN/String.cpp +++ b/BAN/BAN/String.cpp @@ -119,7 +119,7 @@ namespace BAN m_size -= count; m_data[m_size] = '\0'; } - + void String::clear() { m_size = 0; diff --git a/BAN/BAN/StringView.cpp b/BAN/BAN/StringView.cpp index 33565bd379..3998455d06 100644 --- a/BAN/BAN/StringView.cpp +++ b/BAN/BAN/StringView.cpp @@ -171,7 +171,7 @@ namespace BAN { return m_size; } - + const char* StringView::data() const { return m_data; diff --git a/BAN/BAN/Time.cpp b/BAN/BAN/Time.cpp index 8090cd3432..fab1db09ff 100644 --- a/BAN/BAN/Time.cpp +++ b/BAN/BAN/Time.cpp @@ -24,7 +24,7 @@ namespace BAN leap_years++; return leap_years; } - + static constexpr uint64_t month_days[] { 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334 }; uint64_t to_unix_time(const BAN::Time& time) diff --git a/BAN/include/BAN/Formatter.h b/BAN/include/BAN/Formatter.h index b0761d9dc0..56432f3a8e 100644 --- a/BAN/include/BAN/Formatter.h +++ b/BAN/include/BAN/Formatter.h @@ -28,9 +28,8 @@ namespace BAN::Formatter static size_t parse_format_and_print_argument(F putc, const char* format, T&& arg); } - /* - + IMPLEMENTATION */ @@ -42,7 +41,7 @@ namespace BAN::Formatter int fill = 0; bool upper = false; }; - + template void print(F putc, const char* format) { @@ -232,7 +231,7 @@ namespace BAN::Formatter } /* - + TEMPLATE SPECIALIZATIONS */ @@ -245,5 +244,5 @@ namespace BAN::Formatter template void print_argument(F putc, bool value, const ValueFormat&) { print(putc, value ? "true" : "false"); } template void print_argument(F putc, const char* value, const ValueFormat&) { print(putc, value); } template void print_argument(F putc, char* value, const ValueFormat&) { print(putc, value); } - + } diff --git a/BAN/include/BAN/ForwardList.h b/BAN/include/BAN/ForwardList.h index 461d2865d2..bc7601dff9 100644 --- a/BAN/include/BAN/ForwardList.h +++ b/BAN/include/BAN/ForwardList.h @@ -5,7 +5,7 @@ namespace BAN { - + template class Array; template class ErrorOr; template class Function; diff --git a/BAN/include/BAN/HashSet.h b/BAN/include/BAN/HashSet.h index 4e7e1aeb8a..58845fc893 100644 --- a/BAN/include/BAN/HashSet.h +++ b/BAN/include/BAN/HashSet.h @@ -85,8 +85,6 @@ namespace BAN friend class HashSet; }; - - template HashSet::HashSet(const HashSet& other) : m_buckets(other.m_buckets) @@ -231,8 +229,6 @@ namespace BAN return m_buckets[index]; } - - template HashSetIterator& HashSetIterator::operator++() { diff --git a/BAN/include/BAN/LinkedList.h b/BAN/include/BAN/LinkedList.h index 6e8ecc0f86..a7cca31fe6 100644 --- a/BAN/include/BAN/LinkedList.h +++ b/BAN/include/BAN/LinkedList.h @@ -9,7 +9,7 @@ namespace BAN template class LinkedListIterator; - + template class LinkedList { @@ -114,8 +114,6 @@ namespace BAN friend class LinkedListIterator; }; - - template LinkedList& LinkedList::operator=(const LinkedList& other) { @@ -293,8 +291,6 @@ namespace BAN return node; } - - template template LinkedListIterator::LinkedListIterator(const LinkedListIterator& other, enable_if_t*) @@ -379,7 +375,7 @@ namespace BAN ASSERT(m_current); return &m_current->value; } - + template bool LinkedListIterator::operator==(const LinkedListIterator& other) const { diff --git a/BAN/include/BAN/Optional.h b/BAN/include/BAN/Optional.h index 5a1845f87d..51f9927ed3 100644 --- a/BAN/include/BAN/Optional.h +++ b/BAN/include/BAN/Optional.h @@ -132,7 +132,7 @@ namespace BAN ASSERT(has_value()); return value(); } - + template const T& Optional::operator*() const { @@ -160,7 +160,7 @@ namespace BAN ASSERT(has_value()); return (const T&)m_storage; } - + template T& Optional::value() { diff --git a/BAN/include/BAN/Traits.h b/BAN/include/BAN/Traits.h index dd59de0c71..1db6ca6fed 100644 --- a/BAN/include/BAN/Traits.h +++ b/BAN/include/BAN/Traits.h @@ -2,7 +2,7 @@ namespace BAN { - + template struct remove_refenrece { using type = T; }; template struct remove_refenrece { using type = T; }; template struct remove_refenrece { using type = T; }; @@ -68,7 +68,7 @@ namespace BAN template struct is_const : false_type {}; template struct is_const : true_type {}; template inline constexpr bool is_const_v = is_const::value; - + template struct is_arithmetic { static constexpr bool value = is_integral_v || is_floating_point_v; }; template inline constexpr bool is_arithmetic_v = is_arithmetic::value; diff --git a/BAN/include/BAN/Vector.h b/BAN/include/BAN/Vector.h index 35c4655fbf..43fc872046 100644 --- a/BAN/include/BAN/Vector.h +++ b/BAN/include/BAN/Vector.h @@ -253,7 +253,7 @@ namespace BAN return true; return false; } - + template const T& Vector::operator[](size_type index) const { diff --git a/LibELF/LibELF/ELF.cpp b/LibELF/LibELF/ELF.cpp index 2ff99467e9..16d17b0fde 100644 --- a/LibELF/LibELF/ELF.cpp +++ b/LibELF/LibELF/ELF.cpp @@ -158,7 +158,7 @@ namespace LibELF bool ELF::is_x86_64() const { return m_data[EI_CLASS] == ELFCLASS64; } /* - + 64 bit ELF */ @@ -280,9 +280,8 @@ namespace LibELF return *(const Elf64SectionHeader*)(m_data.data() + file_header.e_shoff + file_header.e_shentsize * index); } - /* - + 32 bit ELF */ @@ -404,5 +403,4 @@ namespace LibELF return *(const Elf32SectionHeader*)(m_data.data() + file_header.e_shoff + file_header.e_shentsize * index); } - } diff --git a/LibELF/include/LibELF/Types.h b/LibELF/include/LibELF/Types.h index 2f9257c8d4..577c52d0cd 100644 --- a/LibELF/include/LibELF/Types.h +++ b/LibELF/include/LibELF/Types.h @@ -78,7 +78,6 @@ namespace LibELF Elf32Word p_align; }; - using Elf64Addr = uint64_t; using Elf64Off = uint64_t; using Elf64Half = uint16_t; diff --git a/bochs.sh b/bochs.sh index 0dfb696abb..5a84272099 100755 --- a/bochs.sh +++ b/bochs.sh @@ -1,6 +1,6 @@ #!/bin/bash set -e - + BOCHS_CONFIG_FILE=bochsrc COM1_TERMINAL=kitty COM1_DEVICE_FILE=com1-term-device diff --git a/kernel/arch/i386/IDT.cpp b/kernel/arch/i386/IDT.cpp index e4f2bcc244..5e6576af51 100644 --- a/kernel/arch/i386/IDT.cpp +++ b/kernel/arch/i386/IDT.cpp @@ -154,7 +154,7 @@ found: "popa;" "iret;" ); - + extern "C" void syscall_asm(); asm( ".global syscall_asm;" diff --git a/kernel/arch/i386/MMU.cpp b/kernel/arch/i386/MMU.cpp index 0514375311..4dbecfda76 100644 --- a/kernel/arch/i386/MMU.cpp +++ b/kernel/arch/i386/MMU.cpp @@ -207,7 +207,6 @@ namespace Kernel unmap_page(page); } - uint8_t MMU::get_page_flags(vaddr_t address) const { uint32_t pdpte = (address & 0xC0000000) >> 30; diff --git a/kernel/arch/x86_64/PageTable.cpp b/kernel/arch/x86_64/PageTable.cpp index e1aa88f719..fd6c9d3d2e 100644 --- a/kernel/arch/x86_64/PageTable.cpp +++ b/kernel/arch/x86_64/PageTable.cpp @@ -16,7 +16,7 @@ extern uint8_t g_userspace_end[]; namespace Kernel { - + static PageTable* s_kernel = nullptr; static PageTable* s_current = nullptr; static bool s_has_nxe = false; diff --git a/kernel/arch/x86_64/boot.S b/kernel/arch/x86_64/boot.S index d481707acc..98298b3a3e 100644 --- a/kernel/arch/x86_64/boot.S +++ b/kernel/arch/x86_64/boot.S @@ -35,7 +35,7 @@ .skip 16384 .global g_boot_stack_top g_boot_stack_top: - + .global g_kernel_cmdline g_kernel_cmdline: .skip 4096 diff --git a/kernel/icxxabi.cpp b/kernel/icxxabi.cpp index f5883a5b5e..976c4d7371 100644 --- a/kernel/icxxabi.cpp +++ b/kernel/icxxabi.cpp @@ -104,7 +104,7 @@ void __cxa_finalize(void *f) **/ (*__atexit_funcs[i].destructor_func)(__atexit_funcs[i].obj_ptr); __atexit_funcs[i].destructor_func = 0; - + /* * Notice that we didn't decrement __atexit_func_count: this is because this algorithm * requires patching to deal with the FIXME outlined above. @@ -113,8 +113,6 @@ void __cxa_finalize(void *f) }; }; - - namespace __cxxabiv1 { /* guard variables */ @@ -122,19 +120,19 @@ namespace __cxxabiv1 /* The ABI requires a 64-bit type. */ __extension__ typedef int __guard __attribute__((mode(__DI__))); - + int __cxa_guard_acquire (__guard* g) { Kernel::LockGuard lock_guard(s_spin_lock); return !*(int*)g; } - + void __cxa_guard_release (__guard* g) { Kernel::LockGuard lock_guard(s_spin_lock); *(int*)g = 1; } - + void __cxa_guard_abort (__guard*) { Kernel::panic("__cxa_guard_abort"); diff --git a/kernel/include/kernel/API/DirectoryEntry.h b/kernel/include/kernel/API/DirectoryEntry.h index 98a8f3160f..75cec80b33 100644 --- a/kernel/include/kernel/API/DirectoryEntry.h +++ b/kernel/include/kernel/API/DirectoryEntry.h @@ -11,7 +11,7 @@ namespace Kernel::API struct dirent dirent; DirectoryEntry* next() const { return (DirectoryEntry*)((uintptr_t)this + rec_len); } }; - + struct DirectoryEntryList { size_t entry_count { 0 }; diff --git a/kernel/include/kernel/CPUID.h b/kernel/include/kernel/CPUID.h index 075c3a9626..2f119e3337 100644 --- a/kernel/include/kernel/CPUID.h +++ b/kernel/include/kernel/CPUID.h @@ -73,7 +73,7 @@ namespace CPUID const char* feature_string_ecx(uint32_t feat); const char* feature_string_edx(uint32_t feat); - + const char* get_vendor(); void get_features(uint32_t& ecx, uint32_t& edx); bool is_64_bit(); diff --git a/kernel/include/kernel/CriticalScope.h b/kernel/include/kernel/CriticalScope.h index c84dacac84..62bcb468d7 100644 --- a/kernel/include/kernel/CriticalScope.h +++ b/kernel/include/kernel/CriticalScope.h @@ -11,7 +11,7 @@ namespace Kernel { BAN_NON_COPYABLE(CriticalScope); BAN_NON_MOVABLE(CriticalScope); - + public: CriticalScope() { diff --git a/kernel/include/kernel/Device/NullDevice.h b/kernel/include/kernel/Device/NullDevice.h index 76da8b08b8..7da299a4cf 100644 --- a/kernel/include/kernel/Device/NullDevice.h +++ b/kernel/include/kernel/Device/NullDevice.h @@ -18,7 +18,7 @@ namespace Kernel virtual BAN::ErrorOr read_impl(off_t, void*, size_t) override { return 0; } virtual BAN::ErrorOr write_impl(off_t, const void*, size_t size) override { return size; }; - + private: const dev_t m_rdev; }; diff --git a/kernel/include/kernel/Device/ZeroDevice.h b/kernel/include/kernel/Device/ZeroDevice.h index c8be3c1902..106bdcb8eb 100644 --- a/kernel/include/kernel/Device/ZeroDevice.h +++ b/kernel/include/kernel/Device/ZeroDevice.h @@ -18,7 +18,7 @@ namespace Kernel virtual BAN::ErrorOr read_impl(off_t, void*, size_t) override; virtual BAN::ErrorOr write_impl(off_t, const void*, size_t size) override { return size; }; - + private: const dev_t m_rdev; }; diff --git a/kernel/include/kernel/FS/DevFS/FileSystem.h b/kernel/include/kernel/FS/DevFS/FileSystem.h index d8584195c1..e9b9b52289 100644 --- a/kernel/include/kernel/FS/DevFS/FileSystem.h +++ b/kernel/include/kernel/FS/DevFS/FileSystem.h @@ -5,7 +5,7 @@ namespace Kernel { - + class DevFileSystem final : public RamFileSystem { public: @@ -13,7 +13,7 @@ namespace Kernel static DevFileSystem& get(); void initialize_device_updater(); - + void add_device(BAN::StringView path, BAN::RefPtr); dev_t get_next_dev(); diff --git a/kernel/include/kernel/FS/FileSystem.h b/kernel/include/kernel/FS/FileSystem.h index 1c97a81be6..5b1cb96b93 100644 --- a/kernel/include/kernel/FS/FileSystem.h +++ b/kernel/include/kernel/FS/FileSystem.h @@ -4,7 +4,7 @@ namespace Kernel { - + class FileSystem { public: diff --git a/kernel/include/kernel/FS/RamFS/FileSystem.h b/kernel/include/kernel/FS/RamFS/FileSystem.h index 2b46c7d63e..78772fadc8 100644 --- a/kernel/include/kernel/FS/RamFS/FileSystem.h +++ b/kernel/include/kernel/FS/RamFS/FileSystem.h @@ -6,7 +6,7 @@ namespace Kernel { - + class RamInode; class RamDirectoryInode; diff --git a/kernel/include/kernel/FS/RamFS/Inode.h b/kernel/include/kernel/FS/RamFS/Inode.h index 84282a65ed..afaec62840 100644 --- a/kernel/include/kernel/FS/RamFS/Inode.h +++ b/kernel/include/kernel/FS/RamFS/Inode.h @@ -14,7 +14,7 @@ namespace Kernel public: static BAN::ErrorOr> create(RamFileSystem&, mode_t, uid_t, gid_t); virtual ~RamInode() = default; - + virtual ino_t ino() const override { return m_inode_info.ino; } virtual Mode mode() const override { return { m_inode_info.mode }; } virtual nlink_t nlink() const override { return m_inode_info.nlink; } @@ -80,7 +80,7 @@ namespace Kernel private: RamDirectoryInode(RamFileSystem&, ino_t parent, mode_t, uid_t, gid_t); - + private: static constexpr size_t m_name_max = NAME_MAX; struct Entry @@ -106,7 +106,7 @@ namespace Kernel virtual off_t size() const override { return m_target.size(); } BAN::ErrorOr set_link_target(BAN::StringView); - + protected: virtual BAN::ErrorOr link_target_impl() override; @@ -115,7 +115,7 @@ namespace Kernel private: BAN::String m_target; - + friend class RamFileSystem; }; diff --git a/kernel/include/kernel/LockGuard.h b/kernel/include/kernel/LockGuard.h index c9d1d6e42d..a1bd27e054 100644 --- a/kernel/include/kernel/LockGuard.h +++ b/kernel/include/kernel/LockGuard.h @@ -22,7 +22,7 @@ namespace Kernel { m_lock.unlock(); } - + private: Lock& m_lock; }; diff --git a/kernel/include/kernel/Memory/Heap.h b/kernel/include/kernel/Memory/Heap.h index 78003d5e67..716f768ed8 100644 --- a/kernel/include/kernel/Memory/Heap.h +++ b/kernel/include/kernel/Memory/Heap.h @@ -8,7 +8,7 @@ namespace Kernel { - + class Heap { BAN_NON_COPYABLE(Heap); diff --git a/kernel/include/kernel/Memory/Types.h b/kernel/include/kernel/Memory/Types.h index a8fccda8f7..279ae7caab 100644 --- a/kernel/include/kernel/Memory/Types.h +++ b/kernel/include/kernel/Memory/Types.h @@ -18,5 +18,5 @@ namespace Kernel using vaddr_t = uintptr_t; using paddr_t = uintptr_t; - + } \ No newline at end of file diff --git a/kernel/include/kernel/Storage/ATAController.h b/kernel/include/kernel/Storage/ATAController.h index ab8f5dd684..433d98f292 100644 --- a/kernel/include/kernel/Storage/ATAController.h +++ b/kernel/include/kernel/Storage/ATAController.h @@ -30,7 +30,7 @@ namespace Kernel virtual dev_t rdev() const override { return m_rdev; } virtual BAN::ErrorOr read(size_t, void*, size_t) { return BAN::Error::from_errno(ENOTSUP); } - + private: const dev_t m_rdev; }; diff --git a/kernel/include/kernel/Storage/StorageDevice.h b/kernel/include/kernel/Storage/StorageDevice.h index 392d2c6d1b..17df45d50e 100644 --- a/kernel/include/kernel/Storage/StorageDevice.h +++ b/kernel/include/kernel/Storage/StorageDevice.h @@ -52,7 +52,7 @@ namespace Kernel protected: virtual BAN::ErrorOr read_impl(off_t, void*, size_t) override; - + private: const dev_t m_rdev; }; diff --git a/kernel/include/kernel/Terminal/Serial.h b/kernel/include/kernel/Terminal/Serial.h index acda40e40e..41cb7dd074 100644 --- a/kernel/include/kernel/Terminal/Serial.h +++ b/kernel/include/kernel/Terminal/Serial.h @@ -42,7 +42,7 @@ namespace Kernel virtual uint32_t width() const override; virtual uint32_t height() const override; virtual void putchar(uint8_t) override; - + virtual void update() override; protected: @@ -55,7 +55,7 @@ namespace Kernel private: BAN::String m_name; Serial m_serial; - + public: virtual dev_t rdev() const override { return m_rdev; } private: diff --git a/kernel/include/kernel/Terminal/VirtualTTY.h b/kernel/include/kernel/Terminal/VirtualTTY.h index 17c24dbdb1..ac9879ee54 100644 --- a/kernel/include/kernel/Terminal/VirtualTTY.h +++ b/kernel/include/kernel/Terminal/VirtualTTY.h @@ -11,7 +11,7 @@ namespace Kernel { - + class VirtualTTY : public TTY { public: diff --git a/kernel/include/kernel/Terminal/termios.h b/kernel/include/kernel/Terminal/termios.h index bb51fd75df..4986c09d1e 100644 --- a/kernel/include/kernel/Terminal/termios.h +++ b/kernel/include/kernel/Terminal/termios.h @@ -8,5 +8,5 @@ namespace Kernel bool canonical { true }; bool echo { true }; }; - + } \ No newline at end of file diff --git a/kernel/include/kernel/Thread.h b/kernel/include/kernel/Thread.h index 2532302540..d743d078b0 100644 --- a/kernel/include/kernel/Thread.h +++ b/kernel/include/kernel/Thread.h @@ -118,5 +118,5 @@ namespace Kernel friend class Scheduler; }; - + } \ No newline at end of file diff --git a/kernel/include/kernel/Timer/RTC.h b/kernel/include/kernel/Timer/RTC.h index 5b343163d5..669d60fb56 100644 --- a/kernel/include/kernel/Timer/RTC.h +++ b/kernel/include/kernel/Timer/RTC.h @@ -9,7 +9,7 @@ namespace Kernel { public: BAN::Time get_current_time(); - + private: bool is_update_in_progress(); uint8_t read_register8(uint8_t reg); diff --git a/kernel/kernel/Device/ZeroDevice.cpp b/kernel/kernel/Device/ZeroDevice.cpp index 38d90f9c9c..4a026c3202 100644 --- a/kernel/kernel/Device/ZeroDevice.cpp +++ b/kernel/kernel/Device/ZeroDevice.cpp @@ -12,7 +12,6 @@ namespace Kernel return BAN::RefPtr::adopt(result); } - BAN::ErrorOr ZeroDevice::read_impl(off_t, void* buffer, size_t bytes) { memset(buffer, 0, bytes); diff --git a/kernel/kernel/FS/Pipe.cpp b/kernel/kernel/FS/Pipe.cpp index 897842358c..3331cbe399 100644 --- a/kernel/kernel/FS/Pipe.cpp +++ b/kernel/kernel/FS/Pipe.cpp @@ -12,7 +12,7 @@ namespace Kernel return BAN::Error::from_errno(ENOMEM); return BAN::RefPtr::adopt(pipe); } - + Pipe::Pipe(const Credentials& credentials) : m_uid(credentials.euid()) , m_gid(credentials.egid()) @@ -29,7 +29,7 @@ namespace Kernel ASSERT(m_writing_count > 0); m_writing_count++; } - + void Pipe::close_writing() { LockGuard _(m_lock); @@ -63,7 +63,7 @@ namespace Kernel return to_copy; } - + BAN::ErrorOr Pipe::write_impl(off_t, const void* buffer, size_t count) { LockGuard _(m_lock); @@ -81,5 +81,5 @@ namespace Kernel return count; } - + } \ No newline at end of file diff --git a/kernel/kernel/FS/RamFS/Inode.cpp b/kernel/kernel/FS/RamFS/Inode.cpp index e5d8cc782b..84e2d851d3 100644 --- a/kernel/kernel/FS/RamFS/Inode.cpp +++ b/kernel/kernel/FS/RamFS/Inode.cpp @@ -6,7 +6,7 @@ namespace Kernel { /* - + RAM INODE */ @@ -68,7 +68,7 @@ namespace Kernel } /* - + RAM DIRECTORY INODE */ @@ -217,7 +217,7 @@ namespace Kernel } /* - + RAM SYMLINK INODE */ diff --git a/kernel/kernel/FS/VirtualFileSystem.cpp b/kernel/kernel/FS/VirtualFileSystem.cpp index f69d70a422..f5fd20806b 100644 --- a/kernel/kernel/FS/VirtualFileSystem.cpp +++ b/kernel/kernel/FS/VirtualFileSystem.cpp @@ -35,7 +35,7 @@ namespace Kernel auto* tmpfs = MUST(RamFileSystem::create(1024 * 1024, tmpfs_mode, 0, 0)); MUST(s_instance->mount(root_creds, tmpfs, "/tmp")); } - + VirtualFileSystem& VirtualFileSystem::get() { ASSERT(s_instance); diff --git a/kernel/kernel/Font.cpp b/kernel/kernel/Font.cpp index 5796bc71e2..f1ebf47c4f 100644 --- a/kernel/kernel/Font.cpp +++ b/kernel/kernel/Font.cpp @@ -245,7 +245,7 @@ namespace Kernel result.m_pitch = header.glyph_size / header.height; return result; } - + bool Font::has_glyph(uint32_t codepoint) const { return m_glyph_offsets.contains(codepoint); diff --git a/kernel/kernel/Input/PS2Keyboard.cpp b/kernel/kernel/Input/PS2Keyboard.cpp index ab3d7a2036..6623d50dfb 100644 --- a/kernel/kernel/Input/PS2Keyboard.cpp +++ b/kernel/kernel/Input/PS2Keyboard.cpp @@ -121,7 +121,7 @@ namespace Kernel::Input } m_command_queue.push(byte); } - + void PS2Keyboard::append_command_queue(uint8_t byte1, uint8_t byte2) { if (m_command_queue.size() + 2 > m_command_queue.capacity()) diff --git a/kernel/kernel/Memory/Heap.cpp b/kernel/kernel/Memory/Heap.cpp index 7d6eafe2a1..5e1499f7f6 100644 --- a/kernel/kernel/Memory/Heap.cpp +++ b/kernel/kernel/Memory/Heap.cpp @@ -59,7 +59,7 @@ namespace Kernel return page; return 0; } - + void Heap::release_page(paddr_t addr) { LockGuard _(m_lock); diff --git a/kernel/kernel/Memory/kmalloc.cpp b/kernel/kernel/Memory/kmalloc.cpp index 5e859f18d8..f9decdb45d 100644 --- a/kernel/kernel/Memory/kmalloc.cpp +++ b/kernel/kernel/Memory/kmalloc.cpp @@ -192,7 +192,7 @@ static void* kmalloc_fixed() // allocate the node on top of free list auto* node = info.free_list_head; ASSERT(node->next == kmalloc_fixed_info::node::invalid); - + // remove the node from free list if (info.free_list_head->prev != kmalloc_fixed_info::node::invalid) { @@ -326,7 +326,7 @@ void* kmalloc(size_t size, size_t align, bool force_indentity_map) if (ptrdiff_t rem = size % s_kmalloc_min_align) size += s_kmalloc_min_align - rem; - + if (void* res = kmalloc_impl(size, align)) return res; diff --git a/kernel/kernel/OpenFileDescriptorSet.cpp b/kernel/kernel/OpenFileDescriptorSet.cpp index 4c9602b5d8..f37a2c848a 100644 --- a/kernel/kernel/OpenFileDescriptorSet.cpp +++ b/kernel/kernel/OpenFileDescriptorSet.cpp @@ -7,7 +7,6 @@ namespace Kernel { - OpenFileDescriptorSet::OpenFileDescriptorSet(const Credentials& credentials) : m_credentials(credentials) { diff --git a/kernel/kernel/Process.cpp b/kernel/kernel/Process.cpp index ed5fa75d9b..36a68992cb 100644 --- a/kernel/kernel/Process.cpp +++ b/kernel/kernel/Process.cpp @@ -995,7 +995,7 @@ namespace Kernel auto inode = TRY(m_open_file_descriptors.inode_of(fd)); if (!inode->is_tty()) return BAN::Error::from_errno(ENOTTY); - + if ((TTY*)inode.ptr() != m_controlling_terminal.ptr()) return BAN::Error::from_errno(ENOTTY); diff --git a/kernel/kernel/SSP.cpp b/kernel/kernel/SSP.cpp index ba853e5107..0eaf936093 100644 --- a/kernel/kernel/SSP.cpp +++ b/kernel/kernel/SSP.cpp @@ -2,13 +2,13 @@ #include #include - + #if UINT32_MAX == UINTPTR_MAX #define STACK_CHK_GUARD 0xe2dee396 #else #define STACK_CHK_GUARD 0x595e9fbd94fda766 #endif - + uintptr_t __stack_chk_guard = STACK_CHK_GUARD; __BEGIN_DECLS diff --git a/kernel/kernel/Scheduler.cpp b/kernel/kernel/Scheduler.cpp index b67ce3f281..c33fda576b 100644 --- a/kernel/kernel/Scheduler.cpp +++ b/kernel/kernel/Scheduler.cpp @@ -304,7 +304,7 @@ namespace Kernel execute_current_thread(); ASSERT_NOT_REACHED(); } - + void Scheduler::unblock_threads(Semaphore* semaphore) { CriticalScope critical; diff --git a/kernel/kernel/Storage/ATABus.cpp b/kernel/kernel/Storage/ATABus.cpp index dafd7ee9e4..c5dbc415cb 100644 --- a/kernel/kernel/Storage/ATABus.cpp +++ b/kernel/kernel/Storage/ATABus.cpp @@ -323,5 +323,5 @@ namespace Kernel return {}; } - + } \ No newline at end of file diff --git a/kernel/kernel/Terminal/Serial.cpp b/kernel/kernel/Terminal/Serial.cpp index 46490c4fa0..fd2109a7ca 100644 --- a/kernel/kernel/Terminal/Serial.cpp +++ b/kernel/kernel/Terminal/Serial.cpp @@ -181,7 +181,7 @@ namespace Kernel { return s_has_devices; } - + void Serial::putchar(char c) { while (!(IO::inb(m_port + 5) & 0x20)) @@ -275,7 +275,7 @@ namespace Kernel if (m_serial.port() == COM2_PORT) update_com(s_com2, s_com2_input); } - + uint32_t SerialTTY::width() const { return m_serial.width(); @@ -285,7 +285,7 @@ namespace Kernel { return m_serial.height(); } - + void SerialTTY::putchar(uint8_t ch) { m_serial.putchar(ch); diff --git a/kernel/kernel/Terminal/VesaTerminalDriver.cpp b/kernel/kernel/Terminal/VesaTerminalDriver.cpp index d59650194a..2ac6445f90 100644 --- a/kernel/kernel/Terminal/VesaTerminalDriver.cpp +++ b/kernel/kernel/Terminal/VesaTerminalDriver.cpp @@ -57,7 +57,6 @@ VesaTerminalDriver* VesaTerminalDriver::create() return driver; } - VesaTerminalDriver::~VesaTerminalDriver() { PageTable::kernel().unmap_range(m_address, m_pitch * m_height); diff --git a/kernel/kernel/Thread.cpp b/kernel/kernel/Thread.cpp index d59b3fd2a9..927ddb4db5 100644 --- a/kernel/kernel/Thread.cpp +++ b/kernel/kernel/Thread.cpp @@ -25,7 +25,6 @@ namespace Kernel memcpy((void*)rsp, (void*)&value, sizeof(uintptr_t)); } - Thread::TerminateBlocker::TerminateBlocker(Thread& thread) : m_thread(thread) { diff --git a/kernel/kernel/Timer/PIT.cpp b/kernel/kernel/Timer/PIT.cpp index 50f58c1d23..a5c421beab 100644 --- a/kernel/kernel/Timer/PIT.cpp +++ b/kernel/kernel/Timer/PIT.cpp @@ -47,7 +47,7 @@ namespace Kernel void PIT::initialize() { constexpr uint16_t timer_reload = BASE_FREQUENCY / TICKS_PER_SECOND; - + IO::outb(PIT_CTL, SELECT_CHANNEL0 | ACCESS_LO | ACCESS_HI | MODE_SQUARE_WAVE); IO::outb(TIMER0_CTL, (timer_reload >> 0) & 0xff); diff --git a/kernel/kernel/kernel.cpp b/kernel/kernel/kernel.cpp index 044869214b..8e6c50e13f 100644 --- a/kernel/kernel/kernel.cpp +++ b/kernel/kernel/kernel.cpp @@ -169,7 +169,7 @@ static void init2(void*) PCI::initialize(); dprintln("PCI initialized"); - + VirtualFileSystem::initialize(cmdline.root); if (auto res = PS2Controller::initialize(); res.is_error()) diff --git a/kernel/ubsan.cpp b/kernel/ubsan.cpp index d74cf99777..2144a4184d 100644 --- a/kernel/ubsan.cpp +++ b/kernel/ubsan.cpp @@ -10,14 +10,14 @@ extern "C" uint32_t line; uint32_t column; }; - + struct type_descriptor { uint16_t kind; uint16_t info; char name[1]; }; - + struct type_mismatch_data { source_location location; @@ -25,7 +25,7 @@ extern "C" uint8_t alignment; uint8_t type_check_kind; }; - + struct out_of_bounds_data { source_location location; diff --git a/libc/dirent.cpp b/libc/dirent.cpp index b8c94e4442..9c16c27745 100644 --- a/libc/dirent.cpp +++ b/libc/dirent.cpp @@ -24,7 +24,7 @@ int closedir(DIR* dirp) errno = EBADF; return -1; } - + close(dirp->fd); dirp->fd = -1; free(dirp); diff --git a/libc/include/string.h b/libc/include/string.h index 46946a3642..a612e53009 100644 --- a/libc/include/string.h +++ b/libc/include/string.h @@ -49,7 +49,6 @@ size_t strxfrm_l(char* __restrict s1, const char* __restrict s2, size_t n, local const char* strerrorname_np(int error); const char* strerrordesc_np(int error); - __END_DECLS #endif diff --git a/libc/include/sys/stat.h b/libc/include/sys/stat.h index 45c610d514..85066ca952 100644 --- a/libc/include/sys/stat.h +++ b/libc/include/sys/stat.h @@ -87,7 +87,6 @@ struct stat #define UTIME_NOW 1000000001 #define UTIME_OMIT 1000000002 - int chmod(const char* path, mode_t mode); int fchmod(int fildes, mode_t mode); int fchmodat(int fd, const char* path, mode_t mode, int flag); diff --git a/libc/printf_impl.cpp b/libc/printf_impl.cpp index dcc19ba303..99eaa92c77 100644 --- a/libc/printf_impl.cpp +++ b/libc/printf_impl.cpp @@ -77,7 +77,7 @@ static void integer_to_string(char* buffer, T value, int base, bool upper, forma prefix[1] = 'x'; } } - + while (value || offset < digits) { buffer[offset++] = digit_char(value % base, upper); @@ -171,7 +171,7 @@ static void floating_point_to_string(char* buffer, T value, bool upper, const fo return; } buffer[offset++] = '.'; - + // Add the 'percision' digits after decimal point for (int i = 0; i < percision; i++) { @@ -193,7 +193,7 @@ static void floating_point_to_exponent_string(char* buffer, T value, bool upper, int percision = 6; if (options.percision != -1) percision = options.percision; - + int offset = 0; // Add sign if needed @@ -465,7 +465,6 @@ extern "C" int printf_impl(const char* format, va_list arguments, int (*putc_fun format++; } } - + return written; } - diff --git a/libc/pwd.cpp b/libc/pwd.cpp index 20e3a71d90..05a8c3be08 100644 --- a/libc/pwd.cpp +++ b/libc/pwd.cpp @@ -50,7 +50,7 @@ struct passwd* getpwent(void) if (!open_pwent()) return nullptr; clear_pwent(s_pwent_struct); - + BAN::String line; while (true) { diff --git a/libc/stdio.cpp b/libc/stdio.cpp index 4b6c6cd3b9..d05273d0a7 100644 --- a/libc/stdio.cpp +++ b/libc/stdio.cpp @@ -62,7 +62,7 @@ FILE* fdopen(int fd, const char* mode) return &s_files[i]; } } - + errno = EMFILE; return nullptr; } @@ -90,7 +90,7 @@ int fflush(FILE* file) if (file->buffer_index == 0) return 0; - + if (syscall(SYS_WRITE, file->fd, file->buffer, file->buffer_index) < 0) { file->error = true; @@ -105,7 +105,7 @@ int fgetc(FILE* file) { if (file->eof) return EOF; - + unsigned char c; long ret = syscall(SYS_READ, file->fd, &c, 1); @@ -114,7 +114,7 @@ int fgetc(FILE* file) file->error = true; return EOF; } - + if (ret == 0) { file->eof = true; @@ -217,7 +217,7 @@ FILE* fopen(const char* pathname, const char* mode) return &s_files[i]; } } - + errno = EMFILE; return nullptr; } @@ -293,7 +293,7 @@ int fseeko(FILE* file, off_t offset, int whence) long ret = syscall(SYS_SEEK, file->fd, offset, whence); if (ret < 0) return -1; - + file->eof = false; return 0; } @@ -353,7 +353,7 @@ char* gets(char* buffer) return nullptr; unsigned char* ubuffer = (unsigned char*)buffer; - + int first = fgetc(stdin); if (first == EOF) return nullptr; @@ -529,7 +529,7 @@ int vsprintf(char* buffer, const char* format, va_list arguments) { if (buffer == nullptr) return printf_impl(format, arguments, [](int, void*) { return 0; }, nullptr); - + int ret = printf_impl(format, arguments, [](int c, void* _buffer) { diff --git a/libc/stdlib.cpp b/libc/stdlib.cpp index d8ddc434d9..b9cb59094a 100644 --- a/libc/stdlib.cpp +++ b/libc/stdlib.cpp @@ -205,7 +205,6 @@ void free(void* ptr) syscall(SYS_FREE, ptr); } - // Constants and algorithm from https://en.wikipedia.org/wiki/Permuted_congruential_generator static uint64_t s_rand_state = 0x4d595df4d0f33173; diff --git a/libc/string.cpp b/libc/string.cpp index c85a000f98..f51d311084 100644 --- a/libc/string.cpp +++ b/libc/string.cpp @@ -273,7 +273,6 @@ const char* strerrordesc_np(int error) return "Unknown error"; } - size_t strlen(const char* str) { size_t len = 0; diff --git a/libc/unistd.cpp b/libc/unistd.cpp index 3f7f9199b0..8a6f16673d 100644 --- a/libc/unistd.cpp +++ b/libc/unistd.cpp @@ -32,11 +32,11 @@ long syscall(long syscall, ...) uintptr_t arg3 = va_arg(args, uintptr_t); uintptr_t arg4 = va_arg(args, uintptr_t); uintptr_t arg5 = va_arg(args, uintptr_t); - + va_end(args); long ret = Kernel::syscall(syscall, arg1, arg2, arg3, arg4, arg5); - + if (ret < 0) { errno = -ret; @@ -78,7 +78,7 @@ int execl(const char* pathname, const char* arg0, ...) char* temp = nullptr; return execv(pathname, &temp); } - + va_list ap; va_start(ap, arg0); int argc = 1; diff --git a/qemu.sh b/qemu.sh index e91af3353e..de68e47cab 100755 --- a/qemu.sh +++ b/qemu.sh @@ -1,6 +1,6 @@ #!/bin/bash set -e - + qemu-system-$BANAN_ARCH \ -m 128 \ -smp 2 \ diff --git a/userspace/ls/main.cpp b/userspace/ls/main.cpp index 784e16083f..b962f852c9 100644 --- a/userspace/ls/main.cpp +++ b/userspace/ls/main.cpp @@ -51,9 +51,9 @@ void list_directory(const char* path) DIR* dirp = opendir(path); if (dirp == nullptr) return perror("opendir"); - + errno = 0; - + bool first = true; while (auto* dirent = readdir(dirp)) {