misc: run clang-format

This commit is contained in:
2024-05-04 12:11:03 +02:00
parent ed3599ce95
commit 3ff52a2562
17 changed files with 59 additions and 60 deletions

View File

@@ -1,7 +1,7 @@
#include <fcntl.h>
extern void exit(int code);
extern int main ();
extern int main();
extern void __libc_init_array();
extern void __libc_fini_array();

View File

@@ -33,8 +33,8 @@
* @(#)dirent.h 8.1 (Berkeley) 6/2/93
*/
#ifndef _SYS_DIRENT_H_
#define _SYS_DIRENT_H_
#ifndef _SYS_DIRENT_H_
#define _SYS_DIRENT_H_
#ifdef __cplusplus
extern "C" {
@@ -55,47 +55,47 @@ extern "C" {
*/
struct dirent {
unsigned long d_fileno; /* file number of entry */
unsigned short d_reclen; /* length of this record */
unsigned char d_type; /* file type, see below */
unsigned char d_namlen; /* length of string in d_name */
char d_name[NAME_MAX + 1]; /* name must be no longer than this */
unsigned long d_fileno; /* file number of entry */
unsigned short d_reclen; /* length of this record */
unsigned char d_type; /* file type, see below */
unsigned char d_namlen; /* length of string in d_name */
char d_name[NAME_MAX + 1]; /* name must be no longer than this */
};
/*
* File types
*/
#define DT_UNKNOWN 0
#define DT_FIFO 1
#define DT_CHR 2
#define DT_DIR 4
#define DT_BLK 6
#define DT_REG 8
#define DT_LNK 10
#define DT_SOCK 12
#define DT_UNKNOWN 0
#define DT_FIFO 1
#define DT_CHR 2
#define DT_DIR 4
#define DT_BLK 6
#define DT_REG 8
#define DT_LNK 10
#define DT_SOCK 12
/*
* Convert between stat structure types and directory types.
*/
#define IFTODT(mode) (((mode) & 0170000) >> 12)
#define DTTOIF(dirtype) ((dirtype) << 12)
#define IFTODT(mode) (((mode) & 0170000) >> 12)
#define DTTOIF(dirtype) ((dirtype) << 12)
/*
* The kernel defines the format of directory entries returned by
* the getdirentries(2) system call.
*/
#define d_ino d_fileno /* backward compatibility */
#define d_ino d_fileno /* backward compatibility */
/* structure describing an open directory. */
typedef struct _dirdesc {
int dd_fd; /* file descriptor associated with directory */
long dd_loc; /* offset in current buffer */
long dd_size; /* amount of data returned by getdirentries */
int dd_fd; /* file descriptor associated with directory */
long dd_loc; /* offset in current buffer */
long dd_size; /* amount of data returned by getdirentries */
char *dd_buf; /* data buffer */
int dd_len; /* size of data buffer */
long dd_seek; /* magic cookie returned by getdirentries */
long dd_rewind; /* magic cookie for rewinding */
int dd_len; /* size of data buffer */
long dd_seek; /* magic cookie returned by getdirentries */
long dd_rewind; /* magic cookie for rewinding */
} DIR;
//#define dirfd(dirp) ((dirp)->dd_fd)

View File

@@ -9,18 +9,18 @@
extern "C" {
#endif
#define SYSCALL_EXIT_ID 0
#define SYSCALL_EXIT_ID 0
#define SYSCALL_PUTCHAR_ID 1
#define SYSCALL_SLEEP_ID 2
#define SYSCALL_READCHAR_ID 3
#define SYSCALL_OPEN_ID 4
#define SYSCALL_CLOSE_ID 5
#define SYSCALL_OPEN_ID 4
#define SYSCALL_CLOSE_ID 5
#define SYSCALL_READ_ID 6
#define SYSCALL_WRITE_ID 7
#define SYSCALL_LSEEK_ID 8
#define SYSCALL_READ_ID 6
#define SYSCALL_WRITE_ID 7
#define SYSCALL_LSEEK_ID 8
#define SYSCALL_OPENDIR_ID 9
#define SYSCALL_READDIR_ID 10
@@ -28,16 +28,16 @@ extern "C" {
#define SYSCALL_MKDIR_ID 12
#define SYSCALL_UNLINK_ID 13
#define SYSCALL_EXECVE_ID 50
#define SYSCALL_FORK_ID 51
#define SYSCALL_WAITPID_ID 52
#define SYSCALL_SBRK_ID 100
#define SYSCALL_EXECVE_ID 50
#define SYSCALL_FORK_ID 51
#define SYSCALL_WAITPID_ID 52
#define SYSCALL_SBRK_ID 100
#define SYSCALL_PRINT_MEM 1000
#define SYSCALL_PRINT_TASKS 1001
void print_mem();
void print_tasks();
void print_mem();
void print_tasks();
#ifdef __cplusplus
}

View File

@@ -15,7 +15,7 @@
class LimineFramebuffer : public Framebuffer {
public:
LimineFramebuffer(limine_framebuffer *limine_framebuffer);
LimineFramebuffer(limine_framebuffer *limine_framebuffer);
virtual ~LimineFramebuffer() = default;
void set(size_t x, size_t y, uint32_t color) override;

View File

@@ -24,7 +24,7 @@ class PS2Keyboard {
CircularBuffer<char, 512> buf;
public:
PS2Keyboard();
PS2Keyboard();
char readchar();
};

View File

@@ -173,7 +173,7 @@ namespace Arch::IDT {
Scheduler::switch_task(frame);
PIC_sendEOI(0);
}
extern "C" __attribute__((force_align_arg_pointer)) void pic1_irq_real_1() {
extern "C" __attribute__((force_align_arg_pointer)) void pic1_irq_real_1() {
if (handlers[1] != nullptr) {
handlers[1](handlers_args[1]);
}

View File

@@ -11,7 +11,7 @@
class Framebuffer;
class FbTty : public Tty {
public:
FbTty(Framebuffer *fb);
FbTty(Framebuffer *fb);
virtual ~FbTty() = default;
void putchar(char c) override;

View File

@@ -4871,8 +4871,7 @@ static constexpr std::array<std::array<uint8_t, 16>, 256> fonts_Terminess_Powerl
0b00000000,
0b00000000,
0b00000000,
}
};
}};
#endif //FONTS_HPP

View File

@@ -6,9 +6,9 @@
#define FRAMEBUFFER_HPP
#include <utility>
#include <cstddef>
#include <cstdint>
#include <utility>
class Framebuffer {
@@ -21,7 +21,7 @@ public:
dimensions_t dimensions() { return _dimensions; }
virtual void set(size_t x, size_t y, uint32_t color) = 0;
virtual int get(size_t x, size_t y) = 0;
virtual int get(size_t x, size_t y) = 0;
protected:
dimensions_t _dimensions;

View File

@@ -16,11 +16,11 @@ class AddressSpace;
class VMA {
public:
VMA(AddressSpace *space);
VMA(AddressSpace *space);
~VMA();
VMA(const VMA &) = delete;
VMA(VMA &&) = delete;
VMA(const VMA &) = delete;
VMA(VMA &&) = delete;
VMA &operator=(const VMA &) = delete;
VMA &operator=(VMA &&) = delete;
@@ -32,7 +32,7 @@ public:
void *mmap_mem(void *v_addr, size_t length, int prot, int flags);
int munmap(void *addr, size_t length);
static constexpr size_t kBrkSize = 4096ULL * 20ULL;
static constexpr size_t kBrkSize = 4096ULL * 20ULL;
std::optional<char *> brk_start;
std::optional<char *> brk_end_fake;
std::optional<char *> brk_end_real;

View File

@@ -220,7 +220,7 @@ protected:
using pointer = value_type *;
using reference = value_type &;
explicit SkipListBaseIteratorBase(Node *n) : n(std::move(n)){};
explicit SkipListBaseIteratorBase(Node *n) : n(std::move(n)) {};
reference operator*() const { return n->get(); }

View File

@@ -11,7 +11,7 @@
class Filesystem {
public:
Filesystem(NodeDir *mounted_on);
Filesystem(NodeDir *mounted_on);
virtual ~Filesystem() = 0;
virtual SharedPtr<NodeDir> root() = 0;

View File

@@ -7,7 +7,7 @@
#include "Filesystem.hpp"
Node::~ Node() = default;
Node::~Node() = default;
SharedPtr<Node> Node::traverse(const Path &path) {
Filesystem *mnt;

View File

@@ -53,10 +53,10 @@ struct DirEntry {
class NodeDir : public Node {
public:
virtual Vector<DirEntry> children() = 0;
virtual ino_t mkdir(const String &name) = 0;
virtual ino_t mkfile(const String &name) = 0;
virtual void set_mounted(Filesystem *mount);
virtual Vector<DirEntry> children() = 0;
virtual ino_t mkdir(const String &name) = 0;
virtual ino_t mkfile(const String &name) = 0;
virtual void set_mounted(Filesystem *mount);
protected:
NodeDir(Filesystem *fs, ino_t ino) : Node(Type::DIR, fs, ino) {}

View File

@@ -9,7 +9,7 @@
class TarFs : public Filesystem {
public:
TarFs(char *backing, size_t backing_size, NodeDir *mounted_on);
TarFs(char *backing, size_t backing_size, NodeDir *mounted_on);
~TarFs() override = default;
SharedPtr<NodeDir> root() override;

View File

@@ -21,7 +21,7 @@ public:
namespace VFSGlobals {
extern RootNode root;
extern MountTable mounts;
}; // namespace VFSGlobals
} // namespace VFSGlobals
#endif //FICUS_VFSGLOBALS_HPP

View File

@@ -232,7 +232,7 @@ public:
using pointer = value_type *;
using reference = value_type &;
CRangeListIterator(CRangeListIterator const &it) : it(it.it){};
CRangeListIterator(CRangeListIterator const &it) : it(it.it) {};
CRangeListIterator(decltype(data)::const_iterator it, decltype(data)::const_iterator end) : it(it), end(end) {
if (it != end && !it->second.second)