aboutsummaryrefslogtreecommitdiff
path: root/include/apos
diff options
context:
space:
mode:
authorKimplul <kimi.h.kuparinen@gmail.com>2022-04-23 20:59:23 +0300
committerKimplul <kimi.h.kuparinen@gmail.com>2022-04-23 21:10:44 +0300
commitd4c420689b1872f6fb22f421dfd27704ee94951a (patch)
treec3b1921c7bb1035edb7211e4547d3088dac80778 /include/apos
parent38c7c94bcd131290dcbae110dfb33b0b78c99d90 (diff)
downloadkmi-d4c420689b1872f6fb22f421dfd27704ee94951a.tar.gz
kmi-d4c420689b1872f6fb22f421dfd27704ee94951a.zip
ran clang-format
Diffstat (limited to 'include/apos')
-rw-r--r--include/apos/mem.h4
-rw-r--r--include/apos/nodes.h2
-rw-r--r--include/apos/power.h2
-rw-r--r--include/apos/uapi.h78
-rw-r--r--include/apos/utils.h5
5 files changed, 48 insertions, 43 deletions
diff --git a/include/apos/mem.h b/include/apos/mem.h
index be44104..ece8ee3 100644
--- a/include/apos/mem.h
+++ b/include/apos/mem.h
@@ -35,8 +35,8 @@
#define __page(x) ((x) / BASE_PAGE_SIZE)
#define __addr(x) ((x)*BASE_PAGE_SIZE)
#define __pages(x) \
- (aligned((x), BASE_PAGE_SIZE) ? __page((x)) : \
- __page((x) + BASE_PAGE_SIZE))
+ (is_aligned((x), BASE_PAGE_SIZE) ? __page((x)) : \
+ __page((x) + BASE_PAGE_SIZE))
#define __bytes(x) (__addr(x))
extern size_t __mm_shifts[10];
diff --git a/include/apos/nodes.h b/include/apos/nodes.h
index 0780f75..9cf6728 100644
--- a/include/apos/nodes.h
+++ b/include/apos/nodes.h
@@ -3,7 +3,7 @@
#include <apos/types.h>
-enum node_status { FREE = 0, USED = 1};
+enum node_status { FREE = 0, USED = 1 };
struct node_region {
size_t used_nodes;
diff --git a/include/apos/power.h b/include/apos/power.h
index e0ca518..31f199d 100644
--- a/include/apos/power.h
+++ b/include/apos/power.h
@@ -4,7 +4,7 @@
#include <apos/types.h>
#include <apos/attrs.h>
-enum poweroff_type {SHUTDOWN, COLD_REBOOT, WARM_REBOOT};
+enum poweroff_type { SHUTDOWN, COLD_REBOOT, WARM_REBOOT };
stat_t poweroff(enum poweroff_type type);
#endif
diff --git a/include/apos/uapi.h b/include/apos/uapi.h
index 18f086c..fa66b31 100644
--- a/include/apos/uapi.h
+++ b/include/apos/uapi.h
@@ -8,52 +8,56 @@
* goes */
typedef vm_t (*sys_t)(vm_t, vm_t, vm_t, vm_t);
-#define SYSCALL_DECLARE(name)\
- vm_t sys_##name(vm_t a, vm_t b, vm_t c, vm_t d);
+#define SYSCALL_DECLARE(name) vm_t sys_##name(vm_t a, vm_t b, vm_t c, vm_t d);
-#define SYSCALL_DEFINE0(name)\
- static vm_t __##name();\
- vm_t sys_##name(vm_t a, vm_t b, vm_t c, vm_t d){ \
- UNUSED(a);\
- UNUSED(b);\
- UNUSED(c);\
- UNUSED(d);\
- return __##name();\
- }\
+#define SYSCALL_DEFINE0(name) \
+ static vm_t __##name(); \
+ vm_t sys_##name(vm_t a, vm_t b, vm_t c, vm_t d) \
+ { \
+ UNUSED(a); \
+ UNUSED(b); \
+ UNUSED(c); \
+ UNUSED(d); \
+ return __##name(); \
+ } \
static vm_t __##name
-#define SYSCALL_DEFINE1(name)\
- static vm_t __##name(vm_t);\
- vm_t sys_##name(vm_t a, vm_t b, vm_t c, vm_t d){ \
- UNUSED(b);\
- UNUSED(c);\
- UNUSED(d);\
- return __##name(a);\
- }\
+#define SYSCALL_DEFINE1(name) \
+ static vm_t __##name(vm_t); \
+ vm_t sys_##name(vm_t a, vm_t b, vm_t c, vm_t d) \
+ { \
+ UNUSED(b); \
+ UNUSED(c); \
+ UNUSED(d); \
+ return __##name(a); \
+ } \
static vm_t __##name
-#define SYSCALL_DEFINE2(name)\
- static vm_t __##name(vm_t, vm_t);\
- vm_t sys_##name(vm_t a, vm_t b, vm_t c, vm_t d){ \
- UNUSED(c);\
- UNUSED(d);\
- return __##name(a, b);\
- }\
+#define SYSCALL_DEFINE2(name) \
+ static vm_t __##name(vm_t, vm_t); \
+ vm_t sys_##name(vm_t a, vm_t b, vm_t c, vm_t d) \
+ { \
+ UNUSED(c); \
+ UNUSED(d); \
+ return __##name(a, b); \
+ } \
static vm_t __##name
-#define SYSCALL_DEFINE3(name)\
- static vm_t __##name(vm_t, vm_t, vm_t);\
- vm_t sys_##name(vm_t a, vm_t b, vm_t c, vm_t d){ \
- UNUSED(d);\
- return __##name(a, b, c);\
- }\
+#define SYSCALL_DEFINE3(name) \
+ static vm_t __##name(vm_t, vm_t, vm_t); \
+ vm_t sys_##name(vm_t a, vm_t b, vm_t c, vm_t d) \
+ { \
+ UNUSED(d); \
+ return __##name(a, b, c); \
+ } \
static vm_t __##name
-#define SYSCALL_DEFINE4(name)\
- static vm_t __##name(vm_t, vm_t, vm_t, vm_t);\
- vm_t sys_##name(vm_t a, vm_t b, vm_t c, vm_t d){ \
- return __##name(a, b, c, d);\
- }\
+#define SYSCALL_DEFINE4(name) \
+ static vm_t __##name(vm_t, vm_t, vm_t, vm_t); \
+ vm_t sys_##name(vm_t a, vm_t b, vm_t c, vm_t d) \
+ { \
+ return __##name(a, b, c, d); \
+ } \
static vm_t __##name
/* memory */
diff --git a/include/apos/utils.h b/include/apos/utils.h
index ce48776..03e1a59 100644
--- a/include/apos/utils.h
+++ b/include/apos/utils.h
@@ -32,10 +32,10 @@
#endif
#if __has_builtin(__builtin_expect)
-#define likely(x) __builtin_expect(!!(x), 1)
+#define likely(x) __builtin_expect(!!(x), 1)
#define unlikely(x) __builtin_expect(!!(x), 0)
#else
-#define likely(x) (x)
+#define likely(x) (x)
#define unlikely(x) (x)
#endif
@@ -49,6 +49,7 @@
#include <apos/types.h>
+/* clang-format doesn't like _Generic, but I guess that's fine. */
#define align_up(x, y) \
_Generic((x), int8_t \
: align_up_int8_t, int16_t \