about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKartik Agaram <vc@akkartik.com>2019-09-14 16:40:51 -0700
committerKartik Agaram <vc@akkartik.com>2019-09-14 16:40:51 -0700
commit67de9b02956419644f570f7e47ecd9940af024b3 (patch)
tree987bb1bbdfed80c5d72f3d5c47f0ff0284abdc1b
parent5183a8425f22cdd43f7d3cdef21a9523f0aceb8c (diff)
downloadmu-67de9b02956419644f570f7e47ecd9940af024b3.tar.gz
5656
Consistent style for curlies.
-rw-r--r--kernel.soso/alloc.c93
-rw-r--r--kernel.soso/alloc.h3
-rw-r--r--kernel.soso/common.c162
-rw-r--r--kernel.soso/commonuser.h6
-rw-r--r--kernel.soso/debugprint.c21
-rw-r--r--kernel.soso/descriptortables.c39
-rw-r--r--kernel.soso/descriptortables.h12
-rw-r--r--kernel.soso/devfs.c39
-rw-r--r--kernel.soso/device.h3
-rw-r--r--kernel.soso/elf.c30
-rw-r--r--kernel.soso/fatfilesystem.c213
-rw-r--r--kernel.soso/fatfs_ff.c321
-rw-r--r--kernel.soso/fatfs_ffunicode.c21
-rw-r--r--kernel.soso/fifobuffer.c48
-rw-r--r--kernel.soso/fifobuffer.h3
-rw-r--r--kernel.soso/framebuffer.c33
-rw-r--r--kernel.soso/framebuffer.h3
-rw-r--r--kernel.soso/fs.c312
-rw-r--r--kernel.soso/fs.h21
-rw-r--r--kernel.soso/gfx.c57
-rw-r--r--kernel.soso/hashtable.c51
-rw-r--r--kernel.soso/isr.c21
-rw-r--r--kernel.soso/isr.h3
-rw-r--r--kernel.soso/keyboard.c57
-rw-r--r--kernel.soso/list.c141
-rw-r--r--kernel.soso/list.h12
-rw-r--r--kernel.soso/main.c60
-rw-r--r--kernel.soso/message.c15
-rw-r--r--kernel.soso/mouse.c48
-rw-r--r--kernel.soso/multiboot.h3
-rw-r--r--kernel.soso/null.c6
-rw-r--r--kernel.soso/pipe.c102
-rw-r--r--kernel.soso/process.c276
-rw-r--r--kernel.soso/process.h18
-rw-r--r--kernel.soso/ramdisk.c33
-rw-r--r--kernel.soso/random.c21
-rw-r--r--kernel.soso/rootfs.c45
-rw-r--r--kernel.soso/screen.c39
-rw-r--r--kernel.soso/serial.c27
-rw-r--r--kernel.soso/sharedmemory.c84
-rw-r--r--kernel.soso/sleep.c3
-rw-r--r--kernel.soso/spinlock.c15
-rw-r--r--kernel.soso/syscalls.c542
-rw-r--r--kernel.soso/syscalltable.h3
-rw-r--r--kernel.soso/systemfs.c105
-rw-r--r--kernel.soso/termios.h3
-rw-r--r--kernel.soso/timer.c27
-rw-r--r--kernel.soso/tty.c66
-rw-r--r--kernel.soso/tty.h3
-rw-r--r--kernel.soso/ttydriver.c219
-rw-r--r--kernel.soso/vimrc.vim2
-rw-r--r--kernel.soso/vmm.c261
52 files changed, 1252 insertions, 2499 deletions
diff --git a/kernel.soso/alloc.c b/kernel.soso/alloc.c
index 775bef40..6e81b13c 100644
--- a/kernel.soso/alloc.c
+++ b/kernel.soso/alloc.c
@@ -13,15 +13,13 @@ static char *gKernelHeap = NULL;
 static uint32 gKernelHeapUsed = 0;
 
 
-void initializeKernelHeap()
-{
+void initializeKernelHeap() {
     gKernelHeap = (char *) KERN_HEAP_BEGIN;
 
     ksbrkPage(1);
 }
 
-void *ksbrkPage(int n)
-{
+void *ksbrkPage(int n) {
     struct MallocHeader *chunk;
     char *p_addr;
     int i;
@@ -33,14 +31,12 @@ void *ksbrkPage(int n)
 
     chunk = (struct MallocHeader *) gKernelHeap;
 
-    for (i = 0; i < n; i++)
-    {
+    for (i = 0; i < n; i++) {
         p_addr = getPageFrame4M();
 
         //printkf("DEBUG: ksbrkPage(): got 4M on physical %x\n", p_addr);
 
-        if ((int)(p_addr) < 0)
-        {
+        if ((int)(p_addr) < 0) {
             PANIC("PANIC: ksbrkPage(): no free page frame available !");
             return (char *) -1;
         }
@@ -56,24 +52,20 @@ void *ksbrkPage(int n)
     return chunk;
 }
 
-void *kmalloc(uint32 size)
-{
+void *kmalloc(uint32 size) {
     if (size==0)
         return 0;
 
     unsigned long realsize;
     struct MallocHeader *chunk, *other;
 
-    if ((realsize = sizeof(struct MallocHeader) + size) < KMALLOC_MINSIZE)
-    {
+    if ((realsize = sizeof(struct MallocHeader) + size) < KMALLOC_MINSIZE) {
         realsize = KMALLOC_MINSIZE;
     }
 
     chunk = (struct MallocHeader *) KERN_HEAP_BEGIN;
-    while (chunk->used || chunk->size < realsize)
-    {
-        if (chunk->size == 0)
-        {
+    while (chunk->used || chunk->size < realsize) {
+        if (chunk->size == 0) {
             printkf("\nPANIC: kmalloc(): corrupted chunk on %x with null size (heap %x) !\nSystem halted\n", chunk, gKernelHeap);
 
             PANIC("kmalloc()");
@@ -83,17 +75,14 @@ void *kmalloc(uint32 size)
 
         chunk = (struct MallocHeader *)((char *)chunk + chunk->size);
 
-        if (chunk == (struct MallocHeader *) gKernelHeap)
-        {
-            if ((int)(ksbrkPage((realsize / PAGESIZE_4M) + 1)) < 0)
-            {
+        if (chunk == (struct MallocHeader *) gKernelHeap) {
+            if ((int)(ksbrkPage((realsize / PAGESIZE_4M) + 1)) < 0) {
                 PANIC("kmalloc(): no memory left for kernel !\nSystem halted\n");
 
                 return 0;
             }
         }
-        else if (chunk > (struct MallocHeader *) gKernelHeap)
-        {
+        else if (chunk > (struct MallocHeader *) gKernelHeap) {
             printkf("\nPANIC: kmalloc(): chunk on %x while heap limit is on %x !\nSystem halted\n", chunk, gKernelHeap);
 
             PANIC("kmalloc()");
@@ -103,12 +92,10 @@ void *kmalloc(uint32 size)
     }
 
 
-    if (chunk->size - realsize < KMALLOC_MINSIZE)
-    {
+    if (chunk->size - realsize < KMALLOC_MINSIZE) {
         chunk->used = 1;
     }
-    else
-    {
+    else {
         other = (struct MallocHeader *)((char *) chunk + realsize);
         other->size = chunk->size - realsize;
         other->used = 0;
@@ -122,8 +109,7 @@ void *kmalloc(uint32 size)
     return (char *) chunk + sizeof(struct MallocHeader);
 }
 
-void kfree(void *v_addr)
-{
+void kfree(void *v_addr) {
     if (v_addr==(void*)0)
         return;
 
@@ -137,27 +123,21 @@ void kfree(void *v_addr)
     //Merge free block with next free block
     while ((other = (struct MallocHeader *)((char *)chunk + chunk->size))
            && other < (struct MallocHeader *)gKernelHeap
-           && other->used == 0)
-    {
+           && other->used == 0) {
         chunk->size += other->size;
     }
 }
 
-static void sbrkPage(Process* process, int pageCount)
-{
-    if (pageCount > 0)
-    {
-        for (int i = 0; i < pageCount; ++i)
-        {
-            if ((process->heapNextUnallocatedPageBegin + PAGESIZE_4M) > (char*)USER_OFFSET_END)
-            {
+static void sbrkPage(Process* process, int pageCount) {
+    if (pageCount > 0) {
+        for (int i = 0; i < pageCount; ++i) {
+            if ((process->heapNextUnallocatedPageBegin + PAGESIZE_4M) > (char*)USER_OFFSET_END) {
                 return;
             }
 
             char * p_addr = getPageFrame4M();
 
-            if ((int)(p_addr) < 0)
-            {
+            if ((int)(p_addr) < 0) {
                 //PANIC("sbrkPage(): no free page frame available !");
                 return;
             }
@@ -167,14 +147,11 @@ static void sbrkPage(Process* process, int pageCount)
             process->heapNextUnallocatedPageBegin += PAGESIZE_4M;
         }
     }
-    else if (pageCount < 0)
-    {
+    else if (pageCount < 0) {
         pageCount *= -1;
 
-        for (int i = 0; i < pageCount; ++i)
-        {
-            if (process->heapNextUnallocatedPageBegin - PAGESIZE_4M >= process->heapBegin)
-            {
+        for (int i = 0; i < pageCount; ++i) {
+            if (process->heapNextUnallocatedPageBegin - PAGESIZE_4M >= process->heapBegin) {
                 process->heapNextUnallocatedPageBegin -= PAGESIZE_4M;
 
                 //This also releases the page frame
@@ -184,8 +161,7 @@ static void sbrkPage(Process* process, int pageCount)
     }
 }
 
-void initializeProcessHeap(Process* process)
-{
+void initializeProcessHeap(Process* process) {
     process->heapBegin = (char*) USER_OFFSET;
     process->heapEnd = process->heapBegin;
     process->heapNextUnallocatedPageBegin = process->heapBegin;
@@ -197,45 +173,39 @@ void initializeProcessHeap(Process* process)
     sbrk(process, USER_EXE_IMAGE);
 }
 
-void *sbrk(Process* process, int nBytes)
-{
+void *sbrk(Process* process, int nBytes) {
     printkf("sbrk:1: pid:%d nBytes:%d\n", process->pid, nBytes);
 
     char* previousBreak = process->heapEnd;
     printkf("before: %x\n", previousBreak);
 
-    if (nBytes > 0)
-    {
+    if (nBytes > 0) {
         int remainingInThePage = process->heapNextUnallocatedPageBegin - process->heapEnd;
 
         //printkf("sbrk:2: remainingInThePage:%d\n", remainingInThePage);
 
-        if (nBytes > remainingInThePage)
-        {
+        if (nBytes > remainingInThePage) {
             int bytesNeededInNewPages = nBytes - remainingInThePage;
             int neededNewPageCount = (bytesNeededInNewPages / PAGESIZE_4M) + 1;
 
             //printkf("sbrk:3: neededNewPageCount:%d\n", neededNewPageCount);
 
             uint32 freePages = getFreePageCount();
-            if ((uint32)neededNewPageCount + 1 > freePages)
-            {
+            if ((uint32)neededNewPageCount + 1 > freePages) {
                 return (void*)-1;
             }
 
             sbrkPage(process, neededNewPageCount);
         }
     }
-    else if (nBytes < 0)
-    {
+    else if (nBytes < 0) {
         char* currentPageBegin = process->heapNextUnallocatedPageBegin - PAGESIZE_4M;
 
         int remainingInThePage = process->heapEnd - currentPageBegin;
 
         //printkf("sbrk:4: remainingInThePage:%d\n", remainingInThePage);
 
-        if (-nBytes > remainingInThePage)
-        {
+        if (-nBytes > remainingInThePage) {
             int bytesInPreviousPages = -nBytes - remainingInThePage;
             int neededNewPageCount = (bytesInPreviousPages / PAGESIZE_4M) + 1;
 
@@ -251,7 +221,6 @@ void *sbrk(Process* process, int nBytes)
     return previousBreak;
 }
 
-uint32 getKernelHeapUsed()
-{
+uint32 getKernelHeapUsed() {
     return gKernelHeapUsed;
 }
diff --git a/kernel.soso/alloc.h b/kernel.soso/alloc.h
index 7594050d..e4985aa5 100644
--- a/kernel.soso/alloc.h
+++ b/kernel.soso/alloc.h
@@ -14,8 +14,7 @@ void *sbrk(Process* process, int nBytes);
 
 uint32 getKernelHeapUsed();
 
-struct MallocHeader
-{
+struct MallocHeader {
     unsigned long size:31;
     unsigned long used:1;
 } __attribute__ ((packed));
diff --git a/kernel.soso/common.c b/kernel.soso/common.c
index 160a9198..446f21a2 100644
--- a/kernel.soso/common.c
+++ b/kernel.soso/common.c
@@ -5,33 +5,28 @@
 static BOOL gInterruptsWereEnabled = FALSE;
 
 // Write a byte out to the specified port.
-void outb(uint16 port, uint8 value)
-{
+void outb(uint16 port, uint8 value) {
     asm volatile ("outb %1, %0" : : "dN" (port), "a" (value));
 }
 
-void outw(uint16 port, uint16 value)
-{
+void outw(uint16 port, uint16 value) {
     asm volatile ("outw %1, %0" : : "dN" (port), "a" (value));
 }
 
-uint8 inb(uint16 port)
-{
+uint8 inb(uint16 port) {
     uint8 ret;
     asm volatile("inb %1, %0" : "=a" (ret) : "dN" (port));
     return ret;
 }
 
-uint16 inw(uint16 port)
-{
+uint16 inw(uint16 port) {
     uint16 ret;
     asm volatile ("inw %1, %0" : "=a" (ret) : "dN" (port));
     return ret;
 }
 
 // Copy len bytes from src to dest.
-void* memcpy(uint8 *dest, const uint8 *src, uint32 len)
-{
+void* memcpy(uint8 *dest, const uint8 *src, uint32 len) {
     const uint8 *sp = (const uint8 *)src;
     uint8 *dp = (uint8 *)dest;
     for(; len != 0; len--) *dp++ = *sp++;
@@ -40,16 +35,14 @@ void* memcpy(uint8 *dest, const uint8 *src, uint32 len)
 }
 
 // Write len copies of val into dest.
-void* memset(uint8 *dest, uint8 val, uint32 len)
-{
+void* memset(uint8 *dest, uint8 val, uint32 len) {
     uint8 *temp = (uint8 *)dest;
     for ( ; len != 0; len--) *temp++ = val;
 
     return dest;
 }
 
-void* memmove(void* dest, const void* src, uint32 n)
-{
+void* memmove(void* dest, const void* src, uint32 n) {
     uint8* _dest;
     uint8* _src;
 
@@ -72,8 +65,7 @@ void* memmove(void* dest, const void* src, uint32 n)
     return dest;
 }
 
-int memcmp( const void* p1, const void* p2, uint32 c )
-{
+int memcmp( const void* p1, const void* p2, uint32 c ) {
     const uint8* su1, *su2;
     int8 res = 0;
 
@@ -88,34 +80,27 @@ int memcmp( const void* p1, const void* p2, uint32 c )
 
 // Compare two strings. Should return -1 if 
 // str1 < str2, 0 if they are equal or 1 otherwise.
-int strcmp(const char *str1, const char *str2)
-{
+int strcmp(const char *str1, const char *str2) {
       int i = 0;
       int failed = 0;
-      while(str1[i] != '\0' && str2[i] != '\0')
-      {
-          if(str1[i] != str2[i])
-          {
+      while(str1[i] != '\0' && str2[i] != '\0') {
+          if(str1[i] != str2[i]) {
               failed = 1;
               break;
           }
           i++;
       }
 
-      if ((str1[i] == '\0' && str2[i] != '\0') || (str1[i] != '\0' && str2[i] == '\0'))
-      {
+      if ((str1[i] == '\0' && str2[i] != '\0') || (str1[i] != '\0' && str2[i] == '\0')) {
           failed = 1;
       }
   
       return failed;
 }
 
-int strncmp(const char *str1, const char *str2, int length)
-{
-    for (int i = 0; i < length; ++i)
-    {
-        if (str1[i] != str2[i])
-        {
+int strncmp(const char *str1, const char *str2, int length) {
+    for (int i = 0; i < length; ++i) {
+        if (str1[i] != str2[i]) {
             return str1[i] - str2[i];
         }
     }
@@ -125,10 +110,8 @@ int strncmp(const char *str1, const char *str2, int length)
 
 // Copy the NULL-terminated string src into dest, and
 // return dest.
-char *strcpy(char *dest, const char *src)
-{
-    do
-    {
+char *strcpy(char *dest, const char *src) {
+    do {
       *dest++ = *src++;
     }
     while (*src != 0);
@@ -137,10 +120,8 @@ char *strcpy(char *dest, const char *src)
     return dest;
 }
 
-char *strcpyNonNull(char *dest, const char *src)
-{
-    do
-    {
+char *strcpyNonNull(char *dest, const char *src) {
+    do {
       *dest++ = *src++;
     }
     while (*src != 0);
@@ -152,22 +133,17 @@ char *strcpyNonNull(char *dest, const char *src)
 //destination is padded with zeros until a total of num characters have been written to it.
 //No null-character is implicitly appended at the end of destination if source is longer than num.
 //Thus, in this case, destination shall not be considered a null terminated C string.
-char *strncpy(char *dest, const char *src, uint32 num)
-{
+char *strncpy(char *dest, const char *src, uint32 num) {
     BOOL sourceEnded = FALSE;
-    for (uint32 i = 0; i < num; ++i)
-    {
-        if (sourceEnded == FALSE && src[i] == '\0')
-        {
+    for (uint32 i = 0; i < num; ++i) {
+        if (sourceEnded == FALSE && src[i] == '\0') {
             sourceEnded = TRUE;
         }
 
-        if (sourceEnded)
-        {
+        if (sourceEnded) {
             dest[i] = '\0';
         }
-        else
-        {
+        else {
             dest[i] = src[i];
         }
     }
@@ -175,8 +151,7 @@ char *strncpy(char *dest, const char *src, uint32 num)
     return dest;
 }
 
-char* strcat(char *dest, const char *src)
-{
+char* strcat(char *dest, const char *src) {
     size_t i,j;
     for (i = 0; dest[i] != '\0'; i++)
         ;
@@ -186,21 +161,17 @@ char* strcat(char *dest, const char *src)
     return dest;
 }
 
-int strlen(const char *src)
-{
+int strlen(const char *src) {
     int i = 0;
     while (*src++)
         i++;
     return i;
 }
 
-int strFirstIndexOf(const char *src, char c)
-{
+int strFirstIndexOf(const char *src, char c) {
     int i = 0;
-    while (src[i])
-    {
-        if (src[i] == c)
-        {
+    while (src[i]) {
+        if (src[i] == c) {
             return i;
         }
         i++;
@@ -209,8 +180,7 @@ int strFirstIndexOf(const char *src, char c)
     return -1;
 }
 
-uint32 rand()
-{
+uint32 rand() {
     static uint32 x = 123456789;
     static uint32 y = 362436069;
     static uint32 z = 521288629;
@@ -223,39 +193,33 @@ uint32 rand()
     return w = w ^ (w >> 19) ^ t ^ (t >> 8);
 }
 
-int atoi(char *str)
-{
+int atoi(char *str) {
     int result = 0;
 
-    for (int i = 0; str[i] != '\0'; ++i)
-    {
+    for (int i = 0; str[i] != '\0'; ++i) {
         result = result*10 + str[i] - '0';
     }
 
     return result;
 }
 
-void itoa (char *buf, int base, int d)
-{
+void itoa (char *buf, int base, int d) {
     char *p = buf;
     char *p1, *p2;
     unsigned long ud = d;
     int divisor = 10;
 
 
-    if (base == 'd' && d < 0)
-    {
+    if (base == 'd' && d < 0) {
         *p++ = '-';
         buf++;
         ud = -d;
     }
-    else if (base == 'x')
-    {
+    else if (base == 'x') {
         divisor = 16;
     }
 
-    do
-    {
+    do {
         int remainder = ud % divisor;
 
         *p++ = (remainder < 10) ? remainder + '0' : remainder + 'A' - 10;
@@ -268,8 +232,7 @@ void itoa (char *buf, int base, int d)
     //Reverse BUF.
     p1 = buf;
     p2 = p - 1;
-    while (p1 < p2)
-    {
+    while (p1 < p2) {
         char tmp = *p1;
         *p1 = *p2;
         *p2 = tmp;
@@ -278,24 +241,20 @@ void itoa (char *buf, int base, int d)
     }
 }
 
-int sprintf_va(char* buffer, const char *format, __builtin_va_list vl)
-{
+int sprintf_va(char* buffer, const char *format, __builtin_va_list vl) {
     char c;
     char buf[20];
 
     int bufferIndex = 0;
 
-    while ((c = *format++) != 0)
-      {
+    while ((c = *format++) != 0) {
         if (c != '%')
           buffer[bufferIndex++] = c;
-        else
-          {
+        else {
             char *p;
 
             c = *format++;
-            switch (c)
-              {
+            switch (c) {
               case 'x':
                  buf[0] = '0';
                  buf[1] = 'x';
@@ -336,8 +295,7 @@ int sprintf_va(char* buffer, const char *format, __builtin_va_list vl)
     return bufferIndex;
 }
 
-int sprintf(char* buffer, const char *format, ...)
-{
+int sprintf(char* buffer, const char *format, ...) {
     int result = 0;
 
     __builtin_va_list vl;
@@ -350,16 +308,14 @@ int sprintf(char* buffer, const char *format, ...)
     return result;
 }
 
-void printkf(const char *format, ...)
-{
+void printkf(const char *format, ...) {
     char buffer[1024];
     buffer[0] = 'k';
     buffer[1] = ':';
     buffer[2] = 0;
 
     Tty* tty = getActiveTTY();
-    if (tty)
-    {
+    if (tty) {
         __builtin_va_list vl;
         __builtin_va_start(vl, format);
 
@@ -369,15 +325,13 @@ void printkf(const char *format, ...)
 
         Tty_PutText(tty, buffer);
 
-        if (tty->flushScreen)
-        {
+        if (tty->flushScreen) {
             tty->flushScreen(tty);
         }
     }
 }
 
-void panic(const char *message, const char *file, uint32 line)
-{
+void panic(const char *message, const char *file, uint32 line) {
     disableInterrupts();
 
     printkf("PANIC:%s:%d:%s\n", file, line, message);
@@ -385,13 +339,11 @@ void panic(const char *message, const char *file, uint32 line)
     halt();
 }
 
-void warning(const char *message, const char *file, uint32 line)
-{
+void warning(const char *message, const char *file, uint32 line) {
     printkf("WARNING:%s:%d:%s\n", file, line, message);
 }
 
-void panic_assert(const char *file, uint32 line, const char *desc)
-{
+void panic_assert(const char *file, uint32 line, const char *desc) {
     disableInterrupts();
 
     printkf("ASSERTION-FAILED:%s:%d:%s\n", file, line, desc);
@@ -399,16 +351,14 @@ void panic_assert(const char *file, uint32 line, const char *desc)
     halt();
 }
 
-uint32 readEsp()
-{
+uint32 readEsp() {
     uint32 stack_pointer;
     asm volatile("mov %%esp, %0" : "=r" (stack_pointer));
 
     return stack_pointer;
 }
 
-uint32 getCpuFlags()
-{
+uint32 getCpuFlags() {
     uint32 eflags = 0;
 
     asm("pushfl; pop %%eax; mov %%eax, %0": "=m"(eflags):);
@@ -416,8 +366,7 @@ uint32 getCpuFlags()
     return eflags;
 }
 
-BOOL isInterruptsEnabled()
-{
+BOOL isInterruptsEnabled() {
     uint32 eflags = getCpuFlags();
 
     uint32 interruptFlag = 0x200; //9th flag
@@ -425,17 +374,14 @@ BOOL isInterruptsEnabled()
     return (eflags & interruptFlag) == interruptFlag;
 }
 
-void beginCriticalSection()
-{
+void beginCriticalSection() {
     gInterruptsWereEnabled = isInterruptsEnabled();
 
     disableInterrupts();
 }
 
-void endCriticalSection()
-{
-    if (gInterruptsWereEnabled)
-    {
+void endCriticalSection() {
+    if (gInterruptsWereEnabled) {
         enableInterrupts();
     }
 }
diff --git a/kernel.soso/commonuser.h b/kernel.soso/commonuser.h
index d0409603..3a488ea8 100644
--- a/kernel.soso/commonuser.h
+++ b/kernel.soso/commonuser.h
@@ -1,16 +1,14 @@
 #ifndef COMMONUSER_H
 #define COMMONUSER_H
 
-typedef struct SosoMessage
-{
+typedef struct SosoMessage {
     int messageType;
     int parameter1;
     int parameter2;
     int parameter3;
 } SosoMessage;
 
-typedef struct TtyUserBuffer
-{
+typedef struct TtyUserBuffer {
     unsigned short lineCount;
     unsigned short columnCount;
     unsigned short currentLine;
diff --git a/kernel.soso/debugprint.c b/kernel.soso/debugprint.c
index f942548f..186bc89f 100644
--- a/kernel.soso/debugprint.c
+++ b/kernel.soso/debugprint.c
@@ -4,15 +4,13 @@
 
 static File* gFile = NULL;
 
-void Debug_initialize(const char* fileName)
-{
+void Debug_initialize(const char* fileName) {
     FileSystemNode* node = getFileSystemNode(fileName);
 
     gFile = open_fs(node, 0);
 }
 
-void Debug_PrintF(const char *format, ...)
-{
+void Debug_PrintF(const char *format, ...) {
     char **arg = (char **) &format;
     char c;
     char buf[20];
@@ -24,22 +22,18 @@ void Debug_PrintF(const char *format, ...)
     __builtin_va_list vl;
     __builtin_va_start(vl, format);
 
-    while ((c = *format++) != 0)
-      {
-        if (bufferIndex > 510)
-        {
+    while ((c = *format++) != 0) {
+        if (bufferIndex > 510) {
             break;
         }
 
         if (c != '%')
           buffer[bufferIndex++] = c;
-        else
-          {
+        else {
             char *p;
 
             c = *format++;
-            switch (c)
-              {
+            switch (c) {
               case 'x':
                  buf[0] = '0';
                  buf[1] = 'x';
@@ -77,8 +71,7 @@ void Debug_PrintF(const char *format, ...)
 
     buffer[bufferIndex] = '\0';
 
-    if (gFile)
-    {
+    if (gFile) {
         write_fs(gFile, strlen(buffer), (uint8*)buffer);
     }
 
diff --git a/kernel.soso/descriptortables.c b/kernel.soso/descriptortables.c
index 258e33c6..b6aab367 100644
--- a/kernel.soso/descriptortables.c
+++ b/kernel.soso/descriptortables.c
@@ -25,8 +25,7 @@ extern IsrFunction gInterruptHandlers[];
 static void handleDoubleFault(Registers *regs);
 static void handleGeneralProtectionFault(Registers *regs);
 
-void initializeDescriptorTables()
-{
+void initializeDescriptorTables() {
     initializeGdt();
 
     initializeIdt();
@@ -37,8 +36,7 @@ void initializeDescriptorTables()
     registerInterruptHandler(13, handleGeneralProtectionFault);
 }
 
-static void initializeGdt()
-{
+static void initializeGdt() {
     gGdtPointer.limit = (sizeof(GdtEntry) * 6) - 1;
     gGdtPointer.base  = (uint32)&gGdtEntries;
 
@@ -66,8 +64,7 @@ static void initializeGdt()
 }
 
 // Set the value of one GDT entry.
-static void setGdtEntry(int32 num, uint32 base, uint32 limit, uint8 access, uint8 gran)
-{
+static void setGdtEntry(int32 num, uint32 base, uint32 limit, uint8 access, uint8 gran) {
     gGdtEntries[num].base_low    = (base & 0xFFFF);
     gGdtEntries[num].base_middle = (base >> 16) & 0xFF;
     gGdtEntries[num].base_high   = (base >> 24) & 0xFF;
@@ -81,8 +78,7 @@ static void setGdtEntry(int32 num, uint32 base, uint32 limit, uint8 access, uint
 
 void irqTimer();
 
-static void initializeIdt()
-{
+static void initializeIdt() {
     gIdtPointer.limit = sizeof(IdtEntry) * 256 -1;
     gIdtPointer.base  = (uint32)&gIdtEntries;
 
@@ -154,8 +150,7 @@ static void initializeIdt()
     flushIdt((uint32)&gIdtPointer);
 }
 
-static void setIdtEntry(uint8 num, uint32 base, uint16 sel, uint8 flags)
-{
+static void setIdtEntry(uint8 num, uint32 base, uint16 sel, uint8 flags) {
     gIdtEntries[num].base_lo = base & 0xFFFF;
     gIdtEntries[num].base_hi = (base >> 16) & 0xFFFF;
 
@@ -164,38 +159,31 @@ static void setIdtEntry(uint8 num, uint32 base, uint16 sel, uint8 flags)
     gIdtEntries[num].flags   = flags  | 0x60;
 }
 
-static void handleDoubleFault(Registers *regs)
-{
+static void handleDoubleFault(Registers *regs) {
     printkf("Double fault!!! Error code:%d\n", regs->errorCode);
 
     PANIC("Double fault!!!");
 }
 
-static void handleGeneralProtectionFault(Registers *regs)
-{
+static void handleGeneralProtectionFault(Registers *regs) {
     printkf("General protection fault!!! Error code:%d - IP:%x\n", regs->errorCode, regs->eip);
 
     Thread* faultingThread = getCurrentThread();
-    if (NULL != faultingThread)
-    {
+    if (NULL != faultingThread) {
         Thread* mainThread = getMainKernelThread();
 
-        if (mainThread == faultingThread)
-        {
+        if (mainThread == faultingThread) {
             PANIC("General protection fault in Kernel main thread!!!");
         }
-        else
-        {
+        else {
             printkf("Faulting thread is %d\n", faultingThread->threadId);
 
-            if (faultingThread->userMode)
-            {
+            if (faultingThread->userMode) {
                 printkf("Destroying process %d\n", faultingThread->owner->pid);
 
                 destroyProcess(faultingThread->owner);
             }
-            else
-            {
+            else {
                 printkf("Destroying kernel thread %d\n", faultingThread->threadId);
 
                 destroyThread(faultingThread);
@@ -204,8 +192,7 @@ static void handleGeneralProtectionFault(Registers *regs)
             waitForSchedule();
         }
     }
-    else
-    {
+    else {
         PANIC("General protection fault!!!");
     }
 }
diff --git a/kernel.soso/descriptortables.h b/kernel.soso/descriptortables.h
index bd0d4e8e..0b1b6ada 100644
--- a/kernel.soso/descriptortables.h
+++ b/kernel.soso/descriptortables.h
@@ -6,8 +6,7 @@
 void initializeDescriptorTables();
 
 
-struct GdtEntry
-{
+struct GdtEntry {
     uint16 limit_low;
     uint16 base_low;
     uint8  base_middle;
@@ -19,8 +18,7 @@ struct GdtEntry
 typedef struct GdtEntry GdtEntry;
 
 
-struct GdtPointer
-{
+struct GdtPointer {
     uint16 limit;
     uint32 base;
 } __attribute__((packed));
@@ -28,8 +26,7 @@ struct GdtPointer
 typedef struct GdtPointer GdtPointer;
 
 
-struct IdtEntry
-{
+struct IdtEntry {
     uint16 base_lo;
     uint16 sel;
     uint8  always0;
@@ -40,8 +37,7 @@ struct IdtEntry
 typedef struct IdtEntry IdtEntry;
 
 
-struct IdtPointer
-{
+struct IdtPointer {
     uint16 limit;
     uint32 base;
 } __attribute__((packed));
diff --git a/kernel.soso/devfs.c b/kernel.soso/devfs.c
index 0f311f53..bfff39cb 100644
--- a/kernel.soso/devfs.c
+++ b/kernel.soso/devfs.c
@@ -18,8 +18,7 @@ static FileSystemNode *devfs_finddir(FileSystemNode *node, char *name);
 
 static FileSystemDirent gDirent;
 
-void initializeDevFS()
-{
+void initializeDevFS() {
     gDevRoot = kmalloc(sizeof(FileSystemNode));
     memset((uint8*)gDevRoot, 0, sizeof(FileSystemNode));
 
@@ -29,15 +28,13 @@ void initializeDevFS()
 
     FileSystemNode* devNode = finddir_fs(rootFs, "dev");
 
-    if (devNode)
-    {
+    if (devNode) {
         devNode->nodeType |= FT_MountPoint;
         devNode->mountPoint = gDevRoot;
         gDevRoot->parent = devNode->parent;
         strcpy(gDevRoot->name, devNode->name);
     }
-    else
-    {
+    else {
         PANIC("/dev does not exist!");
     }
 
@@ -49,23 +46,19 @@ void initializeDevFS()
     Spinlock_Init(&gDeviceListLock);
 }
 
-static BOOL devfs_open(File *node, uint32 flags)
-{
+static BOOL devfs_open(File *node, uint32 flags) {
     return TRUE;
 }
 
-static FileSystemDirent *devfs_readdir(FileSystemNode *node, uint32 index)
-{
+static FileSystemDirent *devfs_readdir(FileSystemNode *node, uint32 index) {
     FileSystemDirent * result = NULL;
 
     uint32 counter = 0;
 
     Spinlock_Lock(&gDeviceListLock);
 
-    List_Foreach(n, gDeviceList)
-    {
-        if (index == counter)
-        {
+    List_Foreach(n, gDeviceList) {
+        if (index == counter) {
             FileSystemNode* deviceNode = (FileSystemNode*)n->data;
             strcpy(gDirent.name, deviceNode->name);
             gDirent.fileType = deviceNode->nodeType;
@@ -81,19 +74,16 @@ static FileSystemDirent *devfs_readdir(FileSystemNode *node, uint32 index)
     return result;
 }
 
-static FileSystemNode *devfs_finddir(FileSystemNode *node, char *name)
-{
+static FileSystemNode *devfs_finddir(FileSystemNode *node, char *name) {
     FileSystemNode* result = NULL;
 
 
     Spinlock_Lock(&gDeviceListLock);
 
-    List_Foreach(n, gDeviceList)
-    {
+    List_Foreach(n, gDeviceList) {
         FileSystemNode* deviceNode = (FileSystemNode*)n->data;
 
-        if (strcmp(name, deviceNode->name) == 0)
-        {
+        if (strcmp(name, deviceNode->name) == 0) {
             result = deviceNode;
             break;
         }
@@ -104,16 +94,13 @@ static FileSystemNode *devfs_finddir(FileSystemNode *node, char *name)
     return result;
 }
 
-FileSystemNode* registerDevice(Device* device)
-{
+FileSystemNode* registerDevice(Device* device) {
     Spinlock_Lock(&gDeviceListLock);
 
-    List_Foreach(n, gDeviceList)
-    {
+    List_Foreach(n, gDeviceList) {
         FileSystemNode* deviceNode = (FileSystemNode*)n->data;
 
-        if (strcmp(device->name, deviceNode->name) == 0)
-        {
+        if (strcmp(device->name, deviceNode->name) == 0) {
             //There is already a device with the same name
             Spinlock_Unlock(&gDeviceListLock);
             return NULL;
diff --git a/kernel.soso/device.h b/kernel.soso/device.h
index 47fc19bc..ac85634b 100644
--- a/kernel.soso/device.h
+++ b/kernel.soso/device.h
@@ -4,8 +4,7 @@
 #include "common.h"
 #include "fs.h"
 
-typedef struct Device
-{
+typedef struct Device {
     char name[16];
     FileType deviceType;
     ReadWriteBlockFunction readBlock;
diff --git a/kernel.soso/elf.c b/kernel.soso/elf.c
index 7c74d50c..4a0b75a8 100644
--- a/kernel.soso/elf.c
+++ b/kernel.soso/elf.c
@@ -3,21 +3,18 @@
 #include "process.h"
 #include "screen.h"
 
-BOOL isElf(char *elfData)
-{
+BOOL isElf(char *elfData) {
     Elf32_Ehdr *hdr = (Elf32_Ehdr *) elfData;
 
     if (hdr->e_ident[0] == 0x7f && hdr->e_ident[1] == 'E' &&
-        hdr->e_ident[2] == 'L' && hdr->e_ident[3] == 'F')
-    {
+        hdr->e_ident[2] == 'L' && hdr->e_ident[3] == 'F') {
         return TRUE;
     }
 
     return FALSE;
 }
 
-uint32 loadElf(char *elfData)
-{
+uint32 loadElf(char *elfData) {
     uint32 v_begin, v_end;
     Elf32_Ehdr *hdr;
     Elf32_Phdr *p_entry;
@@ -28,29 +25,24 @@ uint32 loadElf(char *elfData)
 
     s_entry = (Elf32_Scdr*) (elfData + hdr->e_shoff);
 
-    if (isElf(elfData)==FALSE)
-    {
+    if (isElf(elfData)==FALSE) {
         return 0;
     }
 
-    for (int pe = 0; pe < hdr->e_phnum; pe++, p_entry++)
-    {
+    for (int pe = 0; pe < hdr->e_phnum; pe++, p_entry++) {
         //Read each entry
         printkf("loading p_entry %d\n", pe);
 
-        if (p_entry->p_type == PT_LOAD)
-        {
+        if (p_entry->p_type == PT_LOAD) {
             v_begin = p_entry->p_vaddr;
             v_end = p_entry->p_vaddr + p_entry->p_memsz;
             printkf("p_entry: %x\n", v_begin);
-            if (v_begin < USER_OFFSET)
-            {
+            if (v_begin < USER_OFFSET) {
                 printkf("INFO: loadElf(): can't load executable below %x\n", USER_OFFSET);
                 return 0;
             }
 
-            if (v_end > USER_STACK)
-            {
+            if (v_end > USER_STACK) {
                 printkf("INFO: loadElf(): can't load executable above %x\n", USER_STACK);
                 return 0;
             }
@@ -61,11 +53,9 @@ uint32 loadElf(char *elfData)
             printkf("about to memcpy\n");
             memcpy((uint8 *) v_begin, (uint8 *) (elfData + p_entry->p_offset), p_entry->p_filesz);
             printkf("done with memcpy\n");
-            if (p_entry->p_memsz > p_entry->p_filesz)
-            {
+            if (p_entry->p_memsz > p_entry->p_filesz) {
                 char* p = (char *) p_entry->p_vaddr;
-                for (int i = p_entry->p_filesz; i < (int)(p_entry->p_memsz); i++)
-                {
+                for (int i = p_entry->p_filesz; i < (int)(p_entry->p_memsz); i++) {
                     p[i] = 0;
                 }
             }
diff --git a/kernel.soso/fatfilesystem.c b/kernel.soso/fatfilesystem.c
index cb163d19..9e3c2116 100644
--- a/kernel.soso/fatfilesystem.c
+++ b/kernel.soso/fatfilesystem.c
@@ -30,8 +30,7 @@ static FileSystemDirent gFileSystemDirent;
 static FileSystemNode* gMountedBlockDevices[FF_VOLUMES];
 
 
-void initializeFatFileSystem()
-{
+void initializeFatFileSystem() {
     FileSystem fs;
     memset((uint8*)&fs, 0, sizeof(fs));
     strcpy(fs.name, "fat");
@@ -40,38 +39,30 @@ void initializeFatFileSystem()
 
     registerFileSystem(&fs);
 
-    for (int i = 0; i < FF_VOLUMES; ++i)
-    {
+    for (int i = 0; i < FF_VOLUMES; ++i) {
         gMountedBlockDevices[i] = NULL;
     }
 }
 
-static BOOL mount(const char* sourcePath, const char* targetPath, uint32 flags, void *data)
-{
+static BOOL mount(const char* sourcePath, const char* targetPath, uint32 flags, void *data) {
     printkf("fat mount source: %s\n", sourcePath);
 
     FileSystemNode* node = getFileSystemNode(sourcePath);
-    if (node && node->nodeType == FT_BlockDevice)
-    {
+    if (node && node->nodeType == FT_BlockDevice) {
         FileSystemNode* targetNode = getFileSystemNode(targetPath);
-        if (targetNode)
-        {
-            if (targetNode->nodeType == FT_Directory)
-            {
+        if (targetNode) {
+            if (targetNode->nodeType == FT_Directory) {
                 printkf("fat mount target: %s\n", targetPath);
 
                 int32 volume = -1;
-                for (int32 v = 0; v < FF_VOLUMES; ++v)
-                {
-                    if (NULL == gMountedBlockDevices[v])
-                    {
+                for (int32 v = 0; v < FF_VOLUMES; ++v) {
+                    if (NULL == gMountedBlockDevices[v]) {
                         volume = v;
                         break;
                     }
                 }
 
-                if (volume < 0)
-                {
+                if (volume < 0) {
                     return FALSE;
                 }
 
@@ -98,15 +89,13 @@ static BOOL mount(const char* sourcePath, const char* targetPath, uint32 flags,
                 FRESULT fr = f_mount(fatFs, path, 1);
                 //printkf("f_mount: fr:%d drv:%d\n", fr, fatFs->pdrv);
 
-                if (FR_OK == fr)
-                {
+                if (FR_OK == fr) {
                     targetNode->nodeType |= FT_MountPoint;
                     targetNode->mountPoint = newNode;
 
                     return TRUE;
                 }
-                else
-                {
+                else {
                     kfree(newNode);
 
                     kfree(fatFs);
@@ -120,16 +109,12 @@ static BOOL mount(const char* sourcePath, const char* targetPath, uint32 flags,
     return FALSE;
 }
 
-static BOOL checkMount(const char* sourcePath, const char* targetPath, uint32 flags, void *data)
-{
+static BOOL checkMount(const char* sourcePath, const char* targetPath, uint32 flags, void *data) {
     FileSystemNode* node = getFileSystemNode(sourcePath);
-    if (node && node->nodeType == FT_BlockDevice)
-    {
+    if (node && node->nodeType == FT_BlockDevice) {
         FileSystemNode* targetNode = getFileSystemNode(targetPath);
-        if (targetNode)
-        {
-            if (targetNode->nodeType == FT_Directory)
-            {
+        if (targetNode) {
+            if (targetNode->nodeType == FT_Directory) {
                 return TRUE;
             }
         }
@@ -138,8 +123,7 @@ static BOOL checkMount(const char* sourcePath, const char* targetPath, uint32 fl
     return FALSE;
 }
 
-static FileSystemDirent* readdir(FileSystemNode *node, uint32 index)
-{
+static FileSystemDirent* readdir(FileSystemNode *node, uint32 index) {
     //when node is the root of mounted filesystem,
     //node->mountSource is the source node (eg. disk partition /dev/hd1p1)
 
@@ -150,14 +134,12 @@ static FileSystemDirent* readdir(FileSystemNode *node, uint32 index)
     FileSystemNode *n = node;
     int charIndex = 126;
     memset(targetPath, 0, 128);
-    while (NULL == n->mountSource)
-    {
+    while (NULL == n->mountSource) {
         int length = strlen(n->name);
 
         charIndex -= length;
 
-        if (charIndex < 2)
-        {
+        if (charIndex < 2) {
             return NULL;
         }
 
@@ -174,8 +156,7 @@ static FileSystemDirent* readdir(FileSystemNode *node, uint32 index)
     targetPath[charIndex] = ':';
     int length = strlen(number);
     charIndex -= length;
-    if (charIndex < 0)
-    {
+    if (charIndex < 0) {
         return NULL;
     }
 
@@ -186,16 +167,13 @@ static FileSystemDirent* readdir(FileSystemNode *node, uint32 index)
 
     DIR dir;
     FRESULT fr = f_opendir(&dir, (TCHAR*)target);
-    if (FR_OK == fr)
-    {
+    if (FR_OK == fr) {
         FILINFO fileInfo;
-        for (int i = 0; i <= index; ++i)
-        {
+        for (int i = 0; i <= index; ++i) {
             memset((uint8*)&fileInfo, 0, sizeof(FILINFO));
             fr = f_readdir(&dir, &fileInfo);
 
-            if (strlen(fileInfo.fname) <= 0)
-            {
+            if (strlen(fileInfo.fname) <= 0) {
                 f_closedir(&dir);
 
                 return NULL;
@@ -204,12 +182,10 @@ static FileSystemDirent* readdir(FileSystemNode *node, uint32 index)
 
         gFileSystemDirent.inode = 0;
         strcpy(gFileSystemDirent.name, fileInfo.fname);
-        if ((fileInfo.fattrib & AM_DIR) == AM_DIR)
-        {
+        if ((fileInfo.fattrib & AM_DIR) == AM_DIR) {
             gFileSystemDirent.fileType = FT_Directory;
         }
-        else
-        {
+        else {
             gFileSystemDirent.fileType = FT_File;
         }
 
@@ -221,18 +197,15 @@ static FileSystemDirent* readdir(FileSystemNode *node, uint32 index)
     return NULL;
 }
 
-static FileSystemNode* finddir(FileSystemNode *node, char *name)
-{
+static FileSystemNode* finddir(FileSystemNode *node, char *name) {
     //when node is the root of mounted filesystem,
     //node->mountSource is the source node (eg. disk partition /dev/hd1p1)
 
     //printkf("finddir1: node->name:%s name:%s\n", node->name, name);
 
     FileSystemNode* child = node->firstChild;
-    while (NULL != child)
-    {
-        if (strcmp(name, child->name) == 0)
-        {
+    while (NULL != child) {
+        if (strcmp(name, child->name) == 0) {
             return child;
         }
 
@@ -252,13 +225,11 @@ static FileSystemNode* finddir(FileSystemNode *node, char *name)
     strcpyNonNull((char*)(targetPath + charIndex), name);
     charIndex -= 1;
     targetPath[charIndex] = '/';
-    while (NULL == n->mountSource)
-    {
+    while (NULL == n->mountSource) {
         length = strlen(n->name);
         charIndex -= length;
 
-        if (charIndex < 2)
-        {
+        if (charIndex < 2) {
             return NULL;
         }
 
@@ -275,8 +246,7 @@ static FileSystemNode* finddir(FileSystemNode *node, char *name)
     targetPath[charIndex] = ':';
     length = strlen(number);
     charIndex -= length;
-    if (charIndex < 0)
-    {
+    if (charIndex < 0) {
         return NULL;
     }
 
@@ -288,8 +258,7 @@ static FileSystemNode* finddir(FileSystemNode *node, char *name)
     FILINFO fileInfo;
     memset((uint8*)&fileInfo, 0, sizeof(FILINFO));
     FRESULT fr = f_stat((TCHAR*)target, &fileInfo);
-    if (FR_OK == fr)
-    {
+    if (FR_OK == fr) {
         FileSystemNode* newNode = kmalloc(sizeof(FileSystemNode));
 
         memset((uint8*)newNode, 0, sizeof(FileSystemNode));
@@ -305,24 +274,19 @@ static FileSystemNode* finddir(FileSystemNode *node, char *name)
         newNode->stat = stat;
         newNode->length = fileInfo.fsize;
 
-        if ((fileInfo.fattrib & AM_DIR) == AM_DIR)
-        {
+        if ((fileInfo.fattrib & AM_DIR) == AM_DIR) {
             newNode->nodeType = FT_Directory;
         }
-        else
-        {
+        else {
             newNode->nodeType = FT_File;
         }
 
-        if (NULL == node->firstChild)
-        {
+        if (NULL == node->firstChild) {
             node->firstChild = newNode;
         }
-        else
-        {
+        else {
             FileSystemNode* child = node->firstChild;
-            while (NULL != child->nextSibling)
-            {
+            while (NULL != child->nextSibling) {
                 child = child->nextSibling;
             }
             child->nextSibling = newNode;
@@ -331,18 +295,15 @@ static FileSystemNode* finddir(FileSystemNode *node, char *name)
         //printkf("finddir: returning [%s]\n", name);
         return newNode;
     }
-    else
-    {
+    else {
         //printkf("finddir error: fr: %d]\n", fr);
     }
 
     return NULL;
 }
 
-static int32 read(File *file, uint32 size, uint8 *buffer)
-{
-    if (file->privateData == NULL)
-    {
+static int32 read(File *file, uint32 size, uint8 *buffer) {
+    if (file->privateData == NULL) {
         return -1;
     }
 
@@ -352,18 +313,15 @@ static int32 read(File *file, uint32 size, uint8 *buffer)
     FRESULT fr = f_read(f, buffer, size, &br);
     file->offset = f->fptr;
     //printkf("fat read: name:%s size:%d hasRead:%d, fr:%d\n", file->node->name, size, br, fr);
-    if (FR_OK == fr)
-    {
+    if (FR_OK == fr) {
         return br;
     }
 
     return -1;
 }
 
-static int32 write(File *file, uint32 size, uint8 *buffer)
-{
-    if (file->privateData == NULL)
-    {
+static int32 write(File *file, uint32 size, uint8 *buffer) {
+    if (file->privateData == NULL) {
         return -1;
     }
 
@@ -372,18 +330,15 @@ static int32 write(File *file, uint32 size, uint8 *buffer)
     UINT bw = 0;
     FRESULT fr = f_write(f, buffer, size, &bw);
     file->offset = f->fptr;
-    if (FR_OK == fr)
-    {
+    if (FR_OK == fr) {
         return bw;
     }
 
     return -1;
 }
 
-static int32 lseek(File *file, int32 offset, int32 whence)
-{
-    if (file->privateData == NULL)
-    {
+static int32 lseek(File *file, int32 offset, int32 whence) {
+    if (file->privateData == NULL) {
         return -1;
     }
 
@@ -391,8 +346,7 @@ static int32 lseek(File *file, int32 offset, int32 whence)
 
     FRESULT fr = FR_INVALID_OBJECT;
 
-    switch (whence)
-    {
+    switch (whence) {
     case SEEK_SET:
         fr = f_lseek(f, offset);
         break;
@@ -407,8 +361,7 @@ static int32 lseek(File *file, int32 offset, int32 whence)
     }
 
 
-    if (FR_OK == fr)
-    {
+    if (FR_OK == fr) {
         file->offset = f->fptr;
 
         return file->offset;
@@ -417,8 +370,7 @@ static int32 lseek(File *file, int32 offset, int32 whence)
     return -1;
 }
 
-static int32 stat(FileSystemNode *node, struct stat* buf)
-{
+static int32 stat(FileSystemNode *node, struct stat* buf) {
     //printkf("fat stat [%s]\n", node->name);
 
     uint8 targetPath[128];
@@ -426,13 +378,11 @@ static int32 stat(FileSystemNode *node, struct stat* buf)
     FileSystemNode *n = node;
     int charIndex = 126;
     memset(targetPath, 0, 128);
-    while (NULL == n->mountSource)
-    {
+    while (NULL == n->mountSource) {
         int length = strlen(n->name);
         charIndex -= length;
 
-        if (charIndex < 2)
-        {
+        if (charIndex < 2) {
             return NULL;
         }
 
@@ -449,8 +399,7 @@ static int32 stat(FileSystemNode *node, struct stat* buf)
     targetPath[charIndex] = ':';
     int length = strlen(number);
     charIndex -= length;
-    if (charIndex < 0)
-    {
+    if (charIndex < 0) {
         return NULL;
     }
 
@@ -462,14 +411,11 @@ static int32 stat(FileSystemNode *node, struct stat* buf)
     FILINFO fileInfo;
     memset((uint8*)&fileInfo, 0, sizeof(FILINFO));
     FRESULT fr = f_stat((TCHAR*)target, &fileInfo);
-    if (FR_OK == fr)
-    {
-        if ((fileInfo.fattrib & AM_DIR) == AM_DIR)
-        {
+    if (FR_OK == fr) {
+        if ((fileInfo.fattrib & AM_DIR) == AM_DIR) {
             node->nodeType = FT_Directory;
         }
-        else
-        {
+        else {
             node->nodeType = FT_File;
         }
 
@@ -481,14 +427,12 @@ static int32 stat(FileSystemNode *node, struct stat* buf)
     return -1; //Error
 }
 
-static BOOL open(File *file, uint32 flags)
-{
+static BOOL open(File *file, uint32 flags) {
     //printkf("fat open %s\n", file->node->name);
 
     FileSystemNode *node = file->node;
 
-    if (node->nodeType == FT_Directory)
-    {
+    if (node->nodeType == FT_Directory) {
         return TRUE;
     }
 
@@ -497,13 +441,11 @@ static BOOL open(File *file, uint32 flags)
     FileSystemNode *n = node;
     int charIndex = 126;
     memset(targetPath, 0, 128);
-    while (NULL == n->mountSource)
-    {
+    while (NULL == n->mountSource) {
         int length = strlen(n->name);
         charIndex -= length;
 
-        if (charIndex < 2)
-        {
+        if (charIndex < 2) {
             return NULL;
         }
 
@@ -520,8 +462,7 @@ static BOOL open(File *file, uint32 flags)
     targetPath[charIndex] = ':';
     int length = strlen(number);
     charIndex -= length;
-    if (charIndex < 0)
-    {
+    if (charIndex < 0) {
         return NULL;
     }
 
@@ -532,8 +473,7 @@ static BOOL open(File *file, uint32 flags)
 
     int fatfsMode = FA_READ;
 
-    switch (flags)
-    {
+    switch (flags) {
     case O_RDONLY:
         fatfsMode = FA_READ;
         break;
@@ -550,8 +490,7 @@ static BOOL open(File *file, uint32 flags)
 
     FIL* f = (FIL*)kmalloc(sizeof(FIL));
     FRESULT fr = f_open(f, (TCHAR*)target, fatfsMode);
-    if (FR_OK == fr)
-    {
+    if (FR_OK == fr) {
         file->offset = f->fptr;
 
         file->privateData = f;
@@ -562,10 +501,8 @@ static BOOL open(File *file, uint32 flags)
     return FALSE;
 }
 
-static void close(File *file)
-{
-    if (file->privateData == NULL)
-    {
+static void close(File *file) {
+    if (file->privateData == NULL) {
         return;
     }
 
@@ -580,13 +517,11 @@ static void close(File *file)
 
 DSTATUS disk_initialize(
         BYTE pdrv		//Physical drive nmuber
-)
-{
+) {
     return 0;
 }
 
-DSTATUS disk_status(BYTE pdrv)
-{
+DSTATUS disk_status(BYTE pdrv) {
     return 0;
 }
 
@@ -595,8 +530,7 @@ DRESULT disk_read (
     BYTE *buff,			/* Pointer to the data buffer to store read data */
     DWORD sector,		/* Start sector number (LBA) */
     UINT count			/* Number of sectors to read */
-)
-{
+) {
     //printkf("disk_read() drv:%d sector:%d count:%d\n", pdrv, sector, count);
 
     if (gMountedBlockDevices[pdrv] == NULL) return RES_NOTRDY;
@@ -613,8 +547,7 @@ DRESULT disk_write (
     const BYTE *buff,	/* Pointer to the data to be written */
     DWORD sector,		/* Start sector number (LBA) */
     UINT count			/* Number of sectors to write */
-)
-{
+) {
     if (gMountedBlockDevices[pdrv] == NULL) return RES_NOTRDY;
 
     //if (sector >= RamDiskSize) return RES_PARERR;
@@ -628,8 +561,7 @@ DRESULT disk_ioctl (
     BYTE pdrv,		/* Physical drive nmuber (0) */
     BYTE ctrl,		/* Control code */
     void* buff		/* Buffer to send/receive data block */
-)
-{
+) {
     if (gMountedBlockDevices[pdrv] == NULL) return RES_ERROR;
 
     DRESULT dr = RES_ERROR;
@@ -638,15 +570,13 @@ DRESULT disk_ioctl (
 
     uint32 value = 0;
 
-    switch (ctrl)
-    {
+    switch (ctrl) {
     case CTRL_SYNC:
         dr = RES_OK;
         break;
     case GET_SECTOR_COUNT:
         f = open_fs(gMountedBlockDevices[pdrv], 0);
-        if (f)
-        {
+        if (f) {
             ioctl_fs(f, IC_GetSectorCount, &value);
             *(DWORD*)buff = value;
             dr = RES_OK;
@@ -656,8 +586,7 @@ DRESULT disk_ioctl (
         break;
     case GET_BLOCK_SIZE:
         f = open_fs(gMountedBlockDevices[pdrv], 0);
-        if (f)
-        {
+        if (f) {
             ioctl_fs(f, IC_GetSectorSizeInBytes, &value);
             *(DWORD*)buff = value;
             dr = RES_OK;
diff --git a/kernel.soso/fatfs_ff.c b/kernel.soso/fatfs_ff.c
index 4a3070d6..ec19b3ae 100644
--- a/kernel.soso/fatfs_ff.c
+++ b/kernel.soso/fatfs_ff.c
@@ -563,8 +563,7 @@ static const BYTE DbcTbl[] = MKCVTBL(TBL_DC, FF_CODE_PAGE);
 /*-----------------------------------------------------------------------*/
 
 static
-WORD ld_word (const BYTE* ptr)	/*	 Load a 2-byte little-endian word */
-{
+WORD ld_word (const BYTE* ptr)	/*	 Load a 2-byte little-endian word */ {
 	WORD rv;
 
 	rv = ptr[1];
@@ -573,8 +572,7 @@ WORD ld_word (const BYTE* ptr)	/*	 Load a 2-byte little-endian word */
 }
 
 static
-DWORD ld_dword (const BYTE* ptr)	/* Load a 4-byte little-endian word */
-{
+DWORD ld_dword (const BYTE* ptr)	/* Load a 4-byte little-endian word */ {
 	DWORD rv;
 
 	rv = ptr[3];
@@ -586,8 +584,7 @@ DWORD ld_dword (const BYTE* ptr)	/* Load a 4-byte little-endian word */
 
 #if FF_FS_EXFAT
 static
-QWORD ld_qword (const BYTE* ptr)	/* Load an 8-byte little-endian word */
-{
+QWORD ld_qword (const BYTE* ptr)	/* Load an 8-byte little-endian word */ {
 	QWORD rv;
 
 	rv = ptr[7];
@@ -604,15 +601,13 @@ QWORD ld_qword (const BYTE* ptr)	/* Load an 8-byte little-endian word */
 
 #if !FF_FS_READONLY
 static
-void st_word (BYTE* ptr, WORD val)	/* Store a 2-byte word in little-endian */
-{
+void st_word (BYTE* ptr, WORD val)	/* Store a 2-byte word in little-endian */ {
 	*ptr++ = (BYTE)val; val >>= 8;
 	*ptr++ = (BYTE)val;
 }
 
 static
-void st_dword (BYTE* ptr, DWORD val)	/* Store a 4-byte word in little-endian */
-{
+void st_dword (BYTE* ptr, DWORD val)	/* Store a 4-byte word in little-endian */ {
 	*ptr++ = (BYTE)val; val >>= 8;
 	*ptr++ = (BYTE)val; val >>= 8;
 	*ptr++ = (BYTE)val; val >>= 8;
@@ -621,8 +616,7 @@ void st_dword (BYTE* ptr, DWORD val)	/* Store a 4-byte word in little-endian */
 
 #if FF_FS_EXFAT
 static
-void st_qword (BYTE* ptr, QWORD val)	/* Store an 8-byte word in little-endian */
-{
+void st_qword (BYTE* ptr, QWORD val)	/* Store an 8-byte word in little-endian */ {
 	*ptr++ = (BYTE)val; val >>= 8;
 	*ptr++ = (BYTE)val; val >>= 8;
 	*ptr++ = (BYTE)val; val >>= 8;
@@ -643,8 +637,7 @@ void st_qword (BYTE* ptr, QWORD val)	/* Store an 8-byte word in little-endian */
 
 /* Copy memory to memory */
 static
-void mem_cpy (void* dst, const void* src, UINT cnt)
-{
+void mem_cpy (void* dst, const void* src, UINT cnt) {
 	BYTE *d = (BYTE*)dst;
 	const BYTE *s = (const BYTE*)src;
 
@@ -658,8 +651,7 @@ void mem_cpy (void* dst, const void* src, UINT cnt)
 
 /* Fill memory block */
 static
-void mem_set (void* dst, int val, UINT cnt)
-{
+void mem_set (void* dst, int val, UINT cnt) {
 	BYTE *d = (BYTE*)dst;
 
 	do {
@@ -670,8 +662,7 @@ void mem_set (void* dst, int val, UINT cnt)
 
 /* Compare memory block */
 static
-int mem_cmp (const void* dst, const void* src, UINT cnt)	/* ZR:same, NZ:different */
-{
+int mem_cmp (const void* dst, const void* src, UINT cnt)	/* ZR:same, NZ:different */ {
 	const BYTE *d = (const BYTE *)dst, *s = (const BYTE *)src;
 	int r = 0;
 
@@ -685,8 +676,7 @@ int mem_cmp (const void* dst, const void* src, UINT cnt)	/* ZR:same, NZ:differen
 
 /* Check if chr is contained in the string */
 static
-int chk_chr (const char* str, int chr)	/* NZ:contained, ZR:not contained */
-{
+int chk_chr (const char* str, int chr)	/* NZ:contained, ZR:not contained */ {
 	while (*str && *str != chr) str++;
 	return *str;
 }
@@ -694,8 +684,7 @@ int chk_chr (const char* str, int chr)	/* NZ:contained, ZR:not contained */
 
 /* Test if the character is DBC 1st byte */
 static
-int dbc_1st (BYTE c)
-{
+int dbc_1st (BYTE c) {
 #if FF_CODE_PAGE == 0		/* Variable code page */
 	if (DbcTbl && c >= DbcTbl[0]) {
 		if (c <= DbcTbl[1]) return 1;					/* 1st byte range 1 */
@@ -715,8 +704,7 @@ int dbc_1st (BYTE c)
 
 /* Test if the character is DBC 2nd byte */
 static
-int dbc_2nd (BYTE c)
-{
+int dbc_2nd (BYTE c) {
 #if FF_CODE_PAGE == 0		/* Variable code page */
 	if (DbcTbl && c >= DbcTbl[4]) {
 		if (c <= DbcTbl[5]) return 1;					/* 2nd byte range 1 */
@@ -742,8 +730,7 @@ int dbc_2nd (BYTE c)
 static
 DWORD tchar2uni (		/* Returns character in UTF-16 encoding (>=0x10000 on double encoding unit, 0xFFFFFFFF on decode error) */
 	const TCHAR** str	/* Pointer to pointer to TCHAR string in configured encoding */
-)
-{
+) {
 	DWORD uc;
 	const TCHAR *p = *str;
 
@@ -813,8 +800,7 @@ BYTE put_utf (	/* Returns number of encoding units written (0:buffer overflow or
 	DWORD chr,	/* UTF-16 encoded character (Double encoding unit char if >=0x10000) */
 	TCHAR* buf,	/* Output buffer */
 	UINT szb	/* Size of the buffer */
-)
-{
+) {
 #if FF_LFN_UNICODE == 1	/* UTF-16 output */
 	WCHAR hs, wc;
 
@@ -888,8 +874,7 @@ BYTE put_utf (	/* Returns number of encoding units written (0:buffer overflow or
 static
 int lock_fs (		/* 1:Ok, 0:timeout */
 	FATFS* fs		/* Filesystem object */
-)
-{
+) {
 	return ff_req_grant(fs->sobj);
 }
 
@@ -898,8 +883,7 @@ static
 void unlock_fs (
 	FATFS* fs,		/* Filesystem object */
 	FRESULT res		/* Result code to be returned */
-)
-{
+) {
 	if (fs && res != FR_NOT_ENABLED && res != FR_INVALID_DRIVE && res != FR_TIMEOUT) {
 		ff_rel_grant(fs->sobj);
 	}
@@ -918,8 +902,7 @@ static
 FRESULT chk_lock (	/* Check if the file can be accessed */
 	DIR* dp,		/* Directory object pointing the file to be checked */
 	int acc			/* Desired access type (0:Read mode open, 1:Write mode open, 2:Delete or rename) */
-)
-{
+) {
 	UINT i, be;
 
 	/* Search open object table for the object */
@@ -943,8 +926,7 @@ FRESULT chk_lock (	/* Check if the file can be accessed */
 
 
 static
-int enq_lock (void)	/* Check if an entry is available for a new object */
-{
+int enq_lock (void)	/* Check if an entry is available for a new object */ {
 	UINT i;
 
 	for (i = 0; i < FF_FS_LOCK && Files[i].fs; i++) ;
@@ -956,8 +938,7 @@ static
 UINT inc_lock (	/* Increment object open counter and returns its index (0:Internal error) */
 	DIR* dp,	/* Directory object pointing the file to register or increment */
 	int acc		/* Desired access (0:Read, 1:Write, 2:Delete/Rename) */
-)
-{
+) {
 	UINT i;
 
 
@@ -987,8 +968,7 @@ UINT inc_lock (	/* Increment object open counter and returns its index (0:Intern
 static
 FRESULT dec_lock (	/* Decrement object open counter */
 	UINT i			/* Semaphore index (1..) */
-)
-{
+) {
 	WORD n;
 	FRESULT res;
 
@@ -1010,8 +990,7 @@ FRESULT dec_lock (	/* Decrement object open counter */
 static
 void clear_lock (	/* Clear lock entries of the volume */
 	FATFS *fs
-)
-{
+) {
 	UINT i;
 
 	for (i = 0; i < FF_FS_LOCK; i++) {
@@ -1030,8 +1009,7 @@ void clear_lock (	/* Clear lock entries of the volume */
 static
 FRESULT sync_window (	/* Returns FR_OK or FR_DISK_ERR */
 	FATFS* fs			/* Filesystem object */
-)
-{
+) {
 	FRESULT res = FR_OK;
 
 
@@ -1054,8 +1032,7 @@ static
 FRESULT move_window (	/* Returns FR_OK or FR_DISK_ERR */
 	FATFS* fs,			/* Filesystem object */
 	DWORD sector		/* Sector number to make appearance in the fs->win[] */
-)
-{
+) {
 	FRESULT res = FR_OK;
 
 
@@ -1085,8 +1062,7 @@ FRESULT move_window (	/* Returns FR_OK or FR_DISK_ERR */
 static
 FRESULT sync_fs (	/* Returns FR_OK or FR_DISK_ERR */
 	FATFS* fs		/* Filesystem object */
-)
-{
+) {
 	FRESULT res;
 
 
@@ -1124,8 +1100,7 @@ static
 DWORD clst2sect (	/* !=0:Sector number, 0:Failed (invalid cluster#) */
 	FATFS* fs,		/* Filesystem object */
 	DWORD clst		/* Cluster# to be converted */
-)
-{
+) {
 	clst -= 2;		/* Cluster number is origin from 2 */
 	if (clst >= fs->n_fatent - 2) return 0;		/* Is it invalid cluster number? */
 	return fs->database + fs->csize * clst;		/* Start sector number of the cluster */
@@ -1142,8 +1117,7 @@ static
 DWORD get_fat (		/* 0xFFFFFFFF:Disk error, 1:Internal error, 2..0x7FFFFFFF:Cluster status */
 	FFOBJID* obj,	/* Corresponding object */
 	DWORD clst		/* Cluster number to get the value */
-)
-{
+) {
 	UINT wc, bc;
 	DWORD val;
 	FATFS *fs = obj->fs;
@@ -1221,8 +1195,7 @@ FRESULT put_fat (	/* FR_OK(0):succeeded, !=0:error */
 	FATFS* fs,		/* Corresponding filesystem object */
 	DWORD clst,		/* FAT index number (cluster number) to be changed */
 	DWORD val		/* New value to be set to the entry */
-)
-{
+) {
 	UINT bc;
 	BYTE *p;
 	FRESULT res = FR_INT_ERR;
@@ -1287,8 +1260,7 @@ DWORD find_bitmap (	/* 0:Not found, 2..:Cluster block found, 0xFFFFFFFF:Disk err
 	FATFS* fs,	/* Filesystem object */
 	DWORD clst,	/* Cluster number to scan from */
 	DWORD ncl	/* Number of contiguous clusters to find (1..) */
-)
-{
+) {
 	BYTE bm, bv;
 	UINT i;
 	DWORD val, scl, ctr;
@@ -1329,8 +1301,7 @@ FRESULT change_bitmap (
 	DWORD clst,	/* Cluster number to change from */
 	DWORD ncl,	/* Number of clusters to be changed */
 	int bv		/* bit value to be set (0 or 1) */
-)
-{
+) {
 	BYTE bm;
 	UINT i;
 	DWORD sect;
@@ -1363,8 +1334,7 @@ FRESULT change_bitmap (
 static
 FRESULT fill_first_frag (
 	FFOBJID* obj	/* Pointer to the corresponding object */
-)
-{
+) {
 	FRESULT res;
 	DWORD cl, n;
 
@@ -1389,8 +1359,7 @@ FRESULT fill_last_frag (
 	FFOBJID* obj,	/* Pointer to the corresponding object */
 	DWORD lcl,		/* Last cluster of the fragment */
 	DWORD term		/* Value to set the last FAT entry */
-)
-{
+) {
 	FRESULT res;
 
 
@@ -1415,8 +1384,7 @@ FRESULT remove_chain (	/* FR_OK(0):succeeded, !=0:error */
 	FFOBJID* obj,		/* Corresponding object */
 	DWORD clst,			/* Cluster to remove a chain from */
 	DWORD pclst			/* Previous cluster of clst (0:entire chain) */
-)
-{
+) {
 	FRESULT res = FR_OK;
 	DWORD nxt;
 	FATFS *fs = obj->fs;
@@ -1509,8 +1477,7 @@ static
 DWORD create_chain (	/* 0:No free cluster, 1:Internal error, 0xFFFFFFFF:Disk error, >=2:New cluster# */
 	FFOBJID* obj,		/* Corresponding object */
 	DWORD clst			/* Cluster# to stretch, 0:Create a new chain */
-)
-{
+) {
 	DWORD cs, ncl, scl;
 	FRESULT res;
 	FATFS *fs = obj->fs;
@@ -1613,8 +1580,7 @@ static
 DWORD clmt_clust (	/* <2:Error, >=2:Cluster number */
 	FIL* fp,		/* Pointer to the file object */
 	FSIZE_t ofs		/* File offset to be converted to cluster# */
-)
-{
+) {
 	DWORD cl, ncl, *tbl;
 	FATFS *fs = fp->obj.fs;
 
@@ -1644,8 +1610,7 @@ static
 FRESULT dir_clear (	/* Returns FR_OK or FR_DISK_ERR */
 	FATFS *fs,		/* Filesystem object */
 	DWORD clst		/* Directory table to clear */
-)
-{
+) {
 	DWORD sect;
 	UINT n, szb;
 	BYTE *ibuf;
@@ -1684,8 +1649,7 @@ static
 FRESULT dir_sdi (	/* FR_OK(0):succeeded, !=0:error */
 	DIR* dp,		/* Pointer to directory object */
 	DWORD ofs		/* Offset of directory table */
-)
-{
+) {
 	DWORD csz, clst;
 	FATFS *fs = dp->obj.fs;
 
@@ -1733,8 +1697,7 @@ static
 FRESULT dir_next (	/* FR_OK(0):succeeded, FR_NO_FILE:End of table, FR_DENIED:Could not stretch */
 	DIR* dp,		/* Pointer to the directory object */
 	int stretch		/* 0: Do not stretch table, 1: Stretch table if needed */
-)
-{
+) {
 	DWORD ofs, clst;
 	FATFS *fs = dp->obj.fs;
 
@@ -1794,8 +1757,7 @@ static
 FRESULT dir_alloc (	/* FR_OK(0):succeeded, !=0:error */
 	DIR* dp,		/* Pointer to the directory object */
 	UINT nent		/* Number of contiguous entries to allocate */
-)
-{
+) {
 	FRESULT res;
 	UINT n;
 	FATFS *fs = dp->obj.fs;
@@ -1837,8 +1799,7 @@ static
 DWORD ld_clust (	/* Returns the top cluster value of the SFN entry */
 	FATFS* fs,		/* Pointer to the fs object */
 	const BYTE* dir	/* Pointer to the key entry */
-)
-{
+) {
 	DWORD cl;
 
 	cl = ld_word(dir + DIR_FstClusLO);
@@ -1856,8 +1817,7 @@ void st_clust (
 	FATFS* fs,	/* Pointer to the fs object */
 	BYTE* dir,	/* Pointer to the key entry */
 	DWORD cl	/* Value to be set */
-)
-{
+) {
 	st_word(dir + DIR_FstClusLO, (WORD)cl);
 	if (fs->fs_type == FS_FAT32) {
 		st_word(dir + DIR_FstClusHI, (WORD)(cl >> 16));
@@ -1875,8 +1835,7 @@ static
 int cmp_lfn (				/* 1:matched, 0:not matched */
 	const WCHAR* lfnbuf,	/* Pointer to the LFN working buffer to be compared */
 	BYTE* dir				/* Pointer to the directory entry containing the part of LFN */
-)
-{
+) {
 	UINT i, s;
 	WCHAR wc, uc;
 
@@ -1911,8 +1870,7 @@ static
 int pick_lfn (			/* 1:succeeded, 0:buffer overflow or invalid LFN entry */
 	WCHAR* lfnbuf,		/* Pointer to the LFN working buffer */
 	BYTE* dir			/* Pointer to the LFN entry */
-)
-{
+) {
 	UINT i, s;
 	WCHAR wc, uc;
 
@@ -1951,8 +1909,7 @@ void put_lfn (
 	BYTE* dir,			/* Pointer to the LFN entry to be created */
 	BYTE ord,			/* LFN order (1-20) */
 	BYTE sum			/* Checksum of the corresponding SFN */
-)
-{
+) {
 	UINT i, s;
 	WCHAR wc;
 
@@ -1989,8 +1946,7 @@ void gen_numname (
 	const BYTE* src,	/* Pointer to SFN */
 	const WCHAR* lfn,	/* Pointer to LFN */
 	UINT seq			/* Sequence number */
-)
-{
+) {
 	BYTE ns[8], c;
 	UINT i, j;
 	WCHAR wc;
@@ -2045,8 +2001,7 @@ void gen_numname (
 static
 BYTE sum_sfn (
 	const BYTE* dir		/* Pointer to the SFN entry */
-)
-{
+) {
 	BYTE sum = 0;
 	UINT n = 11;
 
@@ -2068,8 +2023,7 @@ BYTE sum_sfn (
 static
 WORD xdir_sum (			/* Get checksum of the directoly entry block */
 	const BYTE* dir		/* Directory entry block to be calculated */
-)
-{
+) {
 	UINT i, szblk;
 	WORD sum;
 
@@ -2090,8 +2044,7 @@ WORD xdir_sum (			/* Get checksum of the directoly entry block */
 static
 WORD xname_sum (		/* Get check sum (to be used as hash) of the name */
 	const WCHAR* name	/* File name to be calculated */
-)
-{
+) {
 	WCHAR chr;
 	WORD sum = 0;
 
@@ -2110,8 +2063,7 @@ static
 DWORD xsum32 (
 	BYTE  dat,	/* Byte to be calculated */
 	DWORD sum	/* Previous sum */
-)
-{
+) {
 	sum = ((sum & 1) ? 0x80000000 : 0) + (sum >> 1) + dat;
 	return sum;
 }
@@ -2127,8 +2079,7 @@ static
 void get_xfileinfo (
 	BYTE* dirb,			/* Pointer to the direcotry entry block 85+C0+C1s */
 	FILINFO* fno		/* Buffer to store the extracted file information */
-)
-{
+) {
 	WCHAR wc, hs;
 	UINT di, si, nc;
 
@@ -2168,8 +2119,7 @@ void get_xfileinfo (
 static
 FRESULT load_xdir (	/* FR_INT_ERR: invalid entry block */
 	DIR* dp			/* Reading direcotry object pointing top of the entry block to load */
-)
-{
+) {
 	FRESULT res;
 	UINT i, sz_ent;
 	BYTE* dirb = dp->obj.fs->dirbuf;	/* Pointer to the on-memory direcotry entry block 85+C0+C1s */
@@ -2221,8 +2171,7 @@ static
 void init_alloc_info (
 	FATFS* fs,		/* Filesystem object */
 	FFOBJID* obj	/* Object allocation information to be initialized */
-)
-{
+) {
 	obj->sclust = ld_dword(fs->dirbuf + XDIR_FstClus);		/* Start cluster */
 	obj->objsize = ld_qword(fs->dirbuf + XDIR_FileSize);	/* Size */
 	obj->stat = fs->dirbuf[XDIR_GenFlags] & 2;				/* Allocation status */
@@ -2239,8 +2188,7 @@ static
 FRESULT load_obj_xdir (	
 	DIR* dp,			/* Blank directory object to be used to access containing direcotry */
 	const FFOBJID* obj	/* Object with its containing directory information */
-)
-{
+) {
 	FRESULT res;
 
 	/* Open object containing directory */
@@ -2267,8 +2215,7 @@ FRESULT load_obj_xdir (
 static
 FRESULT store_xdir (
 	DIR* dp				/* Pointer to the direcotry object */
-)
-{
+) {
 	FRESULT res;
 	UINT nent;
 	BYTE* dirb = dp->obj.fs->dirbuf;	/* Pointer to the direcotry entry block 85+C0+C1s */
@@ -2301,8 +2248,7 @@ static
 void create_xdir (
 	BYTE* dirb,			/* Pointer to the direcotry entry block buffer */
 	const WCHAR* lfn	/* Pointer to the object name */
-)
-{
+) {
 	UINT i;
 	BYTE nc1, nlen;
 	WCHAR wc;
@@ -2348,8 +2294,7 @@ static
 FRESULT dir_read (
 	DIR* dp,		/* Pointer to the directory object */
 	int vol			/* Filtered by 0:file/directory or 1:volume label */
-)
-{
+) {
 	FRESULT res = FR_NO_FILE;
 	FATFS *fs = dp->obj.fs;
 	BYTE a, c;
@@ -2426,8 +2371,7 @@ FRESULT dir_read (
 static
 FRESULT dir_find (	/* FR_OK(0):succeeded, !=0:error */
 	DIR* dp			/* Pointer to the directory object with the file name */
-)
-{
+) {
 	FRESULT res;
 	FATFS *fs = dp->obj.fs;
 	BYTE c;
@@ -2508,8 +2452,7 @@ FRESULT dir_find (	/* FR_OK(0):succeeded, !=0:error */
 static
 FRESULT dir_register (	/* FR_OK:succeeded, FR_DENIED:no free entry or too many SFN collision, FR_DISK_ERR:disk error */
 	DIR* dp				/* Target directory with object name to be created */
-)
-{
+) {
 	FRESULT res;
 	FATFS *fs = dp->obj.fs;
 #if FF_USE_LFN		/* LFN configuration */
@@ -2615,8 +2558,7 @@ FRESULT dir_register (	/* FR_OK:succeeded, FR_DENIED:no free entry or too many S
 static
 FRESULT dir_remove (	/* FR_OK:Succeeded, FR_DISK_ERR:A disk error */
 	DIR* dp				/* Directory object pointing the entry to be removed */
-)
-{
+) {
 	FRESULT res;
 	FATFS *fs = dp->obj.fs;
 #if FF_USE_LFN		/* LFN configuration */
@@ -2663,8 +2605,7 @@ static
 void get_fileinfo (
 	DIR* dp,		/* Pointer to the directory object */
 	FILINFO* fno	/* Pointer to the file information to be filled */
-)
-{
+) {
 	UINT si, di;
 #if FF_USE_LFN
 	WCHAR wc, hs;
@@ -2767,8 +2708,7 @@ void get_fileinfo (
 static
 DWORD get_achar (		/* Get a character and advances ptr */
 	const TCHAR** ptr	/* Pointer to pointer to the ANSI/OEM or Unicode string */
-)
-{
+) {
 	DWORD chr;
 
 
@@ -2802,8 +2742,7 @@ int pattern_matching (	/* 0:not matched, 1:matched */
 	const TCHAR* nam,	/* String to be tested */
 	int skip,			/* Number of pre-skip chars (number of ?s) */
 	int inf				/* Infinite search (* specified) */
-)
-{
+) {
 	const TCHAR *pp, *np;
 	DWORD pc, nc;
 	int nm, nx;
@@ -2848,8 +2787,7 @@ static
 FRESULT create_name (	/* FR_OK: successful, FR_INVALID_NAME: could not create */
 	DIR* dp,			/* Pointer to the directory object */
 	const TCHAR** path	/* Pointer to pointer to the segment in the path string */
-)
-{
+) {
 #if FF_USE_LFN		/* LFN configuration */
 	BYTE b, cf;
 	WCHAR wc, *lfn;
@@ -3046,8 +2984,7 @@ static
 FRESULT follow_path (	/* FR_OK(0): successful, !=0: error code */
 	DIR* dp,			/* Directory object to return last directory and found object */
 	const TCHAR* path	/* Full-path string to find a file or directory */
-)
-{
+) {
 	FRESULT res;
 	BYTE ns;
 	FATFS *fs = dp->obj.fs;
@@ -3133,8 +3070,7 @@ FRESULT follow_path (	/* FR_OK(0): successful, !=0: error code */
 static
 int get_ldnumber (		/* Returns logical drive number (-1:invalid drive) */
 	const TCHAR** path	/* Pointer to pointer to the path name */
-)
-{
+) {
 	const TCHAR *tp, *tt;
 	UINT i;
 	int vol = -1;
@@ -3195,8 +3131,7 @@ static
 BYTE check_fs (	/* 0:FAT, 1:exFAT, 2:Valid BS but not FAT, 3:Not a BS, 4:Disk error */
 	FATFS* fs,	/* Filesystem object */
 	DWORD sect	/* Sector# (lba) to load and check if it is an FAT-VBR or not */
-)
-{
+) {
 	fs->wflag = 0; fs->winsect = 0xFFFFFFFF;		/* Invaidate window */
 	if (move_window(fs, sect) != FR_OK) return 4;	/* Load boot record */
 
@@ -3224,8 +3159,7 @@ FRESULT find_volume (	/* FR_OK(0): successful, !=0: any error occurred */
 	const TCHAR** path,	/* Pointer to pointer to the path name (drive number) */
 	FATFS** rfs,		/* Pointer to pointer to the found filesystem object */
 	BYTE mode			/* !=0: Check write protection for write access */
-)
-{
+) {
 	BYTE fmt, *pt;
 	int vol;
 	DSTATUS stat;
@@ -3402,13 +3336,11 @@ FRESULT find_volume (	/* FR_OK(0): successful, !=0: any error occurred */
 #if (FF_FS_NOFSINFO & 3) != 3
 		if (fmt == FS_FAT32				/* Allow to update FSInfo only if BPB_FSInfo32 == 1 */
 			&& ld_word(fs->win + BPB_FSInfo32) == 1
-			&& move_window(fs, bsect + 1) == FR_OK)
-		{
+			&& move_window(fs, bsect + 1) == FR_OK) {
 			fs->fsi_flag = 0;
 			if (ld_word(fs->win + BS_55AA) == 0xAA55	/* Load FSInfo data if available */
 				&& ld_dword(fs->win + FSI_LeadSig) == 0x41615252
-				&& ld_dword(fs->win + FSI_StrucSig) == 0x61417272)
-			{
+				&& ld_dword(fs->win + FSI_StrucSig) == 0x61417272) {
 #if (FF_FS_NOFSINFO & 1) == 0
 				fs->free_clst = ld_dword(fs->win + FSI_Free_Count);
 #endif
@@ -3449,8 +3381,7 @@ static
 FRESULT validate (	/* Returns FR_OK or FR_INVALID_OBJECT */
 	FFOBJID* obj,	/* Pointer to the FFOBJID, the 1st member in the FIL/DIR object, to check validity */
 	FATFS** rfs		/* Pointer to pointer to the owner filesystem object to return */
-)
-{
+) {
 	FRESULT res = FR_INVALID_OBJECT;
 
 
@@ -3494,8 +3425,7 @@ FRESULT f_mount (
 	FATFS* fs,			/* Pointer to the filesystem object (NULL:unmount)*/
 	const TCHAR* path,	/* Logical drive number to be mounted/unmounted */
 	BYTE opt			/* Mode option 0:Do not mount (delayed mount), 1:Mount immediately */
-)
-{
+) {
 	FATFS *cfs;
 	int vol;
 	FRESULT res;
@@ -3542,8 +3472,7 @@ FRESULT f_open (
 	FIL* fp,			/* Pointer to the blank file object */
 	const TCHAR* path,	/* Pointer to the file name */
 	BYTE mode			/* Access mode and file open mode flags */
-)
-{
+) {
 	FRESULT res;
 	DIR dj;
 	FATFS *fs;
@@ -3733,8 +3662,7 @@ FRESULT f_read (
 	void* buff,	/* Pointer to data buffer */
 	UINT btr,	/* Number of bytes to read */
 	UINT* br	/* Pointer to number of bytes read */
-)
-{
+) {
 	FRESULT res;
 	FATFS *fs;
 	DWORD clst, sect;
@@ -3833,8 +3761,7 @@ FRESULT f_write (
 	const void* buff,	/* Pointer to the data to be written */
 	UINT btw,			/* Number of bytes to write */
 	UINT* bw			/* Pointer to number of bytes written */
-)
-{
+) {
 	FRESULT res;
 	FATFS *fs;
 	DWORD clst, sect;
@@ -3951,8 +3878,7 @@ FRESULT f_write (
 
 FRESULT f_sync (
 	FIL* fp		/* Pointer to the file object */
-)
-{
+) {
 	FRESULT res;
 	FATFS *fs;
 	DWORD tm;
@@ -4032,8 +3958,7 @@ FRESULT f_sync (
 
 FRESULT f_close (
 	FIL* fp		/* Pointer to the file object to be closed */
-)
-{
+) {
 	FRESULT res;
 	FATFS *fs;
 
@@ -4069,8 +3994,7 @@ FRESULT f_close (
 #if FF_VOLUMES >= 2
 FRESULT f_chdrive (
 	const TCHAR* path		/* Drive number */
-)
-{
+) {
 	int vol;
 
 
@@ -4087,8 +4011,7 @@ FRESULT f_chdrive (
 
 FRESULT f_chdir (
 	const TCHAR* path	/* Pointer to the directory path */
-)
-{
+) {
 	FRESULT res;
 	DIR dj;
 	FATFS *fs;
@@ -4140,8 +4063,7 @@ FRESULT f_chdir (
 FRESULT f_getcwd (
 	TCHAR* buff,	/* Pointer to the directory path */
 	UINT len		/* Size of path */
-)
-{
+) {
 	FRESULT res;
 	DIR dj;
 	FATFS *fs;
@@ -4220,8 +4142,7 @@ FRESULT f_getcwd (
 FRESULT f_lseek (
 	FIL* fp,		/* Pointer to the file object */
 	FSIZE_t ofs		/* File pointer from top of file */
-)
-{
+) {
 	FRESULT res;
 	FATFS *fs;
 	DWORD clst, bcs, nsect;
@@ -4291,8 +4212,7 @@ FRESULT f_lseek (
 	} else
 #endif
 
-	/* Normal Seek */
-	{
+	/* Normal Seek */ {
 #if FF_FS_EXFAT
 		if (fs->fs_type != FS_EXFAT && ofs >= 0x100000000) ofs = 0xFFFFFFFF;	/* Clip at 4 GiB - 1 if at FATxx */
 #endif
@@ -4381,8 +4301,7 @@ FRESULT f_lseek (
 FRESULT f_opendir (
 	DIR* dp,			/* Pointer to directory object to create */
 	const TCHAR* path	/* Pointer to the directory path */
-)
-{
+) {
 	FRESULT res;
 	FATFS *fs;
 	DEF_NAMBUF
@@ -4446,8 +4365,7 @@ FRESULT f_opendir (
 
 FRESULT f_closedir (
 	DIR *dp		/* Pointer to the directory object to be closed */
-)
-{
+) {
 	FRESULT res;
 	FATFS *fs;
 
@@ -4477,8 +4395,7 @@ FRESULT f_closedir (
 FRESULT f_readdir (
 	DIR* dp,			/* Pointer to the open directory object */
 	FILINFO* fno		/* Pointer to file information to return */
-)
-{
+) {
 	FRESULT res;
 	FATFS *fs;
 	DEF_NAMBUF
@@ -4513,8 +4430,7 @@ FRESULT f_readdir (
 FRESULT f_findnext (
 	DIR* dp,		/* Pointer to the open directory object */
 	FILINFO* fno	/* Pointer to the file information structure */
-)
-{
+) {
 	FRESULT res;
 
 
@@ -4540,8 +4456,7 @@ FRESULT f_findfirst (
 	FILINFO* fno,			/* Pointer to the file information structure */
 	const TCHAR* path,		/* Pointer to the directory to open */
 	const TCHAR* pattern	/* Pointer to the matching pattern */
-)
-{
+) {
 	FRESULT res;
 
 
@@ -4565,8 +4480,7 @@ FRESULT f_findfirst (
 FRESULT f_stat (
 	const TCHAR* path,	/* Pointer to the file path */
 	FILINFO* fno		/* Pointer to file information to return */
-)
-{
+) {
 	FRESULT res;
 	DIR dj;
 	DEF_NAMBUF
@@ -4601,8 +4515,7 @@ FRESULT f_getfree (
 	const TCHAR* path,	/* Logical drive number */
 	DWORD* nclst,		/* Pointer to a variable to return number of free clusters */
 	FATFS** fatfs		/* Pointer to return pointer to corresponding filesystem object */
-)
-{
+) {
 	FRESULT res;
 	FATFS *fs;
 	DWORD nfree, clst, sect, stat;
@@ -4688,8 +4601,7 @@ FRESULT f_getfree (
 
 FRESULT f_truncate (
 	FIL* fp		/* Pointer to the file object */
-)
-{
+) {
 	FRESULT res;
 	FATFS *fs;
 	DWORD ncl;
@@ -4738,8 +4650,7 @@ FRESULT f_truncate (
 
 FRESULT f_unlink (
 	const TCHAR* path		/* Pointer to the file or directory path */
-)
-{
+) {
 	FRESULT res;
 	DIR dj, sdj;
 	DWORD dclst = 0;
@@ -4832,8 +4743,7 @@ FRESULT f_unlink (
 
 FRESULT f_mkdir (
 	const TCHAR* path		/* Pointer to the directory path */
-)
-{
+) {
 	FRESULT res;
 	DIR dj;
 	FATFS *fs;
@@ -4921,8 +4831,7 @@ FRESULT f_mkdir (
 FRESULT f_rename (
 	const TCHAR* path_old,	/* Pointer to the object name to be renamed */
 	const TCHAR* path_new	/* Pointer to the new name */
-)
-{
+) {
 	FRESULT res;
 	DIR djo, djn;
 	FATFS *fs;
@@ -5032,8 +4941,7 @@ FRESULT f_chmod (
 	const TCHAR* path,	/* Pointer to the file path */
 	BYTE attr,			/* Attribute bits */
 	BYTE mask			/* Attribute mask to change */
-)
-{
+) {
 	FRESULT res;
 	DIR dj;
 	FATFS *fs;
@@ -5078,8 +4986,7 @@ FRESULT f_chmod (
 FRESULT f_utime (
 	const TCHAR* path,	/* Pointer to the file/directory name */
 	const FILINFO* fno	/* Pointer to the timestamp to be set */
-)
-{
+) {
 	FRESULT res;
 	DIR dj;
 	FATFS *fs;
@@ -5126,8 +5033,7 @@ FRESULT f_getlabel (
 	const TCHAR* path,	/* Logical drive number */
 	TCHAR* label,		/* Buffer to store the volume label */
 	DWORD* vsn			/* Variable to store the volume serial number */
-)
-{
+) {
 	FRESULT res;
 	DIR dj;
 	FATFS *fs;
@@ -5219,8 +5125,7 @@ FRESULT f_getlabel (
 
 FRESULT f_setlabel (
 	const TCHAR* label	/* Volume label to set with heading logical drive number */
-)
-{
+) {
 	FRESULT res;
 	DIR dj;
 	FATFS *fs;
@@ -5341,8 +5246,7 @@ FRESULT f_expand (
 	FIL* fp,		/* Pointer to the file object */
 	FSIZE_t fsz,	/* File size to be expanded to */
 	BYTE opt		/* Operation mode 0:Find and prepare or 1:Find and allocate */
-)
-{
+) {
 	FRESULT res;
 	FATFS *fs;
 	DWORD n, clst, stcl, scl, ncl, tcl, lclst;
@@ -5432,8 +5336,7 @@ FRESULT f_forward (
 	UINT (*func)(const BYTE*,UINT),	/* Pointer to the streaming function */
 	UINT btf,						/* Number of bytes to forward */
 	UINT* bf						/* Pointer to number of bytes forwarded */
-)
-{
+) {
 	FRESULT res;
 	FATFS *fs;
 	DWORD clst, sect;
@@ -5504,8 +5407,7 @@ FRESULT f_mkfs (
 	DWORD au,			/* Size of allocation unit (cluster) [byte] */
 	void* work,			/* Pointer to working buffer (null: use heap memory) */
 	UINT len			/* Size of working buffer [byte] */
-)
-{
+) {
 	const UINT n_fats = 1;		/* Number of FATs for FAT/FAT32 volume (1 or 2) */
 	const UINT n_rootdir = 512;	/* Number of root directory entries for FAT volume */
 	static const WORD cst[] = {1, 4, 16, 64, 256, 512, 0};	/* Cluster size boundary for FAT volume (4Ks unit) */
@@ -5967,8 +5869,7 @@ FRESULT f_fdisk (
 	BYTE pdrv,			/* Physical drive number */
 	const DWORD* szt,	/* Pointer to the size table for each partitions */
 	void* work			/* Pointer to the working buffer (null: use heap memory) */
-)
-{
+) {
 	UINT i, n, sz_cyl, tot_cyl, b_cyl, e_cyl, p_cyl;
 	BYTE s_hd, e_hd, *p, *buf; = (BYTE*)work;
 	DSTATUS stat;
@@ -6050,8 +5951,7 @@ TCHAR* f_gets (
 	TCHAR* buff,	/* Pointer to the string buffer to read */
 	int len,		/* Size of string buffer (items) */
 	FIL* fp			/* Pointer to the file object */
-)
-{
+) {
 	int nc = 0;
 	TCHAR *p = buff;
 	BYTE s[2];
@@ -6208,8 +6108,7 @@ static
 void putc_bfd (		/* Buffered write with code conversion */
 	putbuff* pb,
 	TCHAR c
-)
-{
+) {
 	UINT n;
 	int i, nc;
 #if FF_USE_LFN && (FF_LFN_UNICODE == 1 || (FF_LFN_UNICODE == 2 && (FF_STRF_ENCODE != 3)))
@@ -6348,8 +6247,7 @@ void putc_bfd (		/* Buffered write with code conversion */
 static
 int putc_flush (		/* Flush left characters in the buffer */
 	putbuff* pb
-)
-{
+) {
 	UINT nw;
 
 	if (   pb->idx >= 0	/* Flush buffered characters to the file */
@@ -6363,8 +6261,7 @@ static
 void putc_init (		/* Initialize write buffer */
 	putbuff* pb,
 	FIL* fp
-)
-{
+) {
 	mem_set(pb, 0, sizeof (putbuff));
 	pb->fp = fp;
 }
@@ -6374,8 +6271,7 @@ void putc_init (		/* Initialize write buffer */
 int f_putc (
 	TCHAR c,	/* A character to be output */
 	FIL* fp		/* Pointer to the file object */
-)
-{
+) {
 	putbuff pb;
 
 
@@ -6394,8 +6290,7 @@ int f_putc (
 int f_puts (
 	const TCHAR* str,	/* Pointer to the string to be output */
 	FIL* fp				/* Pointer to the file object */
-)
-{
+) {
 	putbuff pb;
 
 
@@ -6415,8 +6310,7 @@ int f_printf (
 	FIL* fp,			/* Pointer to the file object */
 	const TCHAR* fmt,	/* Pointer to the format string */
 	...					/* Optional arguments... */
-)
-{
+) {
 	va_list arp;
 	putbuff pb;
 	BYTE f, r;
@@ -6531,8 +6425,7 @@ int f_printf (
 
 FRESULT f_setcp (
 	WORD cp		/* Value to be set as active code page */
-)
-{
+) {
 	static const WORD       validcp[] = {  437,   720,   737,   771,   775,   850,   852,   857,   860,   861,   862,   863,   864,   865,   866,   869,   932,   936,   949,   950, 0};
 	static const BYTE *const tables[] = {Ct437, Ct720, Ct737, Ct771, Ct775, Ct850, Ct852, Ct857, Ct860, Ct861, Ct862, Ct863, Ct864, Ct865, Ct866, Ct869, Dc932, Dc936, Dc949, Dc950, 0};
 	UINT i;
diff --git a/kernel.soso/fatfs_ffunicode.c b/kernel.soso/fatfs_ffunicode.c
index 4d932e90..73d0237a 100644
--- a/kernel.soso/fatfs_ffunicode.c
+++ b/kernel.soso/fatfs_ffunicode.c
@@ -15251,8 +15251,7 @@ const WCHAR uc869[] = {	/*  CP869(Greek 2) to Unicode conversion table */
 WCHAR ff_uni2oem (	/* Returns OEM code character, zero on error */
 	DWORD	uni,	/* UTF-16 encoded character to be converted */
 	WORD	cp		/* Code page for the conversion */
-)
-{
+) {
 	WCHAR c = 0;
 	const WCHAR *p = CVTBL(uc, FF_CODE_PAGE);
 
@@ -15273,8 +15272,7 @@ WCHAR ff_uni2oem (	/* Returns OEM code character, zero on error */
 WCHAR ff_oem2uni (	/* Returns Unicode character, zero on error */
 	WCHAR	oem,	/* OEM code to be converted */
 	WORD	cp		/* Code page for the conversion */
-)
-{
+) {
 	WCHAR c = 0;
 	const WCHAR *p = CVTBL(uc, FF_CODE_PAGE);
 
@@ -15304,8 +15302,7 @@ WCHAR ff_oem2uni (	/* Returns Unicode character, zero on error */
 WCHAR ff_uni2oem (	/* Returns OEM code character, zero on error */
 	DWORD	uni,	/* UTF-16 encoded character to be converted */
 	WORD	cp		/* Code page for the conversion */
-)
-{
+) {
 	const WCHAR *p;
 	WCHAR c = 0, uc;
 	UINT i, n, li, hi;
@@ -15342,8 +15339,7 @@ WCHAR ff_uni2oem (	/* Returns OEM code character, zero on error */
 WCHAR ff_oem2uni (	/* Returns Unicode character, zero on error */
 	WCHAR	oem,	/* OEM code to be converted */
 	WORD	cp		/* Code page for the conversion */
-)
-{
+) {
 	const WCHAR *p;
 	WCHAR c = 0;
 	UINT i, n, li, hi;
@@ -15389,8 +15385,7 @@ static const WCHAR *const cp_table[] = {uc437, uc720, uc737, uc771, uc775, uc850
 WCHAR ff_uni2oem (	/* Returns OEM code character, zero on error */
 	DWORD	uni,	/* UTF-16 encoded character to be converted */
 	WORD	cp		/* Code page for the conversion */
-)
-{
+) {
 	const WCHAR *p;
 	WCHAR c = 0, uc;
 	UINT i, n, li, hi;
@@ -15441,8 +15436,7 @@ WCHAR ff_uni2oem (	/* Returns OEM code character, zero on error */
 WCHAR ff_oem2uni (	/* Returns Unicode character, zero on error */
 	WCHAR	oem,	/* OEM code to be converted (DBC if >=0x100) */
 	WORD	cp		/* Code page for the conversion */
-)
-{
+) {
 	const WCHAR *p;
 	WCHAR c = 0;
 	UINT i, n, li, hi;
@@ -15494,8 +15488,7 @@ WCHAR ff_oem2uni (	/* Returns Unicode character, zero on error */
 
 DWORD ff_wtoupper (	/* Returns up-converted code point */
 	DWORD uni		/* Unicode code point to be up-converted */
-)
-{
+) {
 	/* Compressed upper conversion table */
 	static const WORD cvt1[] = {	/* U+0000 - U+0FFF */
 		/* Basic Latin */
diff --git a/kernel.soso/fifobuffer.c b/kernel.soso/fifobuffer.c
index 53fd6f38..58fd145d 100644
--- a/kernel.soso/fifobuffer.c
+++ b/kernel.soso/fifobuffer.c
@@ -1,8 +1,7 @@
 #include "fifobuffer.h"
 #include "alloc.h"
 
-FifoBuffer* FifoBuffer_create(uint32 capacity)
-{
+FifoBuffer* FifoBuffer_create(uint32 capacity) {
     FifoBuffer* fifo = (FifoBuffer*)kmalloc(sizeof(FifoBuffer));
     memset((uint8*)fifo, 0, sizeof(FifoBuffer));
     fifo->data = (uint8*)kmalloc(capacity);
@@ -12,61 +11,50 @@ FifoBuffer* FifoBuffer_create(uint32 capacity)
     return fifo;
 }
 
-void FifoBuffer_destroy(FifoBuffer* fifoBuffer)
-{
+void FifoBuffer_destroy(FifoBuffer* fifoBuffer) {
     kfree(fifoBuffer->data);
     kfree(fifoBuffer);
 }
 
-void FifoBuffer_clear(FifoBuffer* fifoBuffer)
-{
+void FifoBuffer_clear(FifoBuffer* fifoBuffer) {
     fifoBuffer->usedBytes = 0;
     fifoBuffer->readIndex = 0;
     fifoBuffer->writeIndex = 0;
 }
 
-BOOL FifoBuffer_isEmpty(FifoBuffer* fifoBuffer)
-{
-    if (0 == fifoBuffer->usedBytes)
-    {
+BOOL FifoBuffer_isEmpty(FifoBuffer* fifoBuffer) {
+    if (0 == fifoBuffer->usedBytes) {
         return TRUE;
     }
 
     return FALSE;
 }
 
-uint32 FifoBuffer_getSize(FifoBuffer* fifoBuffer)
-{
+uint32 FifoBuffer_getSize(FifoBuffer* fifoBuffer) {
     return fifoBuffer->usedBytes;
 }
 
-uint32 FifoBuffer_getCapacity(FifoBuffer* fifoBuffer)
-{
+uint32 FifoBuffer_getCapacity(FifoBuffer* fifoBuffer) {
     return fifoBuffer->capacity;
 }
 
-uint32 FifoBuffer_getFree(FifoBuffer* fifoBuffer)
-{
+uint32 FifoBuffer_getFree(FifoBuffer* fifoBuffer) {
     return fifoBuffer->capacity - fifoBuffer->usedBytes;
 }
 
-int32 FifoBuffer_enqueue(FifoBuffer* fifoBuffer, uint8* data, uint32 size)
-{
-    if (size == 0)
-    {
+int32 FifoBuffer_enqueue(FifoBuffer* fifoBuffer, uint8* data, uint32 size) {
+    if (size == 0) {
         return -1;
     }
 
     uint32 bytesAvailable = fifoBuffer->capacity - fifoBuffer->usedBytes;
 
-    if (size > bytesAvailable)
-    {
+    if (size > bytesAvailable) {
         return -1;
     }
 
     uint32 i = 0;
-    while (fifoBuffer->usedBytes < fifoBuffer->capacity && i < size)
-    {
+    while (fifoBuffer->usedBytes < fifoBuffer->capacity && i < size) {
         fifoBuffer->data[fifoBuffer->writeIndex] = data[i++];
         fifoBuffer->usedBytes++;
         fifoBuffer->writeIndex++;
@@ -76,22 +64,18 @@ int32 FifoBuffer_enqueue(FifoBuffer* fifoBuffer, uint8* data, uint32 size)
     return size;
 }
 
-int32 FifoBuffer_dequeue(FifoBuffer* fifoBuffer, uint8* data, uint32 size)
-{
-    if (size == 0)
-    {
+int32 FifoBuffer_dequeue(FifoBuffer* fifoBuffer, uint8* data, uint32 size) {
+    if (size == 0) {
         return -1;
     }
 
-    if (0 == fifoBuffer->usedBytes)
-    {
+    if (0 == fifoBuffer->usedBytes) {
         //Buffer is empty
         return 0;
     }
 
     uint32 i = 0;
-    while (fifoBuffer->usedBytes > 0 && i < size)
-    {
+    while (fifoBuffer->usedBytes > 0 && i < size) {
         data[i++] = fifoBuffer->data[fifoBuffer->readIndex];
         fifoBuffer->usedBytes--;
         fifoBuffer->readIndex++;
diff --git a/kernel.soso/fifobuffer.h b/kernel.soso/fifobuffer.h
index 86511bca..596cd336 100644
--- a/kernel.soso/fifobuffer.h
+++ b/kernel.soso/fifobuffer.h
@@ -3,8 +3,7 @@
 
 #include "common.h"
 
-typedef struct FifoBuffer
-{
+typedef struct FifoBuffer {
     uint8* data;
     uint32 writeIndex;
     uint32 readIndex;
diff --git a/kernel.soso/framebuffer.c b/kernel.soso/framebuffer.c
index 04783705..e57dd67d 100644
--- a/kernel.soso/framebuffer.c
+++ b/kernel.soso/framebuffer.c
@@ -16,8 +16,7 @@ static BOOL fb_munmap(File* file, void* address, uint32 size);
 static uint8* gFrameBufferPhysical = 0;
 static uint8* gFrameBufferVirtual = 0;
 
-void initializeFrameBuffer(uint8* p_address, uint8* v_address)
-{
+void initializeFrameBuffer(uint8* p_address, uint8* v_address) {
     gFrameBufferPhysical = p_address;
     gFrameBufferVirtual = v_address;
 
@@ -35,25 +34,20 @@ void initializeFrameBuffer(uint8* p_address, uint8* v_address)
     registerDevice(&device);
 }
 
-static BOOL fb_open(File *file, uint32 flags)
-{
+static BOOL fb_open(File *file, uint32 flags) {
     return TRUE;
 }
 
-static int32 fb_read(File *file, uint32 size, uint8 *buffer)
-{
-    if (size == 0)
-    {
+static int32 fb_read(File *file, uint32 size, uint8 *buffer) {
+    if (size == 0) {
         return 0;
     }
 
     return -1;
 }
 
-static int32 fb_write(File *file, uint32 size, uint8 *buffer)
-{
-    if (size == 0)
-    {
+static int32 fb_write(File *file, uint32 size, uint8 *buffer) {
+    if (size == 0) {
         return 0;
     }
 
@@ -63,8 +57,7 @@ static int32 fb_write(File *file, uint32 size, uint8 *buffer)
 
     int32 availableSize = length - file->offset;
 
-    if (availableSize <= 0)
-    {
+    if (availableSize <= 0) {
         return -1;
     }
 
@@ -77,12 +70,10 @@ static int32 fb_write(File *file, uint32 size, uint8 *buffer)
     return targetSize;
 }
 
-static int32 fb_ioctl(File *node, int32 request, void * argp)
-{
+static int32 fb_ioctl(File *node, int32 request, void * argp) {
     int32 result = -1;
 
-    switch (request)
-    {
+    switch (request) {
     case FB_GET_WIDTH:
         result = Gfx_GetWidth();
         break;
@@ -97,12 +88,10 @@ static int32 fb_ioctl(File *node, int32 request, void * argp)
     return result;
 }
 
-static void* fb_mmap(File* file, uint32 size, uint32 offset, uint32 flags)
-{
+static void* fb_mmap(File* file, uint32 size, uint32 offset, uint32 flags) {
     return mapMemory(file->thread->owner, size, (uint32)(gFrameBufferPhysical + offset), NULL);
 }
 
-static BOOL fb_munmap(File* file, void* address, uint32 size)
-{
+static BOOL fb_munmap(File* file, void* address, uint32 size) {
     return unmapMemory(file->thread->owner, size, (uint32)address);
 }
diff --git a/kernel.soso/framebuffer.h b/kernel.soso/framebuffer.h
index 78575ebb..0606712a 100644
--- a/kernel.soso/framebuffer.h
+++ b/kernel.soso/framebuffer.h
@@ -3,8 +3,7 @@
 
 #include "common.h"
 
-enum EnFrameBuferIoctl
-{
+enum EnFrameBuferIoctl {
     FB_GET_WIDTH,
     FB_GET_HEIGHT,
     FB_GET_BITSPERPIXEL
diff --git a/kernel.soso/fs.c b/kernel.soso/fs.c
index b681ba3a..0d072c33 100644
--- a/kernel.soso/fs.c
+++ b/kernel.soso/fs.c
@@ -10,8 +10,7 @@ FileSystemNode *gFileSystemRoot = NULL; // The root of the filesystem.
 static FileSystem gRegisteredFileSystems[FILESYSTEM_CAPACITY];
 static int gNextFileSystemIndex = 0;
 
-void initializeVFS()
-{
+void initializeVFS() {
     memset((uint8*)gRegisteredFileSystems, 0, sizeof(gRegisteredFileSystems));
 
     gFileSystemRoot = initializeRootFS();
@@ -20,19 +19,15 @@ void initializeVFS()
     mkdir_fs(gFileSystemRoot, "initrd", 0);
 }
 
-FileSystemNode* getFileSystemRootNode()
-{
+FileSystemNode* getFileSystemRootNode() {
     return gFileSystemRoot;
 }
 
-void copyFileDescriptors(Process* fromProcess, Process* toProcess)
-{
-    for (int i = 0; i < MAX_OPENED_FILES; ++i)
-    {
+void copyFileDescriptors(Process* fromProcess, Process* toProcess) {
+    for (int i = 0; i < MAX_OPENED_FILES; ++i) {
         File* original = fromProcess->fd[i];
 
-        if (original)
-        {
+        if (original) {
             File* file = kmalloc(sizeof(File));
             memcpy((uint8*)file, (uint8*)original, sizeof(File));
             file->process = toProcess;
@@ -44,19 +39,15 @@ void copyFileDescriptors(Process* fromProcess, Process* toProcess)
     }
 }
 
-int getFileSystemNodePath(FileSystemNode *node, char* buffer, uint32 bufferSize)
-{
-    if (node == gFileSystemRoot)
-    {
-        if (bufferSize > 1)
-        {
+int getFileSystemNodePath(FileSystemNode *node, char* buffer, uint32 bufferSize) {
+    if (node == gFileSystemRoot) {
+        if (bufferSize > 1) {
             buffer[0] = '/';
             buffer[1] = '\0';
 
             return 1;
         }
-        else
-        {
+        else {
             return -1;
         }
     }
@@ -66,18 +57,15 @@ int getFileSystemNodePath(FileSystemNode *node, char* buffer, uint32 bufferSize)
     FileSystemNode *n = node;
     int charIndex = 127;
     targetPath[charIndex] = '\0';
-    while (NULL != n)
-    {
+    while (NULL != n) {
         int length = strlen(n->name);
         charIndex -= length;
 
-        if (charIndex < 2)
-        {
+        if (charIndex < 2) {
             return -1;
         }
 
-        if (NULL != n->parent)
-        {
+        if (NULL != n->parent) {
             strcpyNonNull(targetPath + charIndex, n->name);
             charIndex -= 1;
             targetPath[charIndex] = '/';
@@ -90,8 +78,7 @@ int getFileSystemNodePath(FileSystemNode *node, char* buffer, uint32 bufferSize)
 
     //printkf("getFileSystemNodePath: len:[%s] %d\n", targetPath + charIndex, len);
 
-    if (bufferSize < len)
-    {
+    if (bufferSize < len) {
         return -1;
     }
 
@@ -100,17 +87,14 @@ int getFileSystemNodePath(FileSystemNode *node, char* buffer, uint32 bufferSize)
     return len;
 }
 
-BOOL resolvePath(const char* path, char* buffer, int bufferSize)
-{
+BOOL resolvePath(const char* path, char* buffer, int bufferSize) {
     int lengthPath = strlen(path);
 
-    if (path[0] != '/')
-    {
+    if (path[0] != '/') {
         return FALSE;
     }
 
-    if (bufferSize < 2)
-    {
+    if (bufferSize < 2) {
         return FALSE;
     }
 
@@ -119,8 +103,7 @@ BOOL resolvePath(const char* path, char* buffer, int bufferSize)
     int index = 0;
     int indexBuffer = 1;
 
-    while (index < lengthPath - 1)
-    {
+    while (index < lengthPath - 1) {
         while (path[++index] == '/');//eliminate successive
 
         const char* current = path + index;
@@ -128,29 +111,23 @@ BOOL resolvePath(const char* path, char* buffer, int bufferSize)
 
         int lengthToken = 0;
 
-        if (nextIndex >= 0)
-        {
+        if (nextIndex >= 0) {
             const char* next = path + index + nextIndex;
 
             lengthToken = next - (path + index);
         }
-        else
-        {
+        else {
             lengthToken = strlen(current);
         }
 
-        if (lengthToken > 0)
-        {
+        if (lengthToken > 0) {
             index += lengthToken;
-            if (strncmp(current, "..", 2) == 0)
-            {
+            if (strncmp(current, "..", 2) == 0) {
                 --indexBuffer;
-                while (indexBuffer > 0)
-                {
+                while (indexBuffer > 0) {
                     --indexBuffer;
 
-                    if (buffer[indexBuffer] == '/')
-                    {
+                    if (buffer[indexBuffer] == '/') {
                         break;
                     }
 
@@ -160,31 +137,26 @@ BOOL resolvePath(const char* path, char* buffer, int bufferSize)
                 ++indexBuffer;
                 continue;
             }
-            else if (strncmp(current, ".", 1) == 0)
-            {
+            else if (strncmp(current, ".", 1) == 0) {
                 continue;
             }
 
-            if (indexBuffer + lengthToken + 2 > bufferSize)
-            {
+            if (indexBuffer + lengthToken + 2 > bufferSize) {
                 return FALSE;
             }
 
             strncpy(buffer + indexBuffer, current, lengthToken);
             indexBuffer += lengthToken;
 
-            if (current[lengthToken] == '/')
-            {
+            if (current[lengthToken] == '/') {
                 buffer[indexBuffer++] = '/';
             }
             buffer[indexBuffer] = '\0';
         }
     }
 
-    if (indexBuffer > 2)
-    {
-        if (buffer[indexBuffer - 1] == '/')
-        {
+    if (indexBuffer > 2) {
+        if (buffer[indexBuffer - 1] == '/') {
             buffer[indexBuffer - 1] = '\0';
         }
     }
@@ -192,42 +164,34 @@ BOOL resolvePath(const char* path, char* buffer, int bufferSize)
     return TRUE;
 }
 
-uint32 read_fs(File *file, uint32 size, uint8 *buffer)
-{
-    if (file->node->read != 0)
-    {
+uint32 read_fs(File *file, uint32 size, uint8 *buffer) {
+    if (file->node->read != 0) {
         return file->node->read(file, size, buffer);
     }
 
     return -1;
 }
 
-uint32 write_fs(File *file, uint32 size, uint8 *buffer)
-{
-    if (file->node->write != 0)
-    {
+uint32 write_fs(File *file, uint32 size, uint8 *buffer) {
+    if (file->node->write != 0) {
         return file->node->write(file, size, buffer);
     }
 
     return -1;
 }
 
-File *open_fs(FileSystemNode *node, uint32 flags)
-{
+File *open_fs(FileSystemNode *node, uint32 flags) {
     return open_fs_forProcess(getCurrentThread(), node, flags);
 }
 
-File *open_fs_forProcess(Thread* thread, FileSystemNode *node, uint32 flags)
-{
+File *open_fs_forProcess(Thread* thread, FileSystemNode *node, uint32 flags) {
     Process* process = thread->owner;
 
-    if ( (node->nodeType & FT_MountPoint) == FT_MountPoint && node->mountPoint != NULL )
-    {
+    if ( (node->nodeType & FT_MountPoint) == FT_MountPoint && node->mountPoint != NULL ) {
         node = node->mountPoint;
     }
 
-    if (node->open != NULL)
-    {
+    if (node->open != NULL) {
         File* file = kmalloc(sizeof(File));
         memset((uint8*)file, 0, sizeof(File));
         file->node = node;
@@ -236,13 +200,11 @@ File *open_fs_forProcess(Thread* thread, FileSystemNode *node, uint32 flags)
 
         BOOL success = node->open(file, flags);
 
-        if (success)
-        {
+        if (success) {
             //printkf("Opened:%s\n", file->node->name);
             int32 fd = addFileToProcess(file->process, file);
 
-            if (fd < 0)
-            {
+            if (fd < 0) {
                 //TODO: sett errno max files opened already
                 printkf("Maxfiles opened already!!\n");
 
@@ -250,8 +212,7 @@ File *open_fs_forProcess(Thread* thread, FileSystemNode *node, uint32 flags)
                 file = NULL;
             }
         }
-        else
-        {
+        else {
             kfree(file);
         }
 
@@ -261,10 +222,8 @@ File *open_fs_forProcess(Thread* thread, FileSystemNode *node, uint32 flags)
     return NULL;
 }
 
-void close_fs(File *file)
-{
-    if (file->node->close != NULL)
-    {
+void close_fs(File *file) {
+    if (file->node->close != NULL) {
         file->node->close(file);
     }
 
@@ -273,38 +232,31 @@ void close_fs(File *file)
     kfree(file);
 }
 
-int32 ioctl_fs(File *file, int32 request, void * argp)
-{
-    if (file->node->ioctl != NULL)
-    {
+int32 ioctl_fs(File *file, int32 request, void * argp) {
+    if (file->node->ioctl != NULL) {
         return file->node->ioctl(file, request, argp);
     }
 
     return 0;
 }
 
-int32 lseek_fs(File *file, int32 offset, int32 whence)
-{
-    if (file->node->lseek != NULL)
-    {
+int32 lseek_fs(File *file, int32 offset, int32 whence) {
+    if (file->node->lseek != NULL) {
         return file->node->lseek(file, offset, whence);
     }
 
     return 0;
 }
 
-int32 ftruncate_fs(File* file, int32 length)
-{
-    if (file->node->ftruncate != NULL)
-    {
+int32 ftruncate_fs(File* file, int32 length) {
+    if (file->node->ftruncate != NULL) {
         return file->node->ftruncate(file, length);
     }
 
     return -1;
 }
 
-int32 stat_fs(FileSystemNode *node, struct stat *buf)
-{
+int32 stat_fs(FileSystemNode *node, struct stat *buf) {
 #define	__S_IFDIR	0040000	/* Directory.  */
 #define	__S_IFCHR	0020000	/* Character device.  */
 #define	__S_IFBLK	0060000	/* Block device.  */
@@ -313,36 +265,28 @@ int32 stat_fs(FileSystemNode *node, struct stat *buf)
 #define	__S_IFLNK	0120000	/* Symbolic link.  */
 #define	__S_IFSOCK	0140000	/* Socket.  */
 
-    if (node->stat != NULL)
-    {
+    if (node->stat != NULL) {
         int32 val = node->stat(node, buf);
 
-        if (val == 1)
-        {
+        if (val == 1) {
             //return value of 1 from driver means we should fill buf here.
 
-            if ((node->nodeType & FT_Directory) == FT_Directory)
-            {
+            if ((node->nodeType & FT_Directory) == FT_Directory) {
                 buf->st_mode = __S_IFDIR;
             }
-            else if ((node->nodeType & FT_CharacterDevice) == FT_CharacterDevice)
-            {
+            else if ((node->nodeType & FT_CharacterDevice) == FT_CharacterDevice) {
                 buf->st_mode = __S_IFCHR;
             }
-            else if ((node->nodeType & FT_BlockDevice) == FT_BlockDevice)
-            {
+            else if ((node->nodeType & FT_BlockDevice) == FT_BlockDevice) {
                 buf->st_mode = __S_IFBLK;
             }
-            else if ((node->nodeType & FT_Pipe) == FT_Pipe)
-            {
+            else if ((node->nodeType & FT_Pipe) == FT_Pipe) {
                 buf->st_mode = __S_IFIFO;
             }
-            else if ((node->nodeType & FT_SymbolicLink) == FT_SymbolicLink)
-            {
+            else if ((node->nodeType & FT_SymbolicLink) == FT_SymbolicLink) {
                 buf->st_mode = __S_IFLNK;
             }
-            else if ((node->nodeType & FT_File) == FT_File)
-            {
+            else if ((node->nodeType & FT_File) == FT_File) {
                 buf->st_mode = __S_IFREG;
             }
 
@@ -350,8 +294,7 @@ int32 stat_fs(FileSystemNode *node, struct stat *buf)
 
             return 0;
         }
-        else
-        {
+        else {
             return val;
         }
     }
@@ -359,95 +302,75 @@ int32 stat_fs(FileSystemNode *node, struct stat *buf)
     return -1;
 }
 
-FileSystemDirent *readdir_fs(FileSystemNode *node, uint32 index)
-{
+FileSystemDirent *readdir_fs(FileSystemNode *node, uint32 index) {
     //printkf("readdir_fs: node->name:%s index:%d\n", node->name, index);
 
-    if ( (node->nodeType & FT_MountPoint) == FT_MountPoint && node->mountPoint != NULL )
-    {
-        if (NULL == node->mountPoint->readdir)
-        {
+    if ( (node->nodeType & FT_MountPoint) == FT_MountPoint && node->mountPoint != NULL ) {
+        if (NULL == node->mountPoint->readdir) {
             WARNING("mounted fs does not have readdir!\n");
         }
-        else
-        {
+        else {
             return node->mountPoint->readdir(node->mountPoint, index);
         }
     }
-    else if ( (node->nodeType & FT_Directory) == FT_Directory && node->readdir != NULL )
-    {
+    else if ( (node->nodeType & FT_Directory) == FT_Directory && node->readdir != NULL ) {
         return node->readdir(node, index);
     }
 
     return NULL;
 }
 
-FileSystemNode *finddir_fs(FileSystemNode *node, char *name)
-{
+FileSystemNode *finddir_fs(FileSystemNode *node, char *name) {
     //printkf("finddir_fs: name:%s\n", name);
 
-    if ( (node->nodeType & FT_MountPoint) == FT_MountPoint && node->mountPoint != NULL )
-    {
-        if (NULL == node->mountPoint->finddir)
-        {
+    if ( (node->nodeType & FT_MountPoint) == FT_MountPoint && node->mountPoint != NULL ) {
+        if (NULL == node->mountPoint->finddir) {
             WARNING("mounted fs does not have finddir!\n");
         }
-        else
-        {
+        else {
             return node->mountPoint->finddir(node->mountPoint, name);
         }
     }
-    else if ( (node->nodeType & FT_Directory) == FT_Directory && node->finddir != NULL )
-    {
+    else if ( (node->nodeType & FT_Directory) == FT_Directory && node->finddir != NULL ) {
         return node->finddir(node, name);
     }
 
     return NULL;
 }
 
-BOOL mkdir_fs(FileSystemNode *node, const char *name, uint32 flags)
-{
-    if ( (node->nodeType & FT_MountPoint) == FT_MountPoint && node->mountPoint != NULL )
-    {
-        if (node->mountPoint->mkdir)
-        {
+BOOL mkdir_fs(FileSystemNode *node, const char *name, uint32 flags) {
+    if ( (node->nodeType & FT_MountPoint) == FT_MountPoint && node->mountPoint != NULL ) {
+        if (node->mountPoint->mkdir) {
             return node->mountPoint->mkdir(node->mountPoint, name, flags);
         }
     }
-    else if ( (node->nodeType & FT_Directory) == FT_Directory && node->mkdir != NULL )
-    {
+    else if ( (node->nodeType & FT_Directory) == FT_Directory && node->mkdir != NULL ) {
         return node->mkdir(node, name, flags);
     }
 
     return FALSE;
 }
 
-void* mmap_fs(File* file, uint32 size, uint32 offset, uint32 flags)
-{
-    if (file->node->mmap)
-    {
+void* mmap_fs(File* file, uint32 size, uint32 offset, uint32 flags) {
+    if (file->node->mmap) {
         return file->node->mmap(file, size, offset, flags);
     }
 
     return NULL;
 }
 
-BOOL munmap_fs(File* file, void* address, uint32 size)
-{
-    if (file->node->munmap)
-    {
+BOOL munmap_fs(File* file, void* address, uint32 size) {
+    if (file->node->munmap) {
         return file->node->munmap(file, address, size);
     }
 
     return FALSE;
 }
 
-FileSystemNode *getFileSystemNode(const char *path)
-{
+FileSystemNode *getFileSystemNode(const char *path) {
     //printkf("getFileSystemNode:%s *0\n", path);
 
-    if (path[0] != '/')
-    {
+    if (path[0] != '/') {
         //We require absolute path!
         return NULL;
     }
@@ -457,16 +380,14 @@ FileSystemNode *getFileSystemNode(const char *path)
 
     BOOL resolved = resolvePath(path, realPath, 256);
 
-    if (FALSE == resolved)
-    {
+    if (FALSE == resolved) {
         return NULL;
     }
 
     const char* inputPath = realPath;
     int pathLength = strlen(inputPath);
 
-    if (pathLength < 1)
-    {
+    if (pathLength < 1) {
         return NULL;
     }
 
@@ -476,8 +397,7 @@ FileSystemNode *getFileSystemNode(const char *path)
 
     FileSystemNode* root = getFileSystemRootNode();
 
-    if (pathLength == 1)
-    {
+    if (pathLength == 1) {
         return root;
     }
 
@@ -489,27 +409,23 @@ FileSystemNode *getFileSystemNode(const char *path)
 
     char buffer[64];
 
-    do
-    {
+    do {
         do_start:
         inputPath = inputPath + nextIndex + 1;
         nextIndex = strFirstIndexOf(inputPath, '/');
 
-        if (nextIndex == 0)
-        {
+        if (nextIndex == 0) {
             //detected successive slash
             goto do_start;
         }
 
-        if (nextIndex > 0)
-        {
+        if (nextIndex > 0) {
             int tokenSize = nextIndex;
 
             strncpy(buffer, inputPath, tokenSize);
             buffer[tokenSize] = '\0';
         }
-        else
-        {
+        else {
             //Last part
             strcpy(buffer, inputPath);
         }
@@ -520,8 +436,7 @@ FileSystemNode *getFileSystemNode(const char *path)
 
         //printkf("getFileSystemNode:%s *4\n", path);
 
-        if (NULL == node)
-        {
+        if (NULL == node) {
             return NULL;
         }
 
@@ -530,32 +445,25 @@ FileSystemNode *getFileSystemNode(const char *path)
     return node;
 }
 
-FileSystemNode* getFileSystemNodeAbsoluteOrRelative(const char* path, Process* process)
-{
+FileSystemNode* getFileSystemNodeAbsoluteOrRelative(const char* path, Process* process) {
     FileSystemNode* node = NULL;
 
-    if (process)
-    {
-        if ('\0' == path[0])
-        {
+    if (process) {
+        if ('\0' == path[0]) {
             //empty
         }
-        else if ('/' == path[0])
-        {
+        else if ('/' == path[0]) {
             //absolute
 
             node = getFileSystemNode(path);
         }
-        else
-        {
+        else {
             //relative
 
-            if (process->workingDirectory)
-            {
+            if (process->workingDirectory) {
                 char buffer[256];
 
-                if (getFileSystemNodePath(process->workingDirectory, buffer, 256) >= 0)
-                {
+                if (getFileSystemNodePath(process->workingDirectory, buffer, 256) >= 0) {
                     strcat(buffer, "/");
                     strcat(buffer, path);
 
@@ -570,17 +478,13 @@ FileSystemNode* getFileSystemNodeAbsoluteOrRelative(const char* path, Process* p
     return node;
 }
 
-BOOL registerFileSystem(FileSystem* fs)
-{
-    if (strlen(fs->name) <= 0)
-    {
+BOOL registerFileSystem(FileSystem* fs) {
+    if (strlen(fs->name) <= 0) {
         return FALSE;
     }
 
-    for (int i = 0; i < gNextFileSystemIndex; ++i)
-    {
-        if (strcmp(gRegisteredFileSystems[i].name, fs->name) == 0)
-        {
+    for (int i = 0; i < gNextFileSystemIndex; ++i) {
+        if (strcmp(gRegisteredFileSystems[i].name, fs->name) == 0) {
             //name is in use
             return FALSE;
         }
@@ -591,42 +495,34 @@ BOOL registerFileSystem(FileSystem* fs)
     return TRUE;
 }
 
-BOOL mountFileSystem(const char *source, const char *target, const char *fsType, uint32 flags, void *data)
-{
+BOOL mountFileSystem(const char *source, const char *target, const char *fsType, uint32 flags, void *data) {
     FileSystem* fs = NULL;
 
-    for (int i = 0; i < gNextFileSystemIndex; ++i)
-    {
-        if (strcmp(gRegisteredFileSystems[i].name, fsType) == 0)
-        {
+    for (int i = 0; i < gNextFileSystemIndex; ++i) {
+        if (strcmp(gRegisteredFileSystems[i].name, fsType) == 0) {
             fs = &gRegisteredFileSystems[i];
             break;
         }
     }
 
-    if (NULL == fs)
-    {
+    if (NULL == fs) {
         return FALSE;
     }
 
     return fs->mount(source, target, flags, data);
 }
 
-BOOL checkMountFileSystem(const char *source, const char *target, const char *fsType, uint32 flags, void *data)
-{
+BOOL checkMountFileSystem(const char *source, const char *target, const char *fsType, uint32 flags, void *data) {
     FileSystem* fs = NULL;
 
-    for (int i = 0; i < gNextFileSystemIndex; ++i)
-    {
-        if (strcmp(gRegisteredFileSystems[i].name, fsType) == 0)
-        {
+    for (int i = 0; i < gNextFileSystemIndex; ++i) {
+        if (strcmp(gRegisteredFileSystems[i].name, fsType) == 0) {
             fs = &gRegisteredFileSystems[i];
             break;
         }
     }
 
-    if (NULL == fs)
-    {
+    if (NULL == fs) {
         return FALSE;
     }
 
diff --git a/kernel.soso/fs.h b/kernel.soso/fs.h
index ae721341..dac653c3 100644
--- a/kernel.soso/fs.h
+++ b/kernel.soso/fs.h
@@ -3,8 +3,7 @@
 
 #include "common.h"
 
-typedef enum FileType
-{
+typedef enum FileType {
     FT_File               = 1,
     FT_CharacterDevice    = 2,
     FT_BlockDevice        = 3,
@@ -14,8 +13,7 @@ typedef enum FileType
     FT_MountPoint         = 256
 } FileType;
 
-typedef enum IoctlCommand
-{
+typedef enum IoctlCommand {
     IC_GetSectorSizeInBytes,
     IC_GetSectorCount,
 } IoctlCommand;
@@ -45,15 +43,13 @@ typedef BOOL (*MunmapFunction)(File* file, void* address, uint32 size);
 
 typedef BOOL (*MountFunction)(const char* sourcePath, const char* targetPath, uint32 flags, void *data);
 
-typedef struct FileSystem
-{
+typedef struct FileSystem {
     char name[32];
     MountFunction checkMount;
     MountFunction mount;
 } FileSystem;
 
-typedef struct FileSystemNode
-{
+typedef struct FileSystemNode {
     char name[128];
     uint32 mask;
     uint32 userId;
@@ -84,16 +80,14 @@ typedef struct FileSystemNode
     void* privateNodeData;
 } FileSystemNode;
 
-typedef struct FileSystemDirent
-{
+typedef struct FileSystemDirent {
     char name[128];
     FileType fileType;
     uint32 inode;
 } FileSystemDirent;
 
 //Per open
-typedef struct File
-{
+typedef struct File {
     FileSystemNode* node;
     Process* process;
     Thread* thread;
@@ -102,8 +96,7 @@ typedef struct File
     void* privateData;
 } File;
 
-struct stat
-{
+struct stat {
     uint16/*dev_t      */ st_dev;     /* ID of device containing file */
     uint16/*ino_t      */ st_ino;     /* inode number */
     uint32/*mode_t     */ st_mode;    /* protection */
diff --git a/kernel.soso/gfx.c b/kernel.soso/gfx.c
index 63ce9022..15e0ae69 100644
--- a/kernel.soso/gfx.c
+++ b/kernel.soso/gfx.c
@@ -22,8 +22,7 @@ static uint16 gCurrentColumn = 0;
 
 #define LINE_HEIGHT 16
 
-void Gfx_Initialize(uint32* pixels, uint32 width, uint32 height, uint32 bytesPerPixel, uint32 pitch)
-{
+void Gfx_Initialize(uint32* pixels, uint32 width, uint32 height, uint32 bytesPerPixel, uint32 pitch) {
     char* p_address = (char*)pixels;
     char* v_address = (char*)GFX_MEMORY;
 
@@ -41,18 +40,14 @@ void Gfx_Initialize(uint32* pixels, uint32 width, uint32 height, uint32 bytesPer
 
     BOOL success = addPageToPd(gKernelPageDirectory, v_address, p_address, 0);
 
-    if (success)
-    {
-        for (int y = 0; y < gHeight; ++y)
-        {
-            for (int x = 0; x < gWidth; ++x)
-            {
+    if (success) {
+        for (int y = 0; y < gHeight; ++y) {
+            for (int x = 0; x < gWidth; ++x) {
                 gPixels[x + y * gWidth] = 0xFFFFFFFF;
             }
         }
     }
-    else
-    {
+    else {
         Debug_PrintF("Gfx initialization failed!\n");
     }
 
@@ -79,8 +74,7 @@ void Gfx_PutCharAt(
     /* cursor position on screen, in characters not in pixels */
     int cx, int cy,
     /* foreground and background colors, say 0xFFFFFF and 0x000000 */
-    uint32 fg, uint32 bg)
-{
+    uint32 fg, uint32 bg) {
     /* cast the address to PSF header struct */
     PSF_font *font = (PSF_font*)&_binary_font_psf_start;
     /* we need to know how many bytes encode one row */
@@ -107,14 +101,11 @@ void Gfx_PutCharAt(
         line=offs;
         mask=1<<(font->width-1);
         /* display a row */
-        for(x=0;x<font->width;x++)
-        {
-            if (c == 0)
-            {
+        for(x=0;x<font->width;x++) {
+            if (c == 0) {
                 *((uint32*)((uint8*)gPixels + line)) = bg;
             }
-            else
-            {
+            else {
                 *((uint32*)((uint8*)gPixels + line)) = ((int)*glyph) & (mask) ? fg : bg;
             }
 
@@ -128,12 +119,9 @@ void Gfx_PutCharAt(
     }
 }
 
-void Gfx_FlushFromTty(Tty* tty)
-{
-    for (uint32 r = 0; r < tty->lineCount; ++r)
-    {
-        for (uint32 c = 0; c < tty->columnCount; ++c)
-        {
+void Gfx_FlushFromTty(Tty* tty) {
+    for (uint32 r = 0; r < tty->lineCount; ++r) {
+        for (uint32 c = 0; c < tty->columnCount; ++c) {
             uint8* ttyPos = tty->buffer + (r * tty->columnCount + c) * 2;
 
             uint8 chr = ttyPos[0];
@@ -146,32 +134,25 @@ void Gfx_FlushFromTty(Tty* tty)
     //Screen_MoveCursor(tty->currentLine, tty->currentColumn);
 }
 
-uint8* Gfx_GetVideoMemory()
-{
+uint8* Gfx_GetVideoMemory() {
     return (uint8*)gPixels;
 }
 
-uint16 Gfx_GetWidth()
-{
+uint16 Gfx_GetWidth() {
     return gWidth;
 }
 
-uint16 Gfx_GetHeight()
-{
+uint16 Gfx_GetHeight() {
     return gHeight;
 }
 
-uint16 Gfx_GetBytesPerPixel()
-{
+uint16 Gfx_GetBytesPerPixel() {
     return gBytesPerPixel;
 }
 
-void Gfx_Fill(uint32 color)
-{
-    for (uint32 y = 0; y < gHeight; ++y)
-    {
-        for (uint32 x = 0; x < gWidth; ++x)
-        {
+void Gfx_Fill(uint32 color) {
+    for (uint32 y = 0; y < gHeight; ++y) {
+        for (uint32 x = 0; x < gWidth; ++x) {
             gPixels[x + y * gWidth] = color;
         }
     }
diff --git a/kernel.soso/hashtable.c b/kernel.soso/hashtable.c
index dff523c5..8b5feca0 100644
--- a/kernel.soso/hashtable.c
+++ b/kernel.soso/hashtable.c
@@ -1,26 +1,22 @@
 #include "hashtable.h"
 #include "alloc.h"
 
-typedef struct DataItem
-{
+typedef struct DataItem {
    uint32 data;
    uint32 key;
    uint8 used;
 } DataItem;
 
-typedef struct HashTable
-{
+typedef struct HashTable {
    DataItem* items;
    uint32 capacity;
 } HashTable;
 
-static uint32 hashCode(HashTable* hashTable, uint32 key)
-{
+static uint32 hashCode(HashTable* hashTable, uint32 key) {
    return key % hashTable->capacity;
 }
 
-HashTable* HashTable_create(uint32 capacity)
-{
+HashTable* HashTable_create(uint32 capacity) {
     HashTable* hashTable = kmalloc(sizeof(HashTable));
     memset((uint8*)hashTable, 0, sizeof(HashTable));
     hashTable->capacity = capacity;
@@ -29,24 +25,19 @@ HashTable* HashTable_create(uint32 capacity)
     return hashTable;
 }
 
-void HashTable_destroy(HashTable* hashTable)
-{
+void HashTable_destroy(HashTable* hashTable) {
     kfree(hashTable->items);
     kfree(hashTable);
 }
 
-DataItem* HashTable_search_internal(HashTable* hashTable, uint32 key)
-{
+DataItem* HashTable_search_internal(HashTable* hashTable, uint32 key) {
    //get the hash
    uint32 hashIndex = hashCode(hashTable, key);
 
    uint32 counter = 0;
-   while(counter < hashTable->capacity)
-   {
-      if(hashTable->items[hashIndex].key == key)
-      {
-          if(hashTable->items[hashIndex].used == TRUE)
-          {
+   while(counter < hashTable->capacity) {
+      if(hashTable->items[hashIndex].key == key) {
+          if(hashTable->items[hashIndex].used == TRUE) {
               return &(hashTable->items[hashIndex]);
           }
       }
@@ -63,12 +54,10 @@ DataItem* HashTable_search_internal(HashTable* hashTable, uint32 key)
    return NULL;
 }
 
-BOOL HashTable_search(HashTable* hashTable, uint32 key, uint32* value)
-{
+BOOL HashTable_search(HashTable* hashTable, uint32 key, uint32* value) {
     DataItem* existing = HashTable_search_internal(hashTable, key);
 
-    if (existing)
-    {
+    if (existing) {
         *value = existing->data;
 
         return TRUE;
@@ -77,12 +66,10 @@ BOOL HashTable_search(HashTable* hashTable, uint32 key, uint32* value)
     return FALSE;
 }
 
-BOOL HashTable_insert(HashTable* hashTable, uint32 key, uint32 data)
-{
+BOOL HashTable_insert(HashTable* hashTable, uint32 key, uint32 data) {
     DataItem* existing = HashTable_search_internal(hashTable, key);
 
-    if (existing)
-    {
+    if (existing) {
         existing->data = data;
 
         return TRUE;
@@ -93,10 +80,8 @@ BOOL HashTable_insert(HashTable* hashTable, uint32 key, uint32 data)
 
     uint32 counter = 0;
     //move in array until an empty or deleted cell
-    while(counter < hashTable->capacity)
-    {
-        if (hashTable->items[hashIndex].used == FALSE)
-        {
+    while(counter < hashTable->capacity) {
+        if (hashTable->items[hashIndex].used == FALSE) {
             hashTable->items[hashIndex].key = key;
             hashTable->items[hashIndex].data = data;
             hashTable->items[hashIndex].used = TRUE;
@@ -117,12 +102,10 @@ BOOL HashTable_insert(HashTable* hashTable, uint32 key, uint32 data)
     return FALSE;
 }
 
-BOOL HashTable_remove(HashTable* hashTable, uint32 key)
-{
+BOOL HashTable_remove(HashTable* hashTable, uint32 key) {
     DataItem* existing = HashTable_search_internal(hashTable, key);
 
-    if (existing)
-    {
+    if (existing) {
         existing->used = FALSE;
 
         return TRUE;
diff --git a/kernel.soso/isr.c b/kernel.soso/isr.c
index 0d031d1e..448a2e55 100644
--- a/kernel.soso/isr.c
+++ b/kernel.soso/isr.c
@@ -6,35 +6,29 @@ IsrFunction gInterruptHandlers[256];
 
 extern uint32 gSystemTickCount;
 
-void registerInterruptHandler(uint8 n, IsrFunction handler)
-{
+void registerInterruptHandler(uint8 n, IsrFunction handler) {
     gInterruptHandlers[n] = handler;
 }
 
-void handleISR(Registers regs)
-{
+void handleISR(Registers regs) {
     //printkf("handleISR interrupt no:%d\n", regs.int_no);
 
     uint8 int_no = regs.interruptNumber & 0xFF;
 
-    if (gInterruptHandlers[int_no] != 0)
-    {
+    if (gInterruptHandlers[int_no] != 0) {
         IsrFunction handler = gInterruptHandlers[int_no];
         handler(&regs);
     }
-    else
-    {
+    else {
         printkf("unhandled interrupt: %d\n", int_no);
         printkf("Tick: %d\n", gSystemTickCount);
         PANIC("unhandled interrupt");
     }
 }
 
-void handleIRQ(Registers regs)
-{
+void handleIRQ(Registers regs) {
     // end of interrupt message
-    if (regs.interruptNumber >= 40)
-    {
+    if (regs.interruptNumber >= 40) {
         //slave PIC
         outb(0xA0, 0x20);
     }
@@ -43,8 +37,7 @@ void handleIRQ(Registers regs)
 
     //printkf("irq: %d\n", regs.int_no);
 
-    if (gInterruptHandlers[regs.interruptNumber] != 0)
-    {
+    if (gInterruptHandlers[regs.interruptNumber] != 0) {
         IsrFunction handler = gInterruptHandlers[regs.interruptNumber];
         handler(&regs);
     }
diff --git a/kernel.soso/isr.h b/kernel.soso/isr.h
index 15f5c8ac..dbf30311 100644
--- a/kernel.soso/isr.h
+++ b/kernel.soso/isr.h
@@ -20,8 +20,7 @@
 #define IRQ14 46
 #define IRQ15 47
 
-typedef struct Registers
-{
+typedef struct Registers {
     uint32 gs;
     uint32 fs;
     uint32 es;
diff --git a/kernel.soso/keyboard.c b/kernel.soso/keyboard.c
index affd70a5..8bb7ed81 100644
--- a/kernel.soso/keyboard.c
+++ b/kernel.soso/keyboard.c
@@ -20,14 +20,12 @@ static void keyboard_close(File *file);
 static int32 keyboard_read(File *file, uint32 size, uint8 *buffer);
 static int32 keyboard_ioctl(File *file, int32 request, void * argp);
 
-typedef enum ReadMode
-{
+typedef enum ReadMode {
     Blocking = 0,
     NonBlocking = 1
 } ReadMode;
 
-typedef struct Reader
-{
+typedef struct Reader {
     uint32 readIndex;
     ReadMode readMode;
 } Reader;
@@ -36,8 +34,7 @@ static List* gReaders = NULL;
 
 static void handleKeyboardInterrupt(Registers *regs);
 
-void initializeKeyboard()
-{
+void initializeKeyboard() {
     Device device;
     memset((uint8*)&device, 0, sizeof(Device));
     strcpy(device.name, "keyboard");
@@ -57,14 +54,12 @@ void initializeKeyboard()
     registerInterruptHandler(IRQ1, handleKeyboardInterrupt);
 }
 
-static BOOL keyboard_open(File *file, uint32 flags)
-{
+static BOOL keyboard_open(File *file, uint32 flags) {
     Reader* reader = (Reader*)kmalloc(sizeof(Reader));
     reader->readIndex = 0;
     reader->readMode = Blocking;
 
-    if (gKeyBufferWriteIndex > 0)
-    {
+    if (gKeyBufferWriteIndex > 0) {
         reader->readIndex = gKeyBufferWriteIndex;
     }
     file->privateData = (void*)reader;
@@ -74,8 +69,7 @@ static BOOL keyboard_open(File *file, uint32 flags)
     return TRUE;
 }
 
-static void keyboard_close(File *file)
-{
+static void keyboard_close(File *file) {
     //printkf("keyboard_close\n");
 
     Reader* reader = (Reader*)file->privateData;
@@ -85,16 +79,13 @@ static void keyboard_close(File *file)
     List_RemoveFirstOccurrence(gReaders, file);
 }
 
-static int32 keyboard_read(File *file, uint32 size, uint8 *buffer)
-{
+static int32 keyboard_read(File *file, uint32 size, uint8 *buffer) {
     Reader* reader = (Reader*)file->privateData;
 
     uint32 readIndex = reader->readIndex;
 
-    if (reader->readMode == Blocking)
-    {
-        while (readIndex == gKeyBufferWriteIndex)
-        {
+    if (reader->readMode == Blocking) {
+        while (readIndex == gKeyBufferWriteIndex) {
             file->thread->state = TS_WAITIO;
             file->thread->state_privateData = keyboard_read;
             enableInterrupts();
@@ -104,8 +95,7 @@ static int32 keyboard_read(File *file, uint32 size, uint8 *buffer)
 
     disableInterrupts();
 
-    if (readIndex == gKeyBufferWriteIndex)
-    {
+    if (readIndex == gKeyBufferWriteIndex) {
         //non-blocking return here
         return -1;
     }
@@ -119,27 +109,23 @@ static int32 keyboard_read(File *file, uint32 size, uint8 *buffer)
     return 1;
 }
 
-static int32 keyboard_ioctl(File *file, int32 request, void * argp)
-{
+static int32 keyboard_ioctl(File *file, int32 request, void * argp) {
     Reader* reader = (Reader*)file->privateData;
 
     int cmd = (int)argp;
 
-    switch (request)
-    {
+    switch (request) {
     case 0: //get
         *(int*)argp = (int)reader->readMode;
         return 0;
         break;
     case 1: //set
-        if (cmd == 0)
-        {
+        if (cmd == 0) {
             reader->readMode = Blocking;
 
             return 0;
         }
-        else if (cmd == 1)
-        {
+        else if (cmd == 1) {
             reader->readMode = NonBlocking;
             return 0;
         }
@@ -151,11 +137,9 @@ static int32 keyboard_ioctl(File *file, int32 request, void * argp)
     return -1;
 }
 
-static void handleKeyboardInterrupt(Registers *regs)
-{
+static void handleKeyboardInterrupt(Registers *regs) {
     uint8 scancode = 0;
-    do
-    {
+    do {
         scancode = inb(0x64);
     } while ((scancode & 0x01) == 0);
 
@@ -166,14 +150,11 @@ static void handleKeyboardInterrupt(Registers *regs)
     gKeyBufferWriteIndex %= KEYBUFFER_SIZE;
 
     //Wake readers
-    List_Foreach(n, gReaders)
-    {
+    List_Foreach(n, gReaders) {
         File* file = n->data;
 
-        if (file->thread->state == TS_WAITIO)
-        {
-            if (file->thread->state_privateData == keyboard_read)
-            {
+        if (file->thread->state == TS_WAITIO) {
+            if (file->thread->state_privateData == keyboard_read) {
                 file->thread->state = TS_RUN;
                 file->thread->state_privateData = NULL;
             }
diff --git a/kernel.soso/list.c b/kernel.soso/list.c
index 09883eba..5565df15 100644
--- a/kernel.soso/list.c
+++ b/kernel.soso/list.c
@@ -2,8 +2,7 @@
 #include "common.h"
 #include "list.h"
 
-List* List_Create()
-{
+List* List_Create() {
     List* list = (List*)kmalloc(sizeof(List));
 
     memset((uint8*)list, 0, sizeof(List));
@@ -11,12 +10,10 @@ List* List_Create()
     return list;
 }
 
-void List_Clear(List* list)
-{
+void List_Clear(List* list) {
     ListNode* listNode = list->head;
 
-    while (NULL != listNode)
-    {
+    while (NULL != listNode) {
         ListNode* next = listNode->next;
 
         kfree(listNode);
@@ -28,41 +25,35 @@ void List_Clear(List* list)
     list->tail = NULL;
 }
 
-void List_Destroy(List* list)
-{
+void List_Destroy(List* list) {
     List_Clear(list);
 
     kfree(list);
 }
 
-List* List_CreateClone(List* list)
-{
+List* List_CreateClone(List* list) {
     List* newList = List_Create();
 
-    List_Foreach(n, list)
-    {
+    List_Foreach(n, list) {
         List_Append(newList, n->data);
     }
 
     return newList;
 }
 
-BOOL List_IsEmpty(List* list)
-{
+BOOL List_IsEmpty(List* list) {
     //At empty state, both head and tail are null!
     return list->head == NULL;
 }
 
-void List_Append(List* list, void* data)
-{
+void List_Append(List* list, void* data) {
     ListNode* node = (ListNode*)kmalloc(sizeof(ListNode));
 
     memset((uint8*)node, 0, sizeof(ListNode));
     node->data = data;
 
     //At empty state, both head and tail are null!
-    if (NULL == list->tail)
-    {
+    if (NULL == list->tail) {
         list->head = node;
 
         list->tail = node;
@@ -75,16 +66,14 @@ void List_Append(List* list, void* data)
     list->tail = node;
 }
 
-void List_Prepend(List* list, void* data)
-{
+void List_Prepend(List* list, void* data) {
     ListNode* node = (ListNode*)kmalloc(sizeof(ListNode));
 
     memset((uint8*)node, 0, sizeof(ListNode));
     node->data = data;
 
     //At empty state, both head and tail are null!
-    if (NULL == list->tail)
-    {
+    if (NULL == list->tail) {
         list->head = node;
 
         list->tail = node;
@@ -97,22 +86,17 @@ void List_Prepend(List* list, void* data)
     list->head = node;
 }
 
-ListNode* List_GetFirstNode(List* list)
-{
+ListNode* List_GetFirstNode(List* list) {
     return list->head;
 }
 
-ListNode* List_GetLastNode(List* list)
-{
+ListNode* List_GetLastNode(List* list) {
     return list->tail;
 }
 
-ListNode* List_FindFirstOccurrence(List* list, void* data)
-{
-    List_Foreach(n, list)
-    {
-        if (n->data == data)
-        {
+ListNode* List_FindFirstOccurrence(List* list, void* data) {
+    List_Foreach(n, list) {
+        if (n->data == data) {
             return n;
         }
     }
@@ -120,14 +104,11 @@ ListNode* List_FindFirstOccurrence(List* list, void* data)
     return NULL;
 }
 
-int List_FindFirstOccurrenceIndex(List* list, void* data)
-{
+int List_FindFirstOccurrenceIndex(List* list, void* data) {
     int result = 0;
 
-    List_Foreach(n, list)
-    {
-        if (n->data == data)
-        {
+    List_Foreach(n, list) {
+        if (n->data == data) {
             return result;
         }
 
@@ -137,76 +118,61 @@ int List_FindFirstOccurrenceIndex(List* list, void* data)
     return -1;
 }
 
-int List_GetCount(List* list)
-{
+int List_GetCount(List* list) {
     int result = 0;
 
-    List_Foreach(n, list)
-    {
+    List_Foreach(n, list) {
         ++result;
     }
 
     return result;
 }
 
-void List_RemoveNode(List* list, ListNode* node)
-{
-    if (NULL == node)
-    {
+void List_RemoveNode(List* list, ListNode* node) {
+    if (NULL == node) {
         return;
     }
 
-    if (NULL != node->previous)
-    {
+    if (NULL != node->previous) {
         node->previous->next = node->next;
     }
 
-    if (NULL != node->next)
-    {
+    if (NULL != node->next) {
         node->next->previous = node->previous;
     }
 
-    if (node == list->head)
-    {
+    if (node == list->head) {
         list->head = node->next;
     }
 
-    if (node == list->tail)
-    {
+    if (node == list->tail) {
         list->tail = node->previous;
     }
 
     kfree(node);
 }
 
-void List_RemoveFirstNode(List* list)
-{
-    if (NULL != list->head)
-    {
+void List_RemoveFirstNode(List* list) {
+    if (NULL != list->head) {
         List_RemoveNode(list, list->head);
     }
 }
 
-void List_RemoveLastNode(List* list)
-{
-    if (NULL != list->tail)
-    {
+void List_RemoveLastNode(List* list) {
+    if (NULL != list->tail) {
         List_RemoveNode(list, list->tail);
     }
 }
 
-void List_RemoveFirstOccurrence(List* list, void* data)
-{
+void List_RemoveFirstOccurrence(List* list, void* data) {
     ListNode* node = List_FindFirstOccurrence(list, data);
 
-    if (NULL != node)
-    {
+    if (NULL != node) {
         List_RemoveNode(list, node);
     }
 }
 
-Stack* Stack_Create()
-{
+Stack* Stack_Create() {
     Stack* stack = (Stack*)kmalloc(sizeof(Stack));
 
     memset((uint8*)stack, 0, sizeof(Stack));
@@ -216,36 +182,30 @@ Stack* Stack_Create()
     return stack;
 }
 
-void Stack_Clear(Stack* stack)
-{
+void Stack_Clear(Stack* stack) {
     List_Clear(stack->list);
 }
 
-void Stack_Destroy(Stack* stack)
-{
+void Stack_Destroy(Stack* stack) {
     List_Destroy(stack->list);
 
     kfree(stack);
 }
 
-BOOL Stack_IsEmpty(Stack* stack)
-{
+BOOL Stack_IsEmpty(Stack* stack) {
     return List_IsEmpty(stack->list);
 }
 
-void Stack_Push(Stack* stack, void* data)
-{
+void Stack_Push(Stack* stack, void* data) {
     List_Prepend(stack->list, data);
 }
 
-void* Stack_Pop(Stack* stack)
-{
+void* Stack_Pop(Stack* stack) {
     void* result = NULL;
 
     ListNode* node = List_GetFirstNode(stack->list);
 
-    if (NULL != node)
-    {
+    if (NULL != node) {
         result = node->data;
 
         List_RemoveNode(stack->list, node);
@@ -254,8 +214,7 @@ void* Stack_Pop(Stack* stack)
     return result;
 }
 
-Queue* Queue_Create()
-{
+Queue* Queue_Create() {
     Queue* queue = (Queue*)kmalloc(sizeof(Queue));
 
     memset((uint8*)queue, 0, sizeof(Queue));
@@ -265,36 +224,30 @@ Queue* Queue_Create()
     return queue;
 }
 
-void Queue_Clear(Queue* queue)
-{
+void Queue_Clear(Queue* queue) {
     List_Clear(queue->list);
 }
 
-void Queue_Destroy(Queue* queue)
-{
+void Queue_Destroy(Queue* queue) {
     List_Destroy(queue->list);
 
     kfree(queue);
 }
 
-BOOL Queue_IsEmpty(Queue* queue)
-{
+BOOL Queue_IsEmpty(Queue* queue) {
     return List_IsEmpty(queue->list);
 }
 
-void Queue_Enqueue(Queue* queue, void* data)
-{
+void Queue_Enqueue(Queue* queue, void* data) {
     List_Append(queue->list, data);
 }
 
-void* Queue_Dequeue(Queue* stack)
-{
+void* Queue_Dequeue(Queue* stack) {
     void* result = NULL;
 
     ListNode* node = List_GetFirstNode(stack->list);
 
-    if (NULL != node)
-    {
+    if (NULL != node) {
         result = node->data;
 
         List_RemoveNode(stack->list, node);
diff --git a/kernel.soso/list.h b/kernel.soso/list.h
index 85546b23..4e7831b2 100644
--- a/kernel.soso/list.h
+++ b/kernel.soso/list.h
@@ -5,15 +5,13 @@
 
 #define List_Foreach(listNode, list) for (ListNode* listNode = list->head; NULL != listNode ; listNode = listNode->next)
 
-typedef struct ListNode
-{
+typedef struct ListNode {
     struct ListNode* previous;
     struct ListNode* next;
     void* data;
 } ListNode;
 
-typedef struct List
-{
+typedef struct List {
     struct ListNode* head;
     struct ListNode* tail;
 } List;
@@ -35,8 +33,7 @@ void List_RemoveFirstNode(List* list);
 void List_RemoveLastNode(List* list);
 void List_RemoveFirstOccurrence(List* list, void* data);
 
-typedef struct Stack
-{
+typedef struct Stack {
     List* list;
 } Stack;
 
@@ -47,8 +44,7 @@ BOOL Stack_IsEmpty(Stack* stack);
 void Stack_Push(Stack* stack, void* data);
 void* Stack_Pop(Stack* stack);
 
-typedef struct Queue
-{
+typedef struct Queue {
     List* list;
 } Queue;
 
diff --git a/kernel.soso/main.c b/kernel.soso/main.c
index be7c97cb..cc457469 100644
--- a/kernel.soso/main.c
+++ b/kernel.soso/main.c
@@ -32,10 +32,8 @@ extern uint32 _end;
 uint32 gPhysicalKernelStartAddress = (uint32)&_start;
 uint32 gPhysicalKernelEndAddress = (uint32)&_end;
 
-static void* locateInitrd(struct Multiboot *mbi, uint32* size)
-{
-    if (mbi->mods_count > 0)
-    {
+static void* locateInitrd(struct Multiboot *mbi, uint32* size) {
+    if (mbi->mods_count > 0) {
         uint32 startLocation = *((uint32*)mbi->mods_addr);
         uint32 endLocation = *(uint32*)(mbi->mods_addr + 4);
 
@@ -47,8 +45,7 @@ static void* locateInitrd(struct Multiboot *mbi, uint32* size)
     return NULL;
 }
 
-void printUsageInfo()
-{
+void printUsageInfo() {
     char buffer[164];
 
     sprintf(buffer, "Used kheap:%d", getKernelHeapUsed());
@@ -66,8 +63,7 @@ void printUsageInfo()
     sprintf(buffer, "[idle]   cs:%d   ", p->totalContextSwitchCount);
     Screen_Print(line++, 60, buffer);
     p = p->next;
-    while (p != NULL)
-    {
+    while (p != NULL) {
         sprintf(buffer, "thread:%d cs:%d   ", p->threadId, p->totalContextSwitchCount);
 
         Screen_Print(line++, 60, buffer);
@@ -76,29 +72,23 @@ void printUsageInfo()
     }
 }
 
-int executeFile(const char *path, char *const argv[], char *const envp[], FileSystemNode* tty)
-{
+int executeFile(const char *path, char *const argv[], char *const envp[], FileSystemNode* tty) {
     int result = -1;
 
     Process* process = getCurrentThread()->owner;
-    if (process)
-    {
+    if (process) {
         FileSystemNode* node = getFileSystemNodeAbsoluteOrRelative(path, process);
-        if (node)
-        {
+        if (node) {
             File* f = open_fs(node, 0);
-            if (f)
-            {
+            if (f) {
                 void* image = kmalloc(node->length);
 
                 int32 bytesRead = read_fs(f, node->length, image);
 
-                if (bytesRead > 0)
-                {
+                if (bytesRead > 0) {
                     Process* newProcess = createUserProcessFromElfData("userProcess", image, argv, envp, process, tty);
 
-                    if (newProcess)
-                    {
+                    if (newProcess) {
                         result = newProcess->pid;
                     }
                 }
@@ -113,8 +103,7 @@ int executeFile(const char *path, char *const argv[], char *const envp[], FileSy
     return result;
 }
 
-void printAsciiArt()
-{
+void printAsciiArt() {
     printkf("     ________       ________      ________       ________     \n");
     printkf("    |\\   ____\\     |\\   __  \\    |\\   ____\\     |\\   __  \\    \n");
     printkf("    \\ \\  \\___|_    \\ \\  \\|\\  \\   \\ \\  \\___|_    \\ \\  \\|\\  \\   \n");
@@ -126,8 +115,7 @@ void printAsciiArt()
     printkf("\n");
 }
 
-int kmain(struct Multiboot *mboot_ptr)
-{
+int kmain(struct Multiboot *mboot_ptr) {
     int stack = 5;
 
     initializeDescriptorTables();
@@ -140,14 +128,12 @@ int kmain(struct Multiboot *mboot_ptr)
     initializeVFS();
     initializeDevFS();
 
-    if (MULTIBOOT_FRAMEBUFFER_TYPE_RGB == mboot_ptr->framebuffer_type)
-    {
+    if (MULTIBOOT_FRAMEBUFFER_TYPE_RGB == mboot_ptr->framebuffer_type) {
         Gfx_Initialize((uint32*)(uint32)mboot_ptr->framebuffer_addr, mboot_ptr->framebuffer_width, mboot_ptr->framebuffer_height, mboot_ptr->framebuffer_bpp / 32, mboot_ptr->framebuffer_pitch);
 
         initializeTTYs(TRUE);
     }
-    else
-    {
+    else {
         initializeTTYs(FALSE);
     }
     //printkf works after TTY initialization
@@ -174,8 +160,7 @@ int kmain(struct Multiboot *mboot_ptr)
     initializeKeyboard();
     initializeMouse();
 
-    if (0 != mboot_ptr->cmdline)
-    {
+    if (0 != mboot_ptr->cmdline) {
         printkf("Kernel cmdline:%s\n", (char*)mboot_ptr->cmdline);
     }
 
@@ -197,24 +182,20 @@ int kmain(struct Multiboot *mboot_ptr)
 
     uint32 initrdSize = 0;
     uint8* initrdLocation = locateInitrd(mboot_ptr, &initrdSize);
-    if (initrdLocation == NULL)
-    {
+    if (initrdLocation == NULL) {
         PANIC("Initrd not found!\n");
     }
-    else
-    {
+    else {
         printkf("Initrd found at %x (%d bytes)\n", initrdLocation, initrdSize);
         memcpy((uint8*)*(uint32*)getFileSystemNode("/dev/ramdisk1")->privateNodeData, initrdLocation, initrdSize);
         BOOL mountSuccess = mountFileSystem("/dev/ramdisk1", "/initrd", "fat", 0, 0);
 
-        if (mountSuccess)
-        {
+        if (mountSuccess) {
             printkf("Starting shell on TTYs\n");
 
             executeFile("/initrd/init", argv, envp, getFileSystemNode("/dev/tty1"));
         }
-        else
-        {
+        else {
             printkf("Mounting initrd failed!\n");
         }
     }
@@ -223,8 +204,7 @@ int kmain(struct Multiboot *mboot_ptr)
 
     enableInterrupts();
 
-    while(TRUE)
-    {
+    while(TRUE) {
         //Idle thread
 
         halt();
diff --git a/kernel.soso/message.c b/kernel.soso/message.c
index 729cff9e..d4ef1b57 100644
--- a/kernel.soso/message.c
+++ b/kernel.soso/message.c
@@ -3,8 +3,7 @@
 #include "fifobuffer.h"
 
 
-void sendMesage(Thread* thread, SosoMessage* message)
-{
+void sendMesage(Thread* thread, SosoMessage* message) {
     Spinlock_Lock(&(thread->messageQueueLock));
 
     FifoBuffer_enqueue(thread->messageQueue, (uint8*)message, sizeof(SosoMessage));
@@ -12,8 +11,7 @@ void sendMesage(Thread* thread, SosoMessage* message)
     Spinlock_Unlock(&(thread->messageQueueLock));
 }
 
-uint32 getMessageQueueCount(Thread* thread)
-{
+uint32 getMessageQueueCount(Thread* thread) {
     int result = 0;
 
     Spinlock_Lock(&(thread->messageQueueLock));
@@ -26,22 +24,19 @@ uint32 getMessageQueueCount(Thread* thread)
 }
 
 //returns remaining message count
-int32 getNextMessage(Thread* thread, SosoMessage* message)
-{
+int32 getNextMessage(Thread* thread, SosoMessage* message) {
     uint32 result = -1;
 
     Spinlock_Lock(&(thread->messageQueueLock));
 
     result = FifoBuffer_getSize(thread->messageQueue) / sizeof(SosoMessage);
 
-    if (result > 0)
-    {
+    if (result > 0) {
         FifoBuffer_dequeue(thread->messageQueue, (uint8*)message, sizeof(SosoMessage));
 
         --result;
     }
-    else
-    {
+    else {
         result = -1;
     }
 
diff --git a/kernel.soso/mouse.c b/kernel.soso/mouse.c
index c7ca2d5c..235d931d 100644
--- a/kernel.soso/mouse.c
+++ b/kernel.soso/mouse.c
@@ -29,8 +29,7 @@ static List* gReaders = NULL;
 
 static Spinlock gReadersLock;
 
-void initializeMouse()
-{
+void initializeMouse() {
     Device device;
     memset((uint8*)&device, 0, sizeof(Device));
     strcpy(device.name, "psaux");
@@ -63,8 +62,7 @@ void initializeMouse()
     writeMouse(0xF4); //0xF4: Enable Packet Streaming
 }
 
-static BOOL mouse_open(File *file, uint32 flags)
-{
+static BOOL mouse_open(File *file, uint32 flags) {
     FifoBuffer* fifo = FifoBuffer_create(60);
 
     file->privateData = (void*)fifo;
@@ -78,8 +76,7 @@ static BOOL mouse_open(File *file, uint32 flags)
     return TRUE;
 }
 
-static void mouse_close(File *file)
-{
+static void mouse_close(File *file) {
     Spinlock_Lock(&gReadersLock);
 
     List_RemoveFirstOccurrence(gReaders, file);
@@ -91,12 +88,10 @@ static void mouse_close(File *file)
     FifoBuffer_destroy(fifo);
 }
 
-static int32 mouse_read(File *file, uint32 size, uint8 *buffer)
-{
+static int32 mouse_read(File *file, uint32 size, uint8 *buffer) {
     FifoBuffer* fifo = (FifoBuffer*)file->privateData;
 
-    while (FifoBuffer_getSize(fifo) < MOUSE_PACKET_SIZE)
-    {
+    while (FifoBuffer_getSize(fifo) < MOUSE_PACKET_SIZE) {
         file->thread->state = TS_WAITIO;
         file->thread->state_privateData = mouse_read;
         enableInterrupts();
@@ -114,36 +109,31 @@ static int32 mouse_read(File *file, uint32 size, uint8 *buffer)
     return smaller;
 }
 
-static void prepareForRead()
-{
+static void prepareForRead() {
     //https://wiki.osdev.org/Mouse_Input
     //Bytes cannot be read from port 0x60 until bit 0 (value=1) of port 0x64 is set
 
     int32 tryCount = 1000;
 
     uint8 data = 0;
-    do
-    {
+    do {
         data = inb(0x64);
     } while (((data & 0x01) == 0) && --tryCount > 0);
 }
 
-static void prepareForWrite()
-{
+static void prepareForWrite() {
     //https://wiki.osdev.org/Mouse_Input
     //All output to port 0x60 or 0x64 must be preceded by waiting for bit 1 (value=2) of port 0x64 to become clear
 
     int32 tryCount = 1000;
 
     uint8 data = 0;
-    do
-    {
+    do {
         data = inb(0x64);
     } while (((data & 0x02) != 0) && --tryCount > 0);
 }
 
-static void writeMouse(uint8 data)
-{
+static void writeMouse(uint8 data) {
     prepareForWrite();
 
     outb(0x64, 0xD4);
@@ -153,15 +143,13 @@ static void writeMouse(uint8 data)
     outb(0x60, data);
 }
 
-static void handleMouseInterrupt(Registers *regs)
-{
+static void handleMouseInterrupt(Registers *regs) {
     uint8 status = 0;
     //0x20 (5th bit is mouse bit)
     //read from 0x64, if its mouse bit is 1 then data is available at 0x60!
 
     int32 tryCount = 1000;
-    do
-    {
+    do {
         status = inb(0x64);
     } while (((status & 0x20) == 0) && --tryCount > 0);
 
@@ -171,25 +159,21 @@ static void handleMouseInterrupt(Registers *regs)
 
     gMouseByteCounter += 1;
 
-    if (gMouseByteCounter == MOUSE_PACKET_SIZE)
-    {
+    if (gMouseByteCounter == MOUSE_PACKET_SIZE) {
         gMouseByteCounter = 0;
 
         Spinlock_Lock(&gReadersLock);
 
         //Wake readers
-        List_Foreach(n, gReaders)
-        {
+        List_Foreach(n, gReaders) {
             File* file = n->data;
 
             FifoBuffer* fifo = (FifoBuffer*)file->privateData;
 
             FifoBuffer_enqueue(fifo, gMousePacket, MOUSE_PACKET_SIZE);
 
-            if (file->thread->state == TS_WAITIO)
-            {
-                if (file->thread->state_privateData == mouse_read)
-                {
+            if (file->thread->state == TS_WAITIO) {
+                if (file->thread->state_privateData == mouse_read) {
                     file->thread->state = TS_RUN;
                     file->thread->state_privateData = NULL;
                 }
diff --git a/kernel.soso/multiboot.h b/kernel.soso/multiboot.h
index 9dbda630..d42e6ef8 100644
--- a/kernel.soso/multiboot.h
+++ b/kernel.soso/multiboot.h
@@ -7,8 +7,7 @@
 #define MULTIBOOT_FRAMEBUFFER_TYPE_RGB      1
 #define MULTIBOOT_FRAMEBUFFER_TYPE_EGA_TEXT 2
 
-struct Multiboot
-{
+struct Multiboot {
     uint32 flags;
     uint32 mem_lower;
     uint32 mem_upper;
diff --git a/kernel.soso/null.c b/kernel.soso/null.c
index adfb28df..aef2861c 100644
--- a/kernel.soso/null.c
+++ b/kernel.soso/null.c
@@ -5,8 +5,7 @@
 
 static BOOL null_open(File *file, uint32 flags);
 
-void initializeNull()
-{
+void initializeNull() {
     Device device;
     memset((uint8*)&device, 0, sizeof(Device));
     strcpy(device.name, "null");
@@ -16,7 +15,6 @@ void initializeNull()
     registerDevice(&device);
 }
 
-static BOOL null_open(File *file, uint32 flags)
-{
+static BOOL null_open(File *file, uint32 flags) {
     return TRUE;
 }
diff --git a/kernel.soso/pipe.c b/kernel.soso/pipe.c
index 35fde82f..7141305c 100644
--- a/kernel.soso/pipe.c
+++ b/kernel.soso/pipe.c
@@ -10,8 +10,7 @@ static FileSystemNode* gPipesRoot = NULL;
 
 static FileSystemDirent gDirent;
 
-typedef struct Pipe
-{
+typedef struct Pipe {
     char name[32];
     FifoBuffer* buffer;
     FileSystemNode* fsNode;
@@ -22,39 +21,32 @@ static BOOL pipes_open(File *file, uint32 flags);
 static FileSystemDirent *pipes_readdir(FileSystemNode *node, uint32 index);
 static FileSystemNode *pipes_finddir(FileSystemNode *node, char *name);
 
-void initializePipes()
-{
+void initializePipes() {
     gPipeList = List_Create();
 
     gPipesRoot = getFileSystemNode("/system/pipes");
 
-    if (NULL == gPipesRoot)
-    {
+    if (NULL == gPipesRoot) {
         WARNING("/system/pipes not found!!");
     }
-    else
-    {
+    else {
         gPipesRoot->open = pipes_open;
         gPipesRoot->finddir = pipes_finddir;
         gPipesRoot->readdir = pipes_readdir;
     }
 }
 
-static BOOL pipes_open(File *file, uint32 flags)
-{
+static BOOL pipes_open(File *file, uint32 flags) {
     return TRUE;
 }
 
-static FileSystemDirent *pipes_readdir(FileSystemNode *node, uint32 index)
-{
+static FileSystemDirent *pipes_readdir(FileSystemNode *node, uint32 index) {
     int counter = 0;
 
-    List_Foreach (n, gPipeList)
-    {
+    List_Foreach (n, gPipeList) {
         Pipe* p = (Pipe*)n->data;
 
-        if (counter == index)
-        {
+        if (counter == index) {
             strcpy(gDirent.name, p->name);
             gDirent.fileType = FT_Pipe;
 
@@ -66,14 +58,11 @@ static FileSystemDirent *pipes_readdir(FileSystemNode *node, uint32 index)
     return NULL;
 }
 
-static FileSystemNode *pipes_finddir(FileSystemNode *node, char *name)
-{
-    List_Foreach (n, gPipeList)
-    {
+static FileSystemNode *pipes_finddir(FileSystemNode *node, char *name) {
+    List_Foreach (n, gPipeList) {
         Pipe* p = (Pipe*)n->data;
 
-        if (strcmp(name, p->name) == 0)
-        {
+        if (strcmp(name, p->name) == 0) {
             return p->fsNode;
         }
     }
@@ -81,8 +70,7 @@ static FileSystemNode *pipes_finddir(FileSystemNode *node, char *name)
     return NULL;
 }
 
-static BOOL pipe_open(File *file, uint32 flags)
-{
+static BOOL pipe_open(File *file, uint32 flags) {
     beginCriticalSection();
 
     Pipe* pipe = file->node->privateNodeData;
@@ -94,8 +82,7 @@ static BOOL pipe_open(File *file, uint32 flags)
     return TRUE;
 }
 
-static void pipe_close(File *file)
-{
+static void pipe_close(File *file) {
     beginCriticalSection();
 
     Pipe* pipe = file->node->privateNodeData;
@@ -105,12 +92,10 @@ static void pipe_close(File *file)
     endCriticalSection();
 }
 
-static void blockAccessingThreads(Pipe* pipe)
-{
+static void blockAccessingThreads(Pipe* pipe) {
     disableInterrupts();
 
-    List_Foreach (n, pipe->accessingThreads)
-    {
+    List_Foreach (n, pipe->accessingThreads) {
         Thread* reader = n->data;
 
         reader->state = TS_WAITIO;
@@ -123,18 +108,14 @@ static void blockAccessingThreads(Pipe* pipe)
     halt();
 }
 
-static void wakeupAccessingThreads(Pipe* pipe)
-{
+static void wakeupAccessingThreads(Pipe* pipe) {
     beginCriticalSection();
 
-    List_Foreach (n, pipe->accessingThreads)
-    {
+    List_Foreach (n, pipe->accessingThreads) {
         Thread* reader = n->data;
 
-        if (reader->state == TS_WAITIO)
-        {
-            if (reader->state_privateData == pipe)
-            {
+        if (reader->state == TS_WAITIO) {
+            if (reader->state_privateData == pipe) {
                 reader->state = TS_RUN;
             }
         }
@@ -143,18 +124,15 @@ static void wakeupAccessingThreads(Pipe* pipe)
     endCriticalSection();
 }
 
-static int32 pipe_read(File *file, uint32 size, uint8 *buffer)
-{
-    if (0 == size || NULL == buffer)
-    {
+static int32 pipe_read(File *file, uint32 size, uint8 *buffer) {
+    if (0 == size || NULL == buffer) {
         return -1;
     }
 
     Pipe* pipe = file->node->privateNodeData;
 
     uint32 used = 0;
-    while ((used = FifoBuffer_getSize(pipe->buffer)) < size)
-    {
+    while ((used = FifoBuffer_getSize(pipe->buffer)) < size) {
         blockAccessingThreads(pipe);
     }
 
@@ -167,18 +145,15 @@ static int32 pipe_read(File *file, uint32 size, uint8 *buffer)
     return readBytes;
 }
 
-static int32 pipe_write(File *file, uint32 size, uint8 *buffer)
-{
-    if (0 == size || NULL == buffer)
-    {
+static int32 pipe_write(File *file, uint32 size, uint8 *buffer) {
+    if (0 == size || NULL == buffer) {
         return -1;
     }
 
     Pipe* pipe = file->node->privateNodeData;
 
     uint32 free = 0;
-    while ((free = FifoBuffer_getFree(pipe->buffer)) < size)
-    {
+    while ((free = FifoBuffer_getFree(pipe->buffer)) < size) {
         blockAccessingThreads(pipe);
     }
 
@@ -191,13 +166,10 @@ static int32 pipe_write(File *file, uint32 size, uint8 *buffer)
     return bytesWritten;
 }
 
-BOOL createPipe(const char* name, uint32 bufferSize)
-{
-    List_Foreach (n, gPipeList)
-    {
+BOOL createPipe(const char* name, uint32 bufferSize) {
+    List_Foreach (n, gPipeList) {
         Pipe* p = (Pipe*)n->data;
-        if (strcmp(name, p->name) == 0)
-        {
+        if (strcmp(name, p->name) == 0) {
             return FALSE;
         }
     }
@@ -223,13 +195,10 @@ BOOL createPipe(const char* name, uint32 bufferSize)
     return TRUE;
 }
 
-BOOL destroyPipe(const char* name)
-{
-    List_Foreach (n, gPipeList)
-    {
+BOOL destroyPipe(const char* name) {
+    List_Foreach (n, gPipeList) {
         Pipe* p = (Pipe*)n->data;
-        if (strcmp(name, p->name) == 0)
-        {
+        if (strcmp(name, p->name) == 0) {
             List_RemoveFirstOccurrence(gPipeList, p);
             FifoBuffer_destroy(p->buffer);
             List_Destroy(p->accessingThreads);
@@ -243,13 +212,10 @@ BOOL destroyPipe(const char* name)
     return FALSE;
 }
 
-BOOL existsPipe(const char* name)
-{
-    List_Foreach (n, gPipeList)
-    {
+BOOL existsPipe(const char* name) {
+    List_Foreach (n, gPipeList) {
         Pipe* p = (Pipe*)n->data;
-        if (strcmp(name, p->name) == 0)
-        {
+        if (strcmp(name, p->name) == 0) {
             return TRUE;
         }
     }
diff --git a/kernel.soso/process.c b/kernel.soso/process.c
index b57ada46..e1088bd8 100644
--- a/kernel.soso/process.c
+++ b/kernel.soso/process.c
@@ -27,23 +27,19 @@ uint32 gLastUptimeSeconds = 0;
 
 extern Tss gTss;
 
-uint32 generateProcessId()
-{
+uint32 generateProcessId() {
     return gProcessIdGenerator++;
 }
 
-uint32 generateThreadId()
-{
+uint32 generateThreadId() {
     return gThreadIdGenerator++;
 }
 
-uint32 getSystemContextSwitchCount()
-{
+uint32 getSystemContextSwitchCount() {
     return gSystemContextSwitchCount;
 }
 
-void initializeTasking()
-{
+void initializeTasking() {
     Process* process = (Process*)kmalloc(sizeof(Process));
     memset((uint8*)process, 0, sizeof(Process));
     strcpy(process->name, "[kernel]");
@@ -88,31 +84,26 @@ void initializeTasking()
     gCurrentThread = thread;
 }
 
-static int getStringArrayItemCount(char *const array[])
-{
-    if (NULL == array)
-    {
+static int getStringArrayItemCount(char *const array[]) {
+    if (NULL == array) {
         return 0;
     }
 
     int i = 0;
     const char* a = array[0];
-    while (NULL != a)
-    {
+    while (NULL != a) {
         a = array[++i];
     }
 
     return i;
 }
 
-static char** cloneStringArray(char *const array[])
-{
+static char** cloneStringArray(char *const array[]) {
     int itemCount = getStringArrayItemCount(array);
 
     char** newArray = kmalloc(sizeof(char*) * (itemCount + 1));
 
-    for (int i = 0; i < itemCount; ++i)
-    {
+    for (int i = 0; i < itemCount; ++i) {
         const char* str = array[i];
         int len = strlen(str);
 
@@ -127,14 +118,12 @@ static char** cloneStringArray(char *const array[])
     return newArray;
 }
 
-static void destroyStringArray(char** array)
-{
+static void destroyStringArray(char** array) {
     char* a = array[0];
 
     int i = 0;
 
-    while (NULL != a)
-    {
+    while (NULL != a) {
         kfree(a);
 
         a = array[++i];
@@ -144,8 +133,7 @@ static void destroyStringArray(char** array)
 }
 
 //This function must be called within the correct page directory for target process
-static void copyArgvEnvToProcess(char *const argv[], char *const envp[])
-{
+static void copyArgvEnvToProcess(char *const argv[], char *const envp[]) {
     char** destination = (char**)USER_ARGV_ENV_LOC;
     int destinationIndex = 0;
 
@@ -160,8 +148,7 @@ static void copyArgvEnvToProcess(char *const argv[], char *const envp[])
 
     //printkf("ARGVENV: stringTable:%x\n", stringTable);
 
-    for (int i = 0; i < argvCount; ++i)
-    {
+    for (int i = 0; i < argvCount; ++i) {
         strcpy(stringTable, argv[i]);
 
         destination[destinationIndex] = stringTable;
@@ -173,8 +160,7 @@ static void copyArgvEnvToProcess(char *const argv[], char *const envp[])
 
     destination[destinationIndex++] = NULL;
 
-    for (int i = 0; i < envpCount; ++i)
-    {
+    for (int i = 0; i < envpCount; ++i) {
         strcpy(stringTable, envp[i]);
 
         destination[destinationIndex] = stringTable;
@@ -187,21 +173,17 @@ static void copyArgvEnvToProcess(char *const argv[], char *const envp[])
     destination[destinationIndex++] = NULL;
 }
 
-Process* createUserProcessFromElfData(const char* name, uint8* elfData, char *const argv[], char *const envp[], Process* parent, FileSystemNode* tty)
-{
+Process* createUserProcessFromElfData(const char* name, uint8* elfData, char *const argv[], char *const envp[], Process* parent, FileSystemNode* tty) {
     return createUserProcessEx(name, generateProcessId(), generateThreadId(), NULL, elfData, argv, envp, parent, tty);
 }
 
-Process* createUserProcessEx(const char* name, uint32 processId, uint32 threadId, Function0 func, uint8* elfData, char *const argv[], char *const envp[], Process* parent, FileSystemNode* tty)
-{
+Process* createUserProcessEx(const char* name, uint32 processId, uint32 threadId, Function0 func, uint8* elfData, char *const argv[], char *const envp[], Process* parent, FileSystemNode* tty) {
     printkf("createUserProcessEx: %s %d %d\n", name, processId, threadId);
-    if (0 == processId)
-    {
+    if (0 == processId) {
         processId = generateProcessId();
     }
 
-    if (0 == threadId)
-    {
+    if (0 == threadId) {
         threadId = generateThreadId();
     }
 
@@ -231,8 +213,7 @@ Process* createUserProcessEx(const char* name, uint32 processId, uint32 threadId
     //Since stack grows backwards, we must allocate previous page. So lets substract a small amount.
     uint32 stackp = USER_STACK-4;
 
-    if (parent)
-    {
+    if (parent) {
         process->parent = parent;
 
         process->workingDirectory = parent->workingDirectory;
@@ -240,8 +221,7 @@ Process* createUserProcessEx(const char* name, uint32 processId, uint32 threadId
         process->tty = parent->tty;
     }
 
-    if (tty)
-    {
+    if (tty) {
         process->tty = tty;
     }
 
@@ -284,20 +264,17 @@ Process* createUserProcessEx(const char* name, uint32 processId, uint32 threadId
 
     Thread* p = gCurrentThread;
 
-    while (p->next != NULL)
-    {
+    while (p->next != NULL) {
         p = p->next;
     }
 
     p->next = thread;
 
-    if (elfData)
-    {
+    if (elfData) {
         printkf("about to load ELF data\n");
         uint32 startLocation = loadElf((char*)elfData);
 
-        if (startLocation > 0)
-        {
+        if (startLocation > 0) {
             thread->regs.eip = startLocation;
         }
     }
@@ -314,14 +291,12 @@ Process* createUserProcessEx(const char* name, uint32 processId, uint32 threadId
 }
 
 //This function should be called in interrupts disabled state
-void destroyThread(Thread* thread)
-{
+void destroyThread(Thread* thread) {
     Spinlock_Lock(&(thread->messageQueueLock));
 
     //TODO: signal the process somehow
     Thread* previousThread = getPreviousThread(thread);
-    if (NULL != previousThread)
-    {
+    if (NULL != previousThread) {
         previousThread->next = thread->next;
 
         kfree((void*)thread->kstack.stackStart);
@@ -332,29 +307,23 @@ void destroyThread(Thread* thread)
 
         kfree(thread);
 
-        if (thread == gCurrentThread)
-        {
+        if (thread == gCurrentThread) {
             gCurrentThread = NULL;
         }
     }
-    else
-    {
+    else {
         printkf("Could not find previous thread for thread %d\n", thread->threadId);
         PANIC("This should not be happened!\n");
     }
 }
 
 //This function should be called in interrupts disabled state
-void destroyProcess(Process* process)
-{
+void destroyProcess(Process* process) {
     Thread* thread = gFirstThread;
     Thread* previous = NULL;
-    while (thread)
-    {
-        if (process == thread->owner)
-        {
-            if (NULL != previous)
-            {
+    while (thread) {
+        if (process == thread->owner) {
+            if (NULL != previous) {
                 previous->next = thread->next;
 
                 kfree((void*)thread->kstack.stackStart);
@@ -366,8 +335,7 @@ void destroyProcess(Process* process)
 
                 kfree(thread);
 
-                if (thread == gCurrentThread)
-                {
+                if (thread == gCurrentThread) {
                     gCurrentThread = NULL;
                 }
 
@@ -381,23 +349,17 @@ void destroyProcess(Process* process)
     }
 
     //Cleanup opened files
-    for (int i = 0; i < MAX_OPENED_FILES; ++i)
-    {
-        if (process->fd[i] != NULL)
-        {
+    for (int i = 0; i < MAX_OPENED_FILES; ++i) {
+        if (process->fd[i] != NULL) {
             close_fs(process->fd[i]);
         }
     }
 
-    if (process->parent)
-    {
+    if (process->parent) {
         thread = gFirstThread;
-        while (thread)
-        {
-            if (process->parent == thread->owner)
-            {
-                if (thread->state == TS_WAITCHILD)
-                {
+        while (thread) {
+            if (process->parent == thread->owner) {
+                if (thread->state == TS_WAITCHILD) {
                     thread->state = TS_RUN;
                 }
             }
@@ -412,22 +374,18 @@ void destroyProcess(Process* process)
     kfree(process);
 }
 
-void threadStateToString(ThreadState state, uint8* buffer, uint32 bufferSize)
-{
-    if (bufferSize < 1)
-    {
+void threadStateToString(ThreadState state, uint8* buffer, uint32 bufferSize) {
+    if (bufferSize < 1) {
         return;
     }
 
     buffer[0] = '\0';
 
-    if (bufferSize < 10)
-    {
+    if (bufferSize < 10) {
         return;
     }
 
-    switch (state)
-    {
+    switch (state) {
     case TS_RUN:
         strcpy((char*)buffer, "run");
         break;
@@ -451,41 +409,34 @@ void threadStateToString(ThreadState state, uint8* buffer, uint32 bufferSize)
     }
 }
 
-void waitForSchedule()
-{
+void waitForSchedule() {
     //printkf("Waiting for a schedule()\n");
 
     enableInterrupts();
-    while (TRUE)
-    {
+    while (TRUE) {
         halt();
     }
     disableInterrupts();
     PANIC("waitForSchedule(): Should not be reached here!!!\n");
 }
 
-void yield(uint32 count)
-{
+void yield(uint32 count) {
     gCurrentThread->yield = count;
     gCurrentThread->state = TS_YIELD;
     enableInterrupts();
-    while (gCurrentThread->yield > 0)
-    {
+    while (gCurrentThread->yield > 0) {
         halt();
     }
     disableInterrupts();
 }
 
-int32 getEmptyFd(Process* process)
-{
+int32 getEmptyFd(Process* process) {
     int32 result = -1;
 
     beginCriticalSection();
 
-    for (int i = 0; i < MAX_OPENED_FILES; ++i)
-    {
-        if (process->fd[i] == NULL)
-        {
+    for (int i = 0; i < MAX_OPENED_FILES; ++i) {
+        if (process->fd[i] == NULL) {
             result = i;
             break;
         }
@@ -496,19 +447,16 @@ int32 getEmptyFd(Process* process)
     return result;
 }
 
-int32 addFileToProcess(Process* process, File* file)
-{
+int32 addFileToProcess(Process* process, File* file) {
     int32 result = -1;
 
     beginCriticalSection();
 
     //printkf("addFileToProcess: pid:%d\n", process->pid);
 
-    for (int i = 0; i < MAX_OPENED_FILES; ++i)
-    {
+    for (int i = 0; i < MAX_OPENED_FILES; ++i) {
         //printkf("addFileToProcess: i:%d fd[%d]:%x\n", i, i, process->fd[i]);
-        if (process->fd[i] == NULL)
-        {
+        if (process->fd[i] == NULL) {
             result = i;
             file->fd = i;
             process->fd[i] = file;
@@ -521,16 +469,13 @@ int32 addFileToProcess(Process* process, File* file)
     return result;
 }
 
-int32 removeFileFromProcess(Process* process, File* file)
-{
+int32 removeFileFromProcess(Process* process, File* file) {
     int32 result = -1;
 
     beginCriticalSection();
 
-    for (int i = 0; i < MAX_OPENED_FILES; ++i)
-    {
-        if (process->fd[i] == file)
-        {
+    for (int i = 0; i < MAX_OPENED_FILES; ++i) {
+        if (process->fd[i] == file) {
             result = i;
             process->fd[i] = NULL;
             break;
@@ -542,14 +487,11 @@ int32 removeFileFromProcess(Process* process, File* file)
     return result;
 }
 
-Thread* getThreadById(uint32 threadId)
-{
+Thread* getThreadById(uint32 threadId) {
     Thread* p = gFirstThread;
 
-    while (p != NULL)
-    {
-        if (p->threadId == threadId)
-        {
+    while (p != NULL) {
+        if (p->threadId == threadId) {
             return p;
         }
         p = p->next;
@@ -558,14 +500,11 @@ Thread* getThreadById(uint32 threadId)
     return NULL;
 }
 
-Thread* getPreviousThread(Thread* thread)
-{
+Thread* getPreviousThread(Thread* thread) {
     Thread* t = gFirstThread;
 
-    while (t->next != NULL)
-    {
-        if (t->next == thread)
-        {
+    while (t->next != NULL) {
+        if (t->next == thread) {
             return t;
         }
         t = t->next;
@@ -574,24 +513,19 @@ Thread* getPreviousThread(Thread* thread)
     return NULL;
 }
 
-Thread* getMainKernelThread()
-{
+Thread* getMainKernelThread() {
     return gFirstThread;
 }
 
-Thread* getCurrentThread()
-{
+Thread* getCurrentThread() {
     return gCurrentThread;
 }
 
-BOOL isThreadValid(Thread* thread)
-{
+BOOL isThreadValid(Thread* thread) {
     Thread* p = gFirstThread;
 
-    while (p != NULL)
-    {
-        if (p == thread)
-        {
+    while (p != NULL) {
+        if (p == thread) {
             return TRUE;
         }
         p = p->next;
@@ -600,14 +534,11 @@ BOOL isThreadValid(Thread* thread)
     return FALSE;
 }
 
-BOOL isProcessValid(Process* process)
-{
+BOOL isProcessValid(Process* process) {
     Thread* p = gFirstThread;
 
-    while (p != NULL)
-    {
-        if (p->owner == process)
-        {
+    while (p != NULL) {
+        if (p->owner == process) {
             return TRUE;
         }
         p = p->next;
@@ -618,18 +549,15 @@ BOOL isProcessValid(Process* process)
 
 static void switchToTask(Thread* current, int mode);
 
-static void updateMetrics(Thread* thread)
-{
+static void updateMetrics(Thread* thread) {
     uint32 seconds = getUptimeSeconds();
 
-    if (seconds > gLastUptimeSeconds)
-    {
+    if (seconds > gLastUptimeSeconds) {
         gLastUptimeSeconds = seconds;
 
         Thread* t = gFirstThread;
 
-        while (t != NULL)
-        {
+        while (t != NULL) {
             t->contextSwitchCount = t->totalContextSwitchCount - t->totalContextSwitchCountPrevious;
             t->totalContextSwitchCountPrevious = t->totalContextSwitchCount;
 
@@ -642,14 +570,11 @@ static void updateMetrics(Thread* thread)
     ++thread->totalContextSwitchCount;
 }
 
-void schedule(TimerInt_Registers* registers)
-{
+void schedule(TimerInt_Registers* registers) {
     Thread* current = gCurrentThread;
 
-    if (NULL != current)
-    {
-        if (current->next == NULL && current == gFirstThread)
-        {
+    if (NULL != current) {
+        if (current->next == NULL && current == gFirstThread) {
             //We are the only process, no need to schedule
             return;
         }
@@ -669,14 +594,12 @@ void schedule(TimerInt_Registers* registers)
         current->regs.fs = registers->fs;
         current->regs.gs = registers->gs;
 
-        if (current->regs.cs != 0x08)
-        {
+        if (current->regs.cs != 0x08) {
             //Debug_PrintF("schedule() - 2.1\n");
             current->regs.esp = registers->esp_if_privilege_change;
             current->regs.ss = registers->ss_if_privilege_change;
         }
-        else
-        {
+        else {
             //Debug_PrintF("schedule() - 2.2\n");
             current->regs.esp = registers->esp + 12;
             current->regs.ss = gTss.ss0;
@@ -687,48 +610,39 @@ void schedule(TimerInt_Registers* registers)
         current->kstack.esp0 = gTss.esp0;
 
         current = current->next;
-        while (NULL != current)
-        {
-            if (current->state == TS_YIELD)
-            {
-                if (current->yield > 0)
-                {
+        while (NULL != current) {
+            if (current->state == TS_YIELD) {
+                if (current->yield > 0) {
                     --current->yield;
                 }
 
-                if (current->yield == 0)
-                {
+                if (current->yield == 0) {
                     current->state = TS_RUN;
                 }
             }
 
-            if (current->state == TS_SLEEP)
-            {
+            if (current->state == TS_SLEEP) {
                 uint32 uptime = getUptimeMilliseconds();
                 uint32 target = (uint32)current->state_privateData;
 
-                if (uptime >= target)
-                {
+                if (uptime >= target) {
                     current->state = TS_RUN;
                     current->state_privateData = NULL;
                 }
             }
 
-            if (current->state == TS_RUN)
-            {
+            if (current->state == TS_RUN) {
                 break;
             }
             current = current->next;
         }
 
-        if (current == NULL)
-        {
+        if (current == NULL) {
             //reached last process returning to first
             current = gFirstThread;
         }
     }
-    else
-    {
+    else {
         //current is NULL. This means thread is destroyed, so start from the begining
 
         current = gFirstThread;
@@ -737,20 +651,17 @@ void schedule(TimerInt_Registers* registers)
     gCurrentThread = current;//Now gCurrentThread is the thread we are about to schedule to
 
     /*
-    if (gCurrentThread->threadId == 5)
-    {
+    if (gCurrentThread->threadId == 5) {
         printkf("I am scheduling to %d and its EIP is %x\n", gCurrentThread->threadId, gCurrentThread->regs.eip);
     }
     */
 
     updateMetrics(current);
 
-    if (current->regs.cs != 0x08)
-    {
+    if (current->regs.cs != 0x08) {
         switchToTask(current, USERMODE);
     }
-    else
-    {
+    else {
         switchToTask(current, KERNELMODE);
     }
 }
@@ -759,8 +670,7 @@ void schedule(TimerInt_Registers* registers)
 
 //The mode indicates whether this process was in user mode or kernel mode
 //When it was previously interrupted by the scheduler.
-static void switchToTask(Thread* current, int mode)
-{
+static void switchToTask(Thread* current, int mode) {
     uint32 kesp, eflags;
     uint16 kss, ss, cs;
 
@@ -772,13 +682,11 @@ static void switchToTask(Thread* current, int mode)
     cs = current->regs.cs;
     eflags = (current->regs.eflags | 0x200) & 0xFFFFBFFF;
 
-    if (mode == USERMODE)
-    {
+    if (mode == USERMODE) {
         kss = current->kstack.ss0;
         kesp = current->kstack.esp0;
     }
-    else
-    {
+    else {
         kss = current->regs.ss;
         kesp = current->regs.esp;
     }
diff --git a/kernel.soso/process.h b/kernel.soso/process.h
index 7f43c23e..a2979714 100644
--- a/kernel.soso/process.h
+++ b/kernel.soso/process.h
@@ -11,8 +11,7 @@
 #include "fifobuffer.h"
 #include "spinlock.h"
 
-typedef enum ThreadState
-{
+typedef enum ThreadState {
     TS_RUN,
     TS_WAITIO,
     TS_WAITCHILD,
@@ -21,8 +20,7 @@ typedef enum ThreadState
     TS_YIELD
 } ThreadState;
 
-struct Process
-{
+struct Process {
     char name[32];
 
     uint32 pid;
@@ -62,12 +60,10 @@ struct Process
 
 typedef struct Process Process;
 
-struct Thread
-{
+struct Thread {
     uint32 threadId;
 
-    struct
-    {
+    struct {
         uint32 eax, ecx, edx, ebx;
         uint32 esp, ebp, esi, edi;
         uint32 eip, eflags;
@@ -75,8 +71,7 @@ struct Thread
         uint32 cr3;
     } regs __attribute__ ((packed));
 
-    struct
-    {
+    struct {
         uint32 esp0;
         uint16 ss0;
         uint32 stackStart;
@@ -106,8 +101,7 @@ struct Thread
 
 typedef struct Thread Thread;
 
-typedef struct TimerInt_Registers
-{
+typedef struct TimerInt_Registers {
     uint32 gs, fs, es, ds;
     uint32 edi, esi, ebp, esp, ebx, edx, ecx, eax; //pushed by pushad
     uint32 eip, cs, eflags, esp_if_privilege_change, ss_if_privilege_change; //pushed by the CPU
diff --git a/kernel.soso/ramdisk.c b/kernel.soso/ramdisk.c
index d48e20ff..d092fc99 100644
--- a/kernel.soso/ramdisk.c
+++ b/kernel.soso/ramdisk.c
@@ -3,8 +3,7 @@
 #include "fs.h"
 #include "devfs.h"
 
-typedef struct Ramdisk
-{
+typedef struct Ramdisk {
     uint8* buffer;
     uint32 size;
 } Ramdisk;
@@ -17,8 +16,7 @@ static int32 readBlock(FileSystemNode* node, uint32 blockNumber, uint32 count, u
 static int32 writeBlock(FileSystemNode* node, uint32 blockNumber, uint32 count, uint8* buffer);
 static int32 ioctl(File *node, int32 request, void * argp);
 
-BOOL createRamdisk(const char* devName, uint32 size)
-{
+BOOL createRamdisk(const char* devName, uint32 size) {
     Ramdisk* ramdisk = kmalloc(sizeof(Ramdisk));
     ramdisk->size = size;
     ramdisk->buffer = kmalloc(size);
@@ -34,8 +32,7 @@ BOOL createRamdisk(const char* devName, uint32 size)
     device.ioctl = ioctl;
     device.privateData = ramdisk;
 
-    if (registerDevice(&device))
-    {
+    if (registerDevice(&device)) {
         return TRUE;
     }
 
@@ -45,24 +42,20 @@ BOOL createRamdisk(const char* devName, uint32 size)
     return FALSE;
 }
 
-static BOOL open(File *file, uint32 flags)
-{
+static BOOL open(File *file, uint32 flags) {
     return TRUE;
 }
 
-static void close(File *file)
-{
+static void close(File *file) {
 }
 
-static int32 readBlock(FileSystemNode* node, uint32 blockNumber, uint32 count, uint8* buffer)
-{
+static int32 readBlock(FileSystemNode* node, uint32 blockNumber, uint32 count, uint8* buffer) {
     Ramdisk* ramdisk = (Ramdisk*)node->privateNodeData;
 
     uint32 location = blockNumber * RAMDISK_BLOCKSIZE;
     uint32 size = count * RAMDISK_BLOCKSIZE;
 
-    if (location + size > ramdisk->size)
-    {
+    if (location + size > ramdisk->size) {
         return -1;
     }
 
@@ -75,15 +68,13 @@ static int32 readBlock(FileSystemNode* node, uint32 blockNumber, uint32 count, u
     return 0;
 }
 
-static int32 writeBlock(FileSystemNode* node, uint32 blockNumber, uint32 count, uint8* buffer)
-{
+static int32 writeBlock(FileSystemNode* node, uint32 blockNumber, uint32 count, uint8* buffer) {
     Ramdisk* ramdisk = (Ramdisk*)node->privateNodeData;
 
     uint32 location = blockNumber * RAMDISK_BLOCKSIZE;
     uint32 size = count * RAMDISK_BLOCKSIZE;
 
-    if (location + size > ramdisk->size)
-    {
+    if (location + size > ramdisk->size) {
         return -1;
     }
 
@@ -96,14 +87,12 @@ static int32 writeBlock(FileSystemNode* node, uint32 blockNumber, uint32 count,
     return 0;
 }
 
-static int32 ioctl(File *node, int32 request, void * argp)
-{
+static int32 ioctl(File *node, int32 request, void * argp) {
     Ramdisk* ramdisk = (Ramdisk*)node->node->privateNodeData;
 
     uint32* result = (uint32*)argp;
 
-    switch (request)
-    {
+    switch (request) {
     case IC_GetSectorCount:
         *result = ramdisk->size / RAMDISK_BLOCKSIZE;
         return 0;
diff --git a/kernel.soso/random.c b/kernel.soso/random.c
index 2238f1a1..c78501d8 100644
--- a/kernel.soso/random.c
+++ b/kernel.soso/random.c
@@ -8,8 +8,7 @@
 static BOOL random_open(File *file, uint32 flags);
 static int32 random_read(File *file, uint32 size, uint8 *buffer);
 
-void initializeRandom()
-{
+void initializeRandom() {
     Device device;
     memset((uint8*)&device, 0, sizeof(Device));
     strcpy(device.name, "random");
@@ -20,15 +19,12 @@ void initializeRandom()
     registerDevice(&device);
 }
 
-static BOOL random_open(File *file, uint32 flags)
-{
+static BOOL random_open(File *file, uint32 flags) {
     return TRUE;
 }
 
-static int32 random_read(File *file, uint32 size, uint8 *buffer)
-{
-    if (size == 0)
-    {
+static int32 random_read(File *file, uint32 size, uint8 *buffer) {
+    if (size == 0) {
         return 0;
     }
 
@@ -40,18 +36,15 @@ static int32 random_read(File *file, uint32 size, uint8 *buffer)
 
     uint32 number = rand();
 
-    if (size == 1)
-    {
+    if (size == 1) {
         *buffer = (uint8)number;
         return 1;
     }
-    else if (size == 2 || size == 3)
-    {
+    else if (size == 2 || size == 3) {
         *((uint16*)buffer) = (uint16)number;
         return 2;
     }
-    else if (size >= 4)
-    {
+    else if (size >= 4) {
         //printkf("random_read: buffer is %x, writing %x to buffer\n", buffer, number);
 
         *((uint32*)buffer) = number;
diff --git a/kernel.soso/rootfs.c b/kernel.soso/rootfs.c
index 49ddd70d..9104b01f 100644
--- a/kernel.soso/rootfs.c
+++ b/kernel.soso/rootfs.c
@@ -7,8 +7,7 @@ static FileSystemNode *rootfs_finddir(FileSystemNode *node, char *name);
 static struct FileSystemDirent *rootfs_readdir(FileSystemNode *node, uint32 index);
 static BOOL rootfs_mkdir(FileSystemNode *node, const char *name, uint32 flags);
 
-FileSystemNode* initializeRootFS()
-{
+FileSystemNode* initializeRootFS() {
     FileSystemNode* root = (FileSystemNode*)kmalloc(sizeof(FileSystemNode));
     memset((uint8*)root, 0, sizeof(FileSystemNode));
     root->nodeType = FT_Directory;
@@ -23,24 +22,19 @@ FileSystemNode* initializeRootFS()
 
 static FileSystemDirent gDirent;
 
-static BOOL rootfs_open(File *node, uint32 flags)
-{
+static BOOL rootfs_open(File *node, uint32 flags) {
     return TRUE;
 }
 
-static void rootfs_close(File *file)
-{
+static void rootfs_close(File *file) {
 
 }
 
-static struct FileSystemDirent *rootfs_readdir(FileSystemNode *node, uint32 index)
-{
+static struct FileSystemDirent *rootfs_readdir(FileSystemNode *node, uint32 index) {
     FileSystemNode *n = node->firstChild;
     uint32 i = 0;
-    while (NULL != n)
-    {
-        if (index == i)
-        {
+    while (NULL != n) {
+        if (index == i) {
             gDirent.fileType = n->nodeType;
             gDirent.inode = n->inode;
             strcpy(gDirent.name, n->name);
@@ -54,13 +48,10 @@ static struct FileSystemDirent *rootfs_readdir(FileSystemNode *node, uint32 inde
     return NULL;
 }
 
-static FileSystemNode *rootfs_finddir(FileSystemNode *node, char *name)
-{
+static FileSystemNode *rootfs_finddir(FileSystemNode *node, char *name) {
     FileSystemNode *n = node->firstChild;
-    while (NULL != n)
-    {
-        if (strcmp(name, n->name) == 0)
-        {
+    while (NULL != n) {
+        if (strcmp(name, n->name) == 0) {
             return n;
         }
         n = n->nextSibling;
@@ -69,13 +60,10 @@ static FileSystemNode *rootfs_finddir(FileSystemNode *node, char *name)
     return NULL;
 }
 
-static BOOL rootfs_mkdir(FileSystemNode *node, const char *name, uint32 flags)
-{
+static BOOL rootfs_mkdir(FileSystemNode *node, const char *name, uint32 flags) {
     FileSystemNode *n = node->firstChild;
-    while (NULL != n)
-    {
-        if (strcmp(name, n->name) == 0)
-        {
+    while (NULL != n) {
+        if (strcmp(name, n->name) == 0) {
             return FALSE;
         }
         n = n->nextSibling;
@@ -92,15 +80,12 @@ static BOOL rootfs_mkdir(FileSystemNode *node, const char *name, uint32 flags)
     newNode->mkdir = rootfs_mkdir;
     newNode->parent = node;
 
-    if (node->firstChild == NULL)
-    {
+    if (node->firstChild == NULL) {
         node->firstChild = newNode;
     }
-    else
-    {
+    else {
         FileSystemNode *n = node->firstChild;
-        while (NULL != n->nextSibling)
-        {
+        while (NULL != n->nextSibling) {
             n = n->nextSibling;
         }
         n->nextSibling = newNode;
diff --git a/kernel.soso/screen.c b/kernel.soso/screen.c
index 9613c304..b54bba83 100644
--- a/kernel.soso/screen.c
+++ b/kernel.soso/screen.c
@@ -11,51 +11,43 @@ static uint16 gCurrentLine = 0;
 static uint16 gCurrentColumn = 0;
 static uint8 gColor = 0x0A;
 
-void Screen_FlushFromTty(Tty* tty)
-{
+void Screen_FlushFromTty(Tty* tty) {
     memcpy(videoStart, tty->buffer, SCREEN_LINE_COUNT * SCREEN_COLUMN_COUNT * 2);
 
     Screen_MoveCursor(tty->currentLine, tty->currentColumn);
 }
 
-void Screen_Print(int row, int column, const char* text)
-{
+void Screen_Print(int row, int column, const char* text) {
     unsigned char * video = videoStart;
     
     video += (row * SCREEN_COLUMN_COUNT + column) * 2;
-    while(*text != 0)
-    {
+    while(*text != 0) {
         *video++ = *text++;
         *video++ = gColor;
     }
 }
 
-void Screen_SetActiveColor(uint8 color)
-{
+void Screen_SetActiveColor(uint8 color) {
     gColor = color;
 }
 
-void Screen_ApplyColor(uint8 color)
-{
+void Screen_ApplyColor(uint8 color) {
     gColor = color;
 
     unsigned char * video = videoStart;
     int i = 0;
 
-    for (i = 0; i < SCREEN_LINE_COUNT * SCREEN_COLUMN_COUNT; ++i)
-    {
+    for (i = 0; i < SCREEN_LINE_COUNT * SCREEN_COLUMN_COUNT; ++i) {
         video++;
         *video++ = gColor;
     }
 }
 
-void Screen_Clear()
-{
+void Screen_Clear() {
 	unsigned char * video = videoStart;
 	int i = 0;
     
-    for (i = 0; i < SCREEN_LINE_COUNT * SCREEN_COLUMN_COUNT; ++i)
-    {
+    for (i = 0; i < SCREEN_LINE_COUNT * SCREEN_COLUMN_COUNT; ++i) {
         *video++ = 0;
         *video++ = gColor;
     }
@@ -64,8 +56,7 @@ void Screen_Clear()
     gCurrentColumn = 0;
 }
 
-void Screen_MoveCursor(uint16 line, uint16 column)
-{
+void Screen_MoveCursor(uint16 line, uint16 column) {
    // The screen is 80 characters wide...
    uint16 cursorLocation = line * SCREEN_COLUMN_COUNT + column;
    outb(0x3D4, 14);                  // Tell the VGA board we are setting the high cursor byte.
@@ -77,23 +68,19 @@ void Screen_MoveCursor(uint16 line, uint16 column)
    gCurrentLine = line;
 }
 
-void Screen_SetCursorVisible(BOOL visible)
-{
+void Screen_SetCursorVisible(BOOL visible) {
     uint8 cursor = inb(0x3d5);
 
-    if (visible)
-    {
+    if (visible) {
         cursor &= ~0x20;//5th bit cleared when cursor visible
     }
-    else
-    {
+    else {
         cursor |= 0x20;//5th bit set when cursor invisible
     }
     outb(0x3D5, cursor);
 }
 
-void Screen_GetCursor(uint16* line, uint16* column)
-{
+void Screen_GetCursor(uint16* line, uint16* column) {
     *line = gCurrentLine;
     *column = gCurrentColumn;
 }
diff --git a/kernel.soso/serial.c b/kernel.soso/serial.c
index 6615d845..2aeb92f9 100644
--- a/kernel.soso/serial.c
+++ b/kernel.soso/serial.c
@@ -3,8 +3,7 @@
 
 #define PORT 0x3f8   //COM1
 
-void initializeSerial()
-{
+void initializeSerial() {
    outb(PORT + 1, 0x00);    // Disable all interrupts
    outb(PORT + 3, 0x80);    // Enable DLAB (set baud rate divisor)
    outb(PORT + 0, 0x03);    // Set divisor to 3 (lo byte) 38400 baud
@@ -14,32 +13,27 @@ void initializeSerial()
    outb(PORT + 4, 0x0B);    // IRQs enabled, RTS/DSR set
 }
 
-int serialReceived()
-{
+int serialReceived() {
    return inb(PORT + 5) & 1;
 }
 
-char readSerial()
-{
+char readSerial() {
    while (serialReceived() == 0);
 
    return inb(PORT);
 }
 
-int isTransmitEmpty()
-{
+int isTransmitEmpty() {
    return inb(PORT + 5) & 0x20;
 }
 
-void writeSerial(char a)
-{
+void writeSerial(char a) {
    while (isTransmitEmpty() == 0);
 
    outb(PORT,a);
 }
 
-void Serial_PrintF(const char *format, ...)
-{
+void Serial_PrintF(const char *format, ...) {
   char **arg = (char **) &format;
   char c;
   char buf[20];
@@ -48,17 +42,14 @@ void Serial_PrintF(const char *format, ...)
   __builtin_va_list vl;
   __builtin_va_start(vl, format);
 
-  while ((c = *format++) != 0)
-    {
+  while ((c = *format++) != 0) {
       if (c != '%')
         writeSerial(c);
-      else
-        {
+      else {
           char *p;
 
           c = *format++;
-          switch (c)
-            {
+          switch (c) {
             case 'x':
                buf[0] = '0';
                buf[1] = 'x';
diff --git a/kernel.soso/sharedmemory.c b/kernel.soso/sharedmemory.c
index 8a4e635a..8082d2a4 100644
--- a/kernel.soso/sharedmemory.c
+++ b/kernel.soso/sharedmemory.c
@@ -17,53 +17,45 @@ static BOOL sharedmemorydir_open(File *file, uint32 flags);
 static FileSystemDirent *sharedmemorydir_readdir(FileSystemNode *node, uint32 index);
 static FileSystemNode *sharedmemorydir_finddir(FileSystemNode *node, char *name);
 
-typedef struct SharedMemory
-{
+typedef struct SharedMemory {
     FileSystemNode* node;
     List* physicalAddressList;
     Spinlock physicalAddressListLock;
     //TODO: permissions
 } SharedMemory;
 
-void initializeSharedMemory()
-{
+void initializeSharedMemory() {
     Spinlock_Init(&gShmListLock);
 
     gShmList = List_Create();
 
     gShmRoot = getFileSystemNode("/system/shm");
 
-    if (NULL == gShmRoot)
-    {
+    if (NULL == gShmRoot) {
         WARNING("/system/shm not found!!");
     }
-    else
-    {
+    else {
         gShmRoot->open = sharedmemorydir_open;
         gShmRoot->finddir = sharedmemorydir_finddir;
         gShmRoot->readdir = sharedmemorydir_readdir;
     }
 }
 
-static BOOL sharedmemorydir_open(File *file, uint32 flags)
-{
+static BOOL sharedmemorydir_open(File *file, uint32 flags) {
     return TRUE;
 }
 
-static FileSystemDirent *sharedmemorydir_readdir(FileSystemNode *node, uint32 index)
-{
+static FileSystemDirent *sharedmemorydir_readdir(FileSystemNode *node, uint32 index) {
     FileSystemDirent* result = NULL;
 
     int counter = 0;
 
     Spinlock_Lock(&gShmListLock);
 
-    List_Foreach (n, gShmList)
-    {
+    List_Foreach (n, gShmList) {
         SharedMemory* p = (SharedMemory*)n->data;
 
-        if (counter == index)
-        {
+        if (counter == index) {
             strcpy(gDirent.name, p->node->name);
             gDirent.fileType = p->node->nodeType;
 
@@ -79,18 +71,15 @@ static FileSystemDirent *sharedmemorydir_readdir(FileSystemNode *node, uint32 in
     return result;
 }
 
-static FileSystemNode *sharedmemorydir_finddir(FileSystemNode *node, char *name)
-{
+static FileSystemNode *sharedmemorydir_finddir(FileSystemNode *node, char *name) {
     FileSystemNode* result = NULL;
 
     Spinlock_Lock(&gShmListLock);
 
-    List_Foreach (n, gShmList)
-    {
+    List_Foreach (n, gShmList) {
         SharedMemory* p = (SharedMemory*)n->data;
 
-        if (strcmp(name, p->node->name) == 0)
-        {
+        if (strcmp(name, p->node->name) == 0) {
             result = p->node;
             break;
         }
@@ -101,27 +90,22 @@ static FileSystemNode *sharedmemorydir_finddir(FileSystemNode *node, char *name)
     return result;
 }
 
-static BOOL sharedmemory_open(File *file, uint32 flags)
-{
+static BOOL sharedmemory_open(File *file, uint32 flags) {
     return TRUE;
 }
 
-static void sharedmemory_unlink(File *file)
-{
+static void sharedmemory_unlink(File *file) {
     destroySharedMemory(file->node->name);
 }
 
-static int32 sharedmemory_ftruncate(File *file, int32 length)
-{
-    if (length <= 0)
-    {
+static int32 sharedmemory_ftruncate(File *file, int32 length) {
+    if (length <= 0) {
         return -1;
     }
 
     SharedMemory* sharedMem = (SharedMemory*)file->node->privateNodeData;
 
-    if (0 != file->node->length)
-    {
+    if (0 != file->node->length) {
         //already set
         return -1;
     }
@@ -130,8 +114,7 @@ static int32 sharedmemory_ftruncate(File *file, int32 length)
 
     Spinlock_Lock(&sharedMem->physicalAddressListLock);
 
-    for (int i = 0; i < pageCount; ++i)
-    {
+    for (int i = 0; i < pageCount; ++i) {
         char* pAddress = getPageFrame4M();
 
         List_Append(sharedMem->physicalAddressList, pAddress);
@@ -144,16 +127,14 @@ static int32 sharedmemory_ftruncate(File *file, int32 length)
     return 0;
 }
 
-static void* sharedmemory_mmap(File* file, uint32 size, uint32 offset, uint32 flags)
-{
+static void* sharedmemory_mmap(File* file, uint32 size, uint32 offset, uint32 flags) {
     void* result = NULL;
 
     SharedMemory* sharedMem = (SharedMemory*)file->node->privateNodeData;
 
     Spinlock_Lock(&sharedMem->physicalAddressListLock);
 
-    if (List_GetCount(sharedMem->physicalAddressList) > 0)
-    {
+    if (List_GetCount(sharedMem->physicalAddressList) > 0) {
         result = mapMemory(file->thread->owner, size, 0, sharedMem->physicalAddressList);
     }
 
@@ -162,18 +143,15 @@ static void* sharedmemory_mmap(File* file, uint32 size, uint32 offset, uint32 fl
     return result;
 }
 
-FileSystemNode* getSharedMemoryNode(const char* name)
-{
+FileSystemNode* getSharedMemoryNode(const char* name) {
     FileSystemNode* result = NULL;
 
     Spinlock_Lock(&gShmListLock);
 
-    List_Foreach (n, gShmList)
-    {
+    List_Foreach (n, gShmList) {
         SharedMemory* p = (SharedMemory*)n->data;
 
-        if (strcmp(name, p->node->name) == 0)
-        {
+        if (strcmp(name, p->node->name) == 0) {
             result = p->node;
             break;
         }
@@ -184,10 +162,8 @@ FileSystemNode* getSharedMemoryNode(const char* name)
     return result;
 }
 
-FileSystemNode* createSharedMemory(const char* name)
-{
-    if (getSharedMemoryNode(name) != NULL)
-    {
+FileSystemNode* createSharedMemory(const char* name) {
+    if (getSharedMemoryNode(name) != NULL) {
         return NULL;
     }
 
@@ -216,25 +192,21 @@ FileSystemNode* createSharedMemory(const char* name)
     return node;
 }
 
-void destroySharedMemory(const char* name)
-{
+void destroySharedMemory(const char* name) {
     SharedMemory* sharedMem = NULL;
 
     Spinlock_Lock(&gShmListLock);
 
-    List_Foreach (n, gShmList)
-    {
+    List_Foreach (n, gShmList) {
         SharedMemory* p = (SharedMemory*)n->data;
 
-        if (strcmp(name, p->node->name) == 0)
-        {
+        if (strcmp(name, p->node->name) == 0) {
             sharedMem = (SharedMemory*)p;
             break;
         }
     }
 
-    if (sharedMem)
-    {
+    if (sharedMem) {
         Spinlock_Lock(&sharedMem->physicalAddressListLock);
 
         kfree(sharedMem->node);
diff --git a/kernel.soso/sleep.c b/kernel.soso/sleep.c
index 2120a192..bc769698 100644
--- a/kernel.soso/sleep.c
+++ b/kernel.soso/sleep.c
@@ -1,8 +1,7 @@
 #include "sleep.h"
 #include "timer.h"
 
-void sleepMilliseconds(Thread* thread, uint32 ms)
-{
+void sleepMilliseconds(Thread* thread, uint32 ms) {
     uint32 uptime = getUptimeMilliseconds();
 
     //target uptime to wakeup
diff --git a/kernel.soso/spinlock.c b/kernel.soso/spinlock.c
index 1ef2be13..8efbdb20 100644
--- a/kernel.soso/spinlock.c
+++ b/kernel.soso/spinlock.c
@@ -1,7 +1,6 @@
 #include "spinlock.h"
 
-static inline int32 exchangeAtomic(volatile int32* oldValueAddress, int32 newValue)
-{
+static inline int32 exchangeAtomic(volatile int32* oldValueAddress, int32 newValue) {
     //no need to use lock instruction on xchg
 
     asm volatile ("xchgl %0, %1"
@@ -11,20 +10,16 @@ static inline int32 exchangeAtomic(volatile int32* oldValueAddress, int32 newVal
     return newValue;
 }
 
-void Spinlock_Init(Spinlock* spinlock)
-{
+void Spinlock_Init(Spinlock* spinlock) {
     *spinlock = 0;
 }
 
-void Spinlock_Lock(Spinlock* spinlock)
-{
-    while (exchangeAtomic((int32*)spinlock, 1))
-    {
+void Spinlock_Lock(Spinlock* spinlock) {
+    while (exchangeAtomic((int32*)spinlock, 1)) {
         halt();
     }
 }
 
-void Spinlock_Unlock(Spinlock* spinlock)
-{
+void Spinlock_Unlock(Spinlock* spinlock) {
     *spinlock = 0;
 }
diff --git a/kernel.soso/syscalls.c b/kernel.soso/syscalls.c
index d1e8ffd1..8b72941f 100644
--- a/kernel.soso/syscalls.c
+++ b/kernel.soso/syscalls.c
@@ -65,8 +65,7 @@ int syscall_posix_openpt(int flags);
 int syscall_ptsname_r(int fd, char *buf, int buflen);
 
 
-void initialiseSyscalls()
-{
+void initialiseSyscalls() {
     memset((uint8*)gSyscallTable, 0, sizeof(void*) * SYSCALL_COUNT);
 
     gSyscallTable[SYS_open] = syscall_open;
@@ -112,17 +111,14 @@ void initialiseSyscalls()
     registerInterruptHandler (0x80, &handleSyscall);
 }
 
-static void handleSyscall(Registers* regs)
-{
-    if (regs->eax >= SYSCALL_COUNT)
-    {
+static void handleSyscall(Registers* regs) {
+    if (regs->eax >= SYSCALL_COUNT) {
         return;
     }
 
     void *location = gSyscallTable[regs->eax];
 
-    if (NULL == location)
-    {
+    if (NULL == location) {
         regs->eax = -1;
         return;
     }
@@ -149,20 +145,16 @@ static void handleSyscall(Registers* regs)
     regs->eax = ret;
 }
 
-int syscall_open(const char *pathname, int flags)
-{
+int syscall_open(const char *pathname, int flags) {
     Process* process = getCurrentThread()->owner;
-    if (process)
-    {
+    if (process) {
         //printkf("open():[%s]\n", pathname);
         FileSystemNode* node = getFileSystemNodeAbsoluteOrRelative(pathname, process);
-        if (node)
-        {
+        if (node) {
             //printkf("open():node:[%s]\n", node->name);
             File* file = open_fs(node, flags);
 
-            if (file)
-            {
+            if (file) {
                 return file->fd;
             }
         }
@@ -171,52 +163,41 @@ int syscall_open(const char *pathname, int flags)
     return -1;
 }
 
-int syscall_close(int fd)
-{
+int syscall_close(int fd) {
     Process* process = getCurrentThread()->owner;
-    if (process)
-    {
-        if (fd < MAX_OPENED_FILES)
-        {
+    if (process) {
+        if (fd < MAX_OPENED_FILES) {
             File* file = process->fd[fd];
 
-            if (file)
-            {
+            if (file) {
                 close_fs(file);
 
                 return 0;
             }
-            else
-            {
+            else {
                 //TODO: error invalid fd
             }
         }
-        else
-        {
+        else {
             //TODO: error invalid fd
         }
     }
-    else
-    {
+    else {
         PANIC("Process is NULL!\n");
     }
 
     return -1;
 }
 
-int syscall_read(int fd, void *buf, int nbytes)
-{
+int syscall_read(int fd, void *buf, int nbytes) {
     //printkf("syscall_read: begin - nbytes:%d\n", nbytes);
 
     Process* process = getCurrentThread()->owner;
-    if (process)
-    {
-        if (fd < MAX_OPENED_FILES)
-        {
+    if (process) {
+        if (fd < MAX_OPENED_FILES) {
             File* file = process->fd[fd];
 
-            if (file)
-            {
+            if (file) {
                 //Debug_PrintF("syscall_read(%d): %s\n", process->pid, buf);
 
                 //enableInterrupts();
@@ -226,40 +207,32 @@ int syscall_read(int fd, void *buf, int nbytes)
 
                 return read_fs(file, nbytes, buf);
             }
-            else
-            {
+            else {
                 //TODO: error invalid fd
             }
         }
-        else
-        {
+        else {
             //TODO: error invalid fd
         }
     }
-    else
-    {
+    else {
         PANIC("Process is NULL!\n");
     }
 
     return -1;
 }
 
-int syscall_write(int fd, void *buf, int nbytes)
-{
+int syscall_write(int fd, void *buf, int nbytes) {
     Process* process = getCurrentThread()->owner;
-    if (process)
-    {
+    if (process) {
         //printkf("syscall_write() called from process: %d. fd:%d\n", process->pid, fd);
 
-        if (fd < MAX_OPENED_FILES)
-        {
+        if (fd < MAX_OPENED_FILES) {
             File* file = process->fd[fd];
 
-            if (file)
-            {
+            if (file) {
                 /*
-                for (int i = 0; i < nbytes; ++i)
-                {
+                for (int i = 0; i < nbytes; ++i) {
                     Debug_PrintF("pid:%d syscall_write:buf[%d]=%c\n", process->pid, i, ((char*)buf)[i]);
                 }
                 */
@@ -268,146 +241,116 @@ int syscall_write(int fd, void *buf, int nbytes)
 
                 return writeResult;
             }
-            else
-            {
+            else {
                 //TODO: error invalid fd
             }
         }
-        else
-        {
+        else {
             //TODO: error invalid fd
         }
     }
-    else
-    {
+    else {
         PANIC("Process is NULL!\n");
     }
 
     return -1;
 }
 
-int syscall_lseek(int fd, int offset, int whence)
-{
+int syscall_lseek(int fd, int offset, int whence) {
     Process* process = getCurrentThread()->owner;
-    if (process)
-    {
+    if (process) {
         //printkf("syscall_lseek() called from process: %d. fd:%d\n", process->pid, fd);
 
-        if (fd < MAX_OPENED_FILES)
-        {
+        if (fd < MAX_OPENED_FILES) {
             File* file = process->fd[fd];
 
-            if (file)
-            {
+            if (file) {
                 return lseek_fs(file, offset, whence);
             }
-            else
-            {
+            else {
                 //TODO: error invalid fd
             }
         }
-        else
-        {
+        else {
             //TODO: error invalid fd
         }
     }
-    else
-    {
+    else {
         PANIC("Process is NULL!\n");
     }
 
     return -1;
 }
 
-int syscall_stat(const char *path, struct stat *buf)
-{
+int syscall_stat(const char *path, struct stat *buf) {
     Process* process = getCurrentThread()->owner;
-    if (process)
-    {
+    if (process) {
         //printkf("syscall_stat() called from process: %d. path:%s\n", process->pid, path);
 
         FileSystemNode* node = getFileSystemNodeAbsoluteOrRelative(path, process);
 
-        if (node)
-        {
+        if (node) {
             return stat_fs(node, buf);
         }
     }
-    else
-    {
+    else {
         PANIC("Process is NULL!\n");
     }
 
     return -1;
 }
 
-int syscall_fstat(int fd, struct stat *buf)
-{
+int syscall_fstat(int fd, struct stat *buf) {
     Process* process = getCurrentThread()->owner;
-    if (process)
-    {
-        if (fd < MAX_OPENED_FILES)
-        {
+    if (process) {
+        if (fd < MAX_OPENED_FILES) {
             File* file = process->fd[fd];
 
-            if (file)
-            {
+            if (file) {
                 return stat_fs(file->node, buf);
             }
-            else
-            {
+            else {
                 //TODO: error invalid fd
             }
         }
-        else
-        {
+        else {
             //TODO: error invalid fd
         }
     }
-    else
-    {
+    else {
         PANIC("Process is NULL!\n");
     }
 
     return -1;
 }
 
-int syscall_ioctl(int fd, int32 request, void *arg)
-{
+int syscall_ioctl(int fd, int32 request, void *arg) {
     Process* process = getCurrentThread()->owner;
-    if (process)
-    {
-        if (fd < MAX_OPENED_FILES)
-        {
+    if (process) {
+        if (fd < MAX_OPENED_FILES) {
             File* file = process->fd[fd];
 
-            if (file)
-            {
+            if (file) {
                 return ioctl_fs(file, request, arg);
             }
-            else
-            {
+            else {
                 //TODO: error invalid fd
             }
         }
-        else
-        {
+        else {
             //TODO: error invalid fd
         }
     }
-    else
-    {
+    else {
         PANIC("Process is NULL!\n");
     }
 
     return -1;
 }
 
-int syscall_exit(int status)
-{
+int syscall_exit(int status) {
     Process* process = getCurrentThread()->owner;
-    if (process)
-    {
+    if (process) {
         printkf("syscall_exit(%d)\n", status);
         printkf("process pid: %d\n", process->pid);
         if (process->parent) {
@@ -422,47 +365,39 @@ int syscall_exit(int status)
 
         waitForSchedule();
     }
-    else
-    {
+    else {
         PANIC("Process is NULL!\n");
     }
 
     return -1;
 }
 
-void* syscall_sbrk(uint32 increment)
-{
+void* syscall_sbrk(uint32 increment) {
     //printkf("syscall_sbrk() !!! inc:%d\n", increment);
 
     Process* process = getCurrentThread()->owner;
-    if (process)
-    {
+    if (process) {
         return sbrk(process, increment);
     }
-    else
-    {
+    else {
         PANIC("Process is NULL!\n");
     }
 
     return (void*)-1;
 }
 
-int syscall_fork()
-{
+int syscall_fork() {
     //Not implemented
 
     return -1;
 }
 
-int syscall_getpid()
-{
+int syscall_getpid() {
     Process* process = getCurrentThread()->owner;
-    if (process)
-    {
+    if (process) {
         return process->pid;
     }
-    else
-    {
+    else {
         PANIC("Process is NULL!\n");
     }
 
@@ -470,21 +405,17 @@ int syscall_getpid()
 }
 
 //NON-posix
-int syscall_execute(const char *path, char *const argv[], char *const envp[])
-{
+int syscall_execute(const char *path, char *const argv[], char *const envp[]) {
     int result = -1;
 
     printkf("syscall_execute: %s\n", path);
     Process* process = getCurrentThread()->owner;
-    if (process)
-    {
+    if (process) {
         printkf("found current process\n");
         FileSystemNode* node = getFileSystemNodeAbsoluteOrRelative(path, process);
-        if (node)
-        {
+        if (node) {
             File* f = open_fs(node, 0);
-            if (f)
-            {
+            if (f) {
                 printkf("file found\n");
                 void* image = kmalloc(node->length);
 
@@ -494,13 +425,11 @@ int syscall_execute(const char *path, char *const argv[], char *const envp[])
 
                 //printkf("syscall_execute: read_fs returned %d bytes\n", bytesRead);
 
-                if (bytesRead > 0)
-                {
+                if (bytesRead > 0) {
                     printkf("creating user process from ELF data\n");
                     Process* newProcess = createUserProcessFromElfData("userProcess", image, argv, envp, process, NULL);
 
-                    if (newProcess)
-                    {
+                    if (newProcess) {
                         result = newProcess->pid;
                     }
                 }
@@ -511,28 +440,23 @@ int syscall_execute(const char *path, char *const argv[], char *const envp[])
 
         }
     }
-    else
-    {
+    else {
         PANIC("Process is NULL!\n");
     }
 
     return result;
 }
 
-int syscall_executeOnTTY(const char *path, char *const argv[], char *const envp[], const char *ttyPath)
-{
+int syscall_executeOnTTY(const char *path, char *const argv[], char *const envp[], const char *ttyPath) {
     int result = -1;
 
     Process* process = getCurrentThread()->owner;
-    if (process)
-    {
+    if (process) {
         FileSystemNode* node = getFileSystemNodeAbsoluteOrRelative(path, process);
         FileSystemNode* ttyNode = getFileSystemNodeAbsoluteOrRelative(ttyPath, process);
-        if (node && ttyNode)
-        {
+        if (node && ttyNode) {
             File* f = open_fs(node, 0);
-            if (f)
-            {
+            if (f) {
                 void* image = kmalloc(node->length);
 
                 //printkf("executing %s and its %d bytes\n", filename, node->length);
@@ -541,12 +465,10 @@ int syscall_executeOnTTY(const char *path, char *const argv[], char *const envp[
 
                 //printkf("syscall_execute: read_fs returned %d bytes\n", bytesRead);
 
-                if (bytesRead > 0)
-                {
+                if (bytesRead > 0) {
                     Process* newProcess = createUserProcessFromElfData("userProcess", image, argv, envp, process, ttyNode);
 
-                    if (newProcess)
-                    {
+                    if (newProcess) {
                         result = newProcess->pid;
                     }
                 }
@@ -557,28 +479,23 @@ int syscall_executeOnTTY(const char *path, char *const argv[], char *const envp[
 
         }
     }
-    else
-    {
+    else {
         PANIC("Process is NULL!\n");
     }
 
     return result;
 }
 
-int syscall_execve(const char *path, char *const argv[], char *const envp[])
-{
+int syscall_execve(const char *path, char *const argv[], char *const envp[]) {
     Process* callingProcess = getCurrentThread()->owner;
 
     FileSystemNode* node = getFileSystemNode(path);
-    if (node)
-    {
+    if (node) {
         File* f = open_fs(node, 0);
-        if (f)
-        {
+        if (f) {
             void* image = kmalloc(node->length);
 
-            if (read_fs(f, node->length, image) > 0)
-            {
+            if (read_fs(f, node->length, image) > 0) {
                 disableInterrupts(); //just in case if a file operation left interrupts enabled.
 
                 Process* newProcess = createUserProcessEx("fromExecve", callingProcess->pid, 0, NULL, image, argv, envp, NULL, callingProcess->tty);
@@ -587,8 +504,7 @@ int syscall_execve(const char *path, char *const argv[], char *const envp[])
 
                 kfree(image);
 
-                if (newProcess)
-                {
+                if (newProcess) {
                     destroyProcess(callingProcess);
 
                     waitForSchedule();
@@ -608,22 +524,18 @@ int syscall_execve(const char *path, char *const argv[], char *const envp[])
     return 0;
 }
 
-int syscall_wait(int *wstatus)
-{
+int syscall_wait(int *wstatus) {
     //TODO: return pid of exited child. implement with sendsignal
     Thread* currentThread = getCurrentThread();
 
     Process* process = currentThread->owner;
-    if (process)
-    {
+    if (process) {
         printkf("wait: I am %d at %x\n", process->pid, process);
         Thread* thread = getMainKernelThread();
-        while (thread)
-        {
+        while (thread) {
             printkf("wait: checking %d at %x\n", thread->owner->pid, thread->owner);
             printkf("wait: parent is %d at %x\n", thread->owner->parent->pid, thread->owner->parent);
-            if (process == thread->owner->parent)
-            {
+            if (process == thread->owner->parent) {
                 //We have a child process
                 printkf("wait: d\n");
 
@@ -642,35 +554,29 @@ int syscall_wait(int *wstatus)
             thread = thread->next;
         }
     }
-    else
-    {
+    else {
         PANIC("Process is NULL!\n");
     }
 
     return -1;
 }
 
-int syscall_kill(int pid, int sig)
-{
+int syscall_kill(int pid, int sig) {
     Process* selfProcess = getCurrentThread()->owner;
 
     Thread* thread = getMainKernelThread();
-    while (thread)
-    {
-        if (pid == thread->owner->pid)
-        {
+    while (thread) {
+        if (pid == thread->owner->pid) {
             //We have found the process
 
-            //TODOif (sig==KILL)
+            //TODO if (sig==KILL)
             {
                 destroyProcess(thread->owner);
 
-                if (thread->owner == selfProcess)
-                {
+                if (thread->owner == selfProcess) {
                     waitForSchedule();
                 }
-                else
-                {
+                else {
                     return 0;
                 }
             }
@@ -683,26 +589,21 @@ int syscall_kill(int pid, int sig)
     return -1;
 }
 
-int syscall_mount(const char *source, const char *target, const char *fsType, unsigned long flags, void *data)//non-posix
-{
+int syscall_mount(const char *source, const char *target, const char *fsType, unsigned long flags, void *data) {  // non-posix
     BOOL result = mountFileSystem(source, target, fsType, flags, data);
 
-    if (TRUE == result)
-    {
+    if (TRUE == result) {
         return 0;//on success
     }
 
     return -1;//on error
 }
 
-int syscall_unmount(const char *target)//non-posix
-{
+int syscall_unmount(const char *target) {  // non-posix
     FileSystemNode* targetNode = getFileSystemNode(target);
 
-    if (targetNode)
-    {
-        if (targetNode->nodeType == FT_MountPoint)
-        {
+    if (targetNode) {
+        if (targetNode->nodeType == FT_MountPoint) {
             targetNode->nodeType = FT_Directory;
 
             targetNode->mountPoint = NULL;
@@ -716,15 +617,12 @@ int syscall_unmount(const char *target)//non-posix
     return -1;//on error
 }
 
-int syscall_mkdir(const char *path, uint32 mode)
-{
+int syscall_mkdir(const char *path, uint32 mode) {
     char parentPath[128];
     const char* name = NULL;
     int length = strlen(path);
-    for (int i = length - 1; i >= 0; --i)
-    {
-        if (path[i] == '/')
-        {
+    for (int i = length - 1; i >= 0; --i) {
+        if (path[i] == '/') {
             name = path + i + 1;
             strncpy(parentPath, path, i);
             parentPath[i] = '\0';
@@ -732,14 +630,12 @@ int syscall_mkdir(const char *path, uint32 mode)
         }
     }
 
-    if (strlen(parentPath) == 0)
-    {
+    if (strlen(parentPath) == 0) {
         parentPath[0] = '/';
         parentPath[1] = '\0';
     }
 
-    if (strlen(name) == 0)
-    {
+    if (strlen(name) == 0) {
         return -1;
     }
 
@@ -747,11 +643,9 @@ int syscall_mkdir(const char *path, uint32 mode)
 
     FileSystemNode* targetNode = getFileSystemNode(parentPath);
 
-    if (targetNode)
-    {
+    if (targetNode) {
         BOOL success = mkdir_fs(targetNode, name, mode);
-        if (success)
-        {
+        if (success) {
             return 0;//on success
         }
     }
@@ -759,25 +653,20 @@ int syscall_mkdir(const char *path, uint32 mode)
     return -1;//on error
 }
 
-int syscall_rmdir(const char *path)
-{
+int syscall_rmdir(const char *path) {
     //TODO:
     //return 0;//on success
 
     return -1;//on error
 }
 
-int syscall_getdents(int fd, char *buf, int nbytes)
-{
+int syscall_getdents(int fd, char *buf, int nbytes) {
     Process* process = getCurrentThread()->owner;
-    if (process)
-    {
-        if (fd < MAX_OPENED_FILES)
-        {
+    if (process) {
+        if (fd < MAX_OPENED_FILES) {
             File* file = process->fd[fd];
 
-            if (file)
-            {
+            if (file) {
                 //printkf("syscall_getdents(%d): %s\n", process->pid, buf);
 
                 int byteCounter = 0;
@@ -785,8 +674,7 @@ int syscall_getdents(int fd, char *buf, int nbytes)
                 int index = 0;
                 FileSystemDirent* dirent = readdir_fs(file->node, index);
 
-                while (NULL != dirent && (byteCounter + sizeof(FileSystemDirent) <= nbytes))
-                {
+                while (NULL != dirent && (byteCounter + sizeof(FileSystemDirent) <= nbytes)) {
                     memcpy((uint8*)buf + byteCounter, (uint8*)dirent, sizeof(FileSystemDirent));
 
                     byteCounter += sizeof(FileSystemDirent);
@@ -797,108 +685,87 @@ int syscall_getdents(int fd, char *buf, int nbytes)
 
                 return byteCounter;
             }
-            else
-            {
+            else {
                 //TODO: error invalid fd
             }
         }
-        else
-        {
+        else {
             //TODO: error invalid fd
         }
     }
-    else
-    {
+    else {
         PANIC("Process is NULL!\n");
     }
 
     return -1;//on error
 }
 
-int syscall_readDir(int fd, void *dirent, int index)
-{
+int syscall_readDir(int fd, void *dirent, int index) {
     Process* process = getCurrentThread()->owner;
-    if (process)
-    {
-        if (fd < MAX_OPENED_FILES)
-        {
+    if (process) {
+        if (fd < MAX_OPENED_FILES) {
             File* file = process->fd[fd];
 
-            if (file)
-            {
+            if (file) {
                 FileSystemDirent* direntFs = readdir_fs(file->node, index);
 
-                if (direntFs)
-                {
+                if (direntFs) {
                     memcpy((uint8*)dirent, (uint8*)direntFs, sizeof(FileSystemDirent));
 
                     return 1;
                 }
             }
-            else
-            {
+            else {
                 //TODO: error invalid fd
             }
         }
-        else
-        {
+        else {
             //TODO: error invalid fd
         }
     }
-    else
-    {
+    else {
         PANIC("Process is NULL!\n");
     }
 
     return -1;//on error
 }
 
-int syscall_getWorkingDirectory(char *buf, int size)
-{
+int syscall_getWorkingDirectory(char *buf, int size) {
     Process* process = getCurrentThread()->owner;
-    if (process)
-    {
-        if (process->workingDirectory)
-        {
+    if (process) {
+        if (process->workingDirectory) {
             return getFileSystemNodePath(process->workingDirectory, buf, size);
         }
     }
-    else
-    {
+    else {
         PANIC("Process is NULL!\n");
     }
 
     return -1;//on error
 }
 
-int syscall_setWorkingDirectory(const char *path)
-{
+int syscall_setWorkingDirectory(const char *path) {
     Process* process = getCurrentThread()->owner;
-    if (process)
-    {
+    if (process) {
         FileSystemNode* node = getFileSystemNodeAbsoluteOrRelative(path, process);
 
-        if (node)
-        {
+        if (node) {
             process->workingDirectory = node;
 
             return 0; //success
         }
     }
-    else
-    {
+    else {
         PANIC("Process is NULL!\n");
     }
 
     return -1;//on error
 }
 
-int syscall_managePipe(const char *pipeName, int operation, int data)
-{
+int syscall_managePipe(const char *pipeName, int operation, int data) {
     int result = -1;
 
-    switch (operation)
-    {
+    switch (operation) {
     case 0:
         result = existsPipe(pipeName);
         break;
@@ -913,13 +780,11 @@ int syscall_managePipe(const char *pipeName, int operation, int data)
     return result;
 }
 
-int syscall_getUptimeMilliseconds()
-{
+int syscall_getUptimeMilliseconds() {
     return getUptimeMilliseconds();
 }
 
-int syscall_sleepMilliseconds(int ms)
-{
+int syscall_sleepMilliseconds(int ms) {
     Thread* thread = getCurrentThread();
 
     sleepMilliseconds(thread, (uint32)ms);
@@ -927,14 +792,12 @@ int syscall_sleepMilliseconds(int ms)
     return 0;
 }
 
-int syscall_manageMessage(int command, void* message)
-{
+int syscall_manageMessage(int command, void* message) {
     Thread* thread = getCurrentThread();
 
     int result = -1;
 
-    switch (command)
-    {
+    switch (command) {
     case 0:
         result = getMessageQueueCount(thread);
         break;
@@ -953,10 +816,8 @@ int syscall_manageMessage(int command, void* message)
     return result;
 }
 
-void* syscall_mmap(void *addr, int length, int flags, int fd, int offset)
-{
-    if (addr)
-    {
+void* syscall_mmap(void *addr, int length, int flags, int fd, int offset) {
+    if (addr) {
         //Mapping to a specified address is not implemented
 
         return (void*)-1;
@@ -964,71 +825,56 @@ void* syscall_mmap(void *addr, int length, int flags, int fd, int offset)
 
     Process* process = getCurrentThread()->owner;
 
-    if (process)
-    {
-        if (fd < MAX_OPENED_FILES)
-        {
+    if (process) {
+        if (fd < MAX_OPENED_FILES) {
             File* file = process->fd[fd];
 
-            if (file)
-            {
+            if (file) {
                 void* ret = mmap_fs(file, length, offset, flags);
 
-                if (ret)
-                {
+                if (ret) {
                     return ret;
                 }
             }
-            else
-            {
+            else {
                 //TODO: error invalid fd
             }
         }
-        else
-        {
+        else {
             //TODO: error invalid fd
         }
     }
-    else
-    {
+    else {
         PANIC("Process is NULL!\n");
     }
 
     return (void*)-1;
 }
 
-int syscall_munmap(void *addr, int length)
-{
+int syscall_munmap(void *addr, int length) {
     //TODO: fd
 
     /*
     Process* process = getCurrentThread()->owner;
 
-    if (process)
-    {
-        if (fd < MAX_OPENED_FILES)
-        {
+    if (process) {
+        if (fd < MAX_OPENED_FILES) {
             File* file = process->fd[fd];
 
-            if (file)
-            {
-                if (munmap_fs(file, addr, length))
-                {
+            if (file) {
+                if (munmap_fs(file, addr, length)) {
                     return 0;//on success
                 }
             }
-            else
-            {
+            else {
                 //TODO: error invalid fd
             }
         }
-        else
-        {
+        else {
             //TODO: error invalid fd
         }
     }
-    else
-    {
+    else {
         PANIC("Process is NULL!\n");
     }
     */
@@ -1038,25 +884,20 @@ int syscall_munmap(void *addr, int length)
 
 #define O_CREAT 0x200
 
-int syscall_shm_open(const char *name, int oflag, int mode)
-{
+int syscall_shm_open(const char *name, int oflag, int mode) {
     FileSystemNode* node = NULL;
 
-    if ((oflag & O_CREAT) == O_CREAT)
-    {
+    if ((oflag & O_CREAT) == O_CREAT) {
         node = createSharedMemory(name);
     }
-    else
-    {
+    else {
         node = getSharedMemoryNode(name);
     }
 
-    if (node)
-    {
+    if (node) {
         File* file = open_fs(node, oflag);
 
-        if (file)
-        {
+        if (file) {
             return file->fd;
         }
     }
@@ -1064,98 +905,77 @@ int syscall_shm_open(const char *name, int oflag, int mode)
     return -1;
 }
 
-int syscall_shm_unlink(const char *name)
-{
+int syscall_shm_unlink(const char *name) {
     return -1;
 }
 
-int syscall_ftruncate(int fd, int size)
-{
+int syscall_ftruncate(int fd, int size) {
     Process* process = getCurrentThread()->owner;
-    if (process)
-    {
-        if (fd < MAX_OPENED_FILES)
-        {
+    if (process) {
+        if (fd < MAX_OPENED_FILES) {
             File* file = process->fd[fd];
 
-            if (file)
-            {
+            if (file) {
                 return ftruncate_fs(file, size);
             }
-            else
-            {
+            else {
                 //TODO: error invalid fd
             }
         }
-        else
-        {
+        else {
             //TODO: error invalid fd
         }
     }
-    else
-    {
+    else {
         PANIC("Process is NULL!\n");
     }
 
     return -1;
 }
 
-int syscall_posix_openpt(int flags)
-{
+int syscall_posix_openpt(int flags) {
     Process* process = getCurrentThread()->owner;
-    if (process)
-    {
+    if (process) {
         FileSystemNode* node = createPseudoTerminal();
-        if (node)
-        {
+        if (node) {
             File* file = open_fs(node, flags);
 
-            if (file)
-            {
+            if (file) {
                 return file->fd;
             }
         }
     }
-    else
-    {
+    else {
         PANIC("Process is NULL!\n");
     }
 
     return -1;
 }
 
-int syscall_ptsname_r(int fd, char *buf, int buflen)
-{
+int syscall_ptsname_r(int fd, char *buf, int buflen) {
     Process* process = getCurrentThread()->owner;
-    if (process)
-    {
-        if (fd < MAX_OPENED_FILES)
-        {
+    if (process) {
+        if (fd < MAX_OPENED_FILES) {
             File* file = process->fd[fd];
 
-            if (file)
-            {
+            if (file) {
                 /*
                 int result = getSlavePath(file->node, buf, buflen);
 
-                if (result > 0)
-                {
+                if (result > 0) {
                     return 0; //return 0 on success
                 }
                 */
             }
-            else
-            {
+            else {
                 //TODO: error invalid fd
             }
         }
-        else
-        {
+        else {
             //TODO: error invalid fd
         }
     }
-    else
-    {
+    else {
         PANIC("Process is NULL!\n");
     }
 
diff --git a/kernel.soso/syscalltable.h b/kernel.soso/syscalltable.h
index 9464347a..61ff5e42 100644
--- a/kernel.soso/syscalltable.h
+++ b/kernel.soso/syscalltable.h
@@ -2,8 +2,7 @@
 #define SYSCALLTABLE_H
 
 //This file will also be included by C library.
-enum
-{
+enum {
     SYS_open,  // 0
     SYS_close,  // 1
     SYS_read,  // 2
diff --git a/kernel.soso/systemfs.c b/kernel.soso/systemfs.c
index 4765868f..4e9ae539 100644
--- a/kernel.soso/systemfs.c
+++ b/kernel.soso/systemfs.c
@@ -23,8 +23,7 @@ static int32 systemfs_read_meminfo_usedpages(File *file, uint32 size, uint8 *buf
 static BOOL systemfs_open_threads_dir(File *file, uint32 flags);
 static void systemfs_close_threads_dir(File *file);
 
-void initializeSystemFS()
-{
+void initializeSystemFS() {
     gSystemFsRoot = kmalloc(sizeof(FileSystemNode));
     memset((uint8*)gSystemFsRoot, 0, sizeof(FileSystemNode));
 
@@ -36,15 +35,13 @@ void initializeSystemFS()
 
     FileSystemNode* systemNode = finddir_fs(rootFs, "system");
 
-    if (systemNode)
-    {
+    if (systemNode) {
         systemNode->nodeType |= FT_MountPoint;
         systemNode->mountPoint = gSystemFsRoot;
         gSystemFsRoot->parent = systemNode->parent;
         strcpy(gSystemFsRoot->name, systemNode->name);
     }
-    else
-    {
+    else {
         PANIC("Could not create /system !");
     }
 
@@ -55,8 +52,7 @@ void initializeSystemFS()
     createNodes();
 }
 
-static void createNodes()
-{
+static void createNodes() {
     FileSystemNode* nodeMemInfo = kmalloc(sizeof(FileSystemNode));
 
     memset((uint8*)nodeMemInfo, 0, sizeof(FileSystemNode));
@@ -128,24 +124,20 @@ static void createNodes()
     nodePipes->nextSibling = nodeShm;
 }
 
-static BOOL systemfs_open(File *file, uint32 flags)
-{
+static BOOL systemfs_open(File *file, uint32 flags) {
     return TRUE;
 }
 
-static FileSystemDirent *systemfs_readdir(FileSystemNode *node, uint32 index)
-{
+static FileSystemDirent *systemfs_readdir(FileSystemNode *node, uint32 index) {
     int counter = 0;
 
     FileSystemNode* child = node->firstChild;
 
     //printkf("systemfs_readdir-main:%s index:%d\n", node->name, index);
 
-    while (NULL != child)
-    {
+    while (NULL != child) {
         //printkf("systemfs_readdir-child:%s\n", child->name);
-        if (counter == index)
-        {
+        if (counter == index) {
             strcpy(gDirent.name, child->name);
             gDirent.fileType = child->nodeType;
 
@@ -160,15 +152,12 @@ static FileSystemDirent *systemfs_readdir(FileSystemNode *node, uint32 index)
     return NULL;
 }
 
-static FileSystemNode *systemfs_finddir(FileSystemNode *node, char *name)
-{
+static FileSystemNode *systemfs_finddir(FileSystemNode *node, char *name) {
     //printkf("systemfs_finddir-main:%s requestedName:%s\n", node->name, name);
 
     FileSystemNode* child = node->firstChild;
-    while (NULL != child)
-    {
-        if (strcmp(name, child->name) == 0)
-        {
+    while (NULL != child) {
+        if (strcmp(name, child->name) == 0) {
             //printkf("systemfs_finddir-found:%s\n", name);
             return child;
         }
@@ -179,12 +168,9 @@ static FileSystemNode *systemfs_finddir(FileSystemNode *node, char *name)
     return NULL;
 }
 
-static int32 systemfs_read_meminfo_totalpages(File *file, uint32 size, uint8 *buffer)
-{
-    if (size >= 4)
-    {
-        if (file->offset == 0)
-        {
+static int32 systemfs_read_meminfo_totalpages(File *file, uint32 size, uint8 *buffer) {
+    if (size >= 4) {
+        if (file->offset == 0) {
             int totalPages = getTotalPageCount();
 
             sprintf((char*)buffer, "%d", totalPages);
@@ -195,20 +181,16 @@ static int32 systemfs_read_meminfo_totalpages(File *file, uint32 size, uint8 *bu
 
             return len;
         }
-        else
-        {
+        else {
             return 0;
         }
     }
     return -1;
 }
 
-static int32 systemfs_read_meminfo_usedpages(File *file, uint32 size, uint8 *buffer)
-{
-    if (size >= 4)
-    {
-        if (file->offset == 0)
-        {
+static int32 systemfs_read_meminfo_usedpages(File *file, uint32 size, uint8 *buffer) {
+    if (size >= 4) {
+        if (file->offset == 0) {
             int usedPages = getUsedPageCount();
 
             sprintf((char*)buffer, "%d", usedPages);
@@ -219,34 +201,27 @@ static int32 systemfs_read_meminfo_usedpages(File *file, uint32 size, uint8 *buf
 
             return len;
         }
-        else
-        {
+        else {
             return 0;
         }
     }
     return -1;
 }
 
-static BOOL systemfs_open_thread_file(File *file, uint32 flags)
-{
+static BOOL systemfs_open_thread_file(File *file, uint32 flags) {
     return TRUE;
 }
 
-static void systemfs_close_thread_file(File *file)
-{
+static void systemfs_close_thread_file(File *file) {
 
 }
 
-static int32 systemfs_read_thread_file(File *file, uint32 size, uint8 *buffer)
-{
-    if (size >= 128)
-    {
-        if (file->offset == 0)
-        {
+static int32 systemfs_read_thread_file(File *file, uint32 size, uint8 *buffer) {
+    if (size >= 128) {
+        if (file->offset == 0) {
             int threadId = atoi(file->node->name);
             Thread* thread = getThreadById(threadId);
-            if (thread)
-            {
+            if (thread) {
                 int charIndex = 0;
                 charIndex += sprintf((char*)buffer + charIndex, "tid:%d\n", thread->threadId);
                 charIndex += sprintf((char*)buffer + charIndex, "userMode:%d\n", thread->userMode);
@@ -254,12 +229,10 @@ static int32 systemfs_read_thread_file(File *file, uint32 size, uint8 *buffer)
                 threadStateToString(thread->state, state, 10);
                 charIndex += sprintf((char*)buffer + charIndex, "state:%s\n", state);
                 charIndex += sprintf((char*)buffer + charIndex, "contextSwitches:%d\n", thread->totalContextSwitchCount);
-                if (thread->owner)
-                {
+                if (thread->owner) {
                     charIndex += sprintf((char*)buffer + charIndex, "process:%d\n", thread->owner->pid);
                 }
-                else
-                {
+                else {
                     charIndex += sprintf((char*)buffer + charIndex, "process:-\n");
                 }
 
@@ -270,20 +243,17 @@ static int32 systemfs_read_thread_file(File *file, uint32 size, uint8 *buffer)
                 return len;
             }
         }
-        else
-        {
+        else {
             return 0;
         }
     }
     return -1;
 }
 
-static void cleanThreadNodes(File *file)
-{
+static void cleanThreadNodes(File *file) {
     FileSystemNode* node = file->node->firstChild;
 
-    while (node)
-    {
+    while (node) {
         FileSystemNode* next = node->nextSibling;
 
         kfree(node);
@@ -292,8 +262,7 @@ static void cleanThreadNodes(File *file)
     }
 }
 
-static BOOL systemfs_open_threads_dir(File *file, uint32 flags)
-{
+static BOOL systemfs_open_threads_dir(File *file, uint32 flags) {
     char buffer[16];
 
     cleanThreadNodes(file);
@@ -304,8 +273,7 @@ static BOOL systemfs_open_threads_dir(File *file, uint32 flags)
 
     Thread* thread = getMainKernelThread();
 
-    while (NULL != thread)
-    {
+    while (NULL != thread) {
         FileSystemNode* nodeThread = kmalloc(sizeof(FileSystemNode));
         memset((uint8*)nodeThread, 0, sizeof(FileSystemNode));
 
@@ -320,12 +288,10 @@ static BOOL systemfs_open_threads_dir(File *file, uint32 flags)
         nodeThread->readdir = systemfs_readdir;
         nodeThread->parent = file->node;
 
-        if (nodePrevious)
-        {
+        if (nodePrevious) {
             nodePrevious->nextSibling = nodeThread;
         }
-        else
-        {
+        else {
             file->node->firstChild = nodeThread;
         }
 
@@ -338,7 +304,6 @@ static BOOL systemfs_open_threads_dir(File *file, uint32 flags)
     return TRUE;
 }
 
-static void systemfs_close_threads_dir(File *file)
-{
+static void systemfs_close_threads_dir(File *file) {
     //left blank intentionally
 }
diff --git a/kernel.soso/termios.h b/kernel.soso/termios.h
index 5ceea479..c90a4b60 100644
--- a/kernel.soso/termios.h
+++ b/kernel.soso/termios.h
@@ -9,8 +9,7 @@ typedef unsigned int        tcflag_t;
 
 #define NCCS 32
 
-struct termios
-  {
+struct termios {
     tcflag_t c_iflag;        // input mode flags
     tcflag_t c_oflag;        // output mode flags
     tcflag_t c_cflag;        // control mode flags
diff --git a/kernel.soso/timer.c b/kernel.soso/timer.c
index 443afa05..97396334 100644
--- a/kernel.soso/timer.c
+++ b/kernel.soso/timer.c
@@ -11,43 +11,35 @@ uint32 gSystemTickCount = 0;
 BOOL gSchedulerEnabled = FALSE;
 
 //called from assembly
-void handleTimerIRQ(TimerInt_Registers registers)
-{
+void handleTimerIRQ(TimerInt_Registers registers) {
     gSystemTickCount++;
 
-    if (/*gSystemTickCount % 10 == 0 &&*/ gSchedulerEnabled == TRUE)
-    {
+    if (/*gSystemTickCount % 10 == 0 &&*/ gSchedulerEnabled == TRUE) {
         schedule(&registers);
     }
 }
 
-uint32 getSystemTickCount()
-{
+uint32 getSystemTickCount() {
     return gSystemTickCount;
 }
 
-uint32 getUptimeSeconds()
-{
+uint32 getUptimeSeconds() {
     return gSystemTickCount / TIMER_FREQ;
 }
 
-uint32 getUptimeMilliseconds()
-{
+uint32 getUptimeMilliseconds() {
     return gSystemTickCount;
 }
 
-void enableScheduler()
-{
+void enableScheduler() {
     gSchedulerEnabled = TRUE;
 }
 
-void disableScheduler()
-{
+void disableScheduler() {
     gSchedulerEnabled = FALSE;
 }
 
-static void initTimer(uint32 frequency)
-{
+static void initTimer(uint32 frequency) {
     uint32 divisor = 1193180 / frequency;
 
     outb(0x43, 0x36);
@@ -59,7 +51,6 @@ static void initTimer(uint32 frequency)
     outb(0x40, h);
 }
 
-void initializeTimer()
-{
+void initializeTimer() {
     initTimer(TIMER_FREQ);
 }
diff --git a/kernel.soso/tty.c b/kernel.soso/tty.c
index a9753c34..9e53c339 100644
--- a/kernel.soso/tty.c
+++ b/kernel.soso/tty.c
@@ -1,8 +1,7 @@
 #include "tty.h"
 #include "alloc.h"
 
-Tty* createTty(uint16 lineCount, uint16 columnCount, TtyFlushScreenFunction flushFunction)
-{
+Tty* createTty(uint16 lineCount, uint16 columnCount, TtyFlushScreenFunction flushFunction) {
     Tty* tty = kmalloc(sizeof(Tty));
     memset((uint8*)tty, 0, sizeof(Tty));
 
@@ -27,37 +26,31 @@ Tty* createTty(uint16 lineCount, uint16 columnCount, TtyFlushScreenFunction flus
     return tty;
 }
 
-void destroyTty(Tty* tty)
-{
+void destroyTty(Tty* tty) {
     FifoBuffer_destroy(tty->keyBuffer);
     kfree(tty->buffer);
     kfree(tty);
 }
 
-void Tty_Print(Tty* tty, int row, int column, const char* text)
-{
+void Tty_Print(Tty* tty, int row, int column, const char* text) {
     unsigned char * video = tty->buffer;
 
     video += (row * tty->columnCount + column) * 2;
-    while(*text != 0)
-    {
+    while(*text != 0) {
         *video++ = *text++;
         *video++ = tty->color;
     }
 }
 
 //One line
-void Tty_ScrollUp(Tty* tty)
-{
+void Tty_ScrollUp(Tty* tty) {
     unsigned char * videoLine = tty->buffer;
     unsigned char * videoLineNext = tty->buffer;
     int line = 0;
     int column = 0;
 
-    for (line = 0; line < tty->lineCount - 1; ++line)
-    {
-        for (column = 0; column < tty->columnCount; ++column)
-        {
+    for (line = 0; line < tty->lineCount - 1; ++line) {
+        for (column = 0; column < tty->columnCount; ++column) {
             videoLine = tty->buffer + (line * tty->columnCount + column) * 2;
             videoLineNext = tty->buffer + ((line + 1) * tty->columnCount + column) * 2;
 
@@ -68,20 +61,17 @@ void Tty_ScrollUp(Tty* tty)
 
     //Last line should be empty.
     unsigned char * lastLine = tty->buffer + ((tty->lineCount - 1) * tty->columnCount) * 2;
-    for (int i = 0; i < tty->columnCount * 2; i += 2)
-    {
+    for (int i = 0; i < tty->columnCount * 2; i += 2) {
         lastLine[i] = 0;
         lastLine[i + 1] = tty->color;
     }
 }
 
-void Tty_Clear(Tty* tty)
-{
+void Tty_Clear(Tty* tty) {
     unsigned char * video = tty->buffer;
     int i = 0;
 
-    for (i = 0; i < tty->lineCount * tty->columnCount; ++i)
-    {
+    for (i = 0; i < tty->lineCount * tty->columnCount; ++i) {
         *video++ = 0;
         *video++ = tty->color;
     }
@@ -90,17 +80,14 @@ void Tty_Clear(Tty* tty)
     tty->currentColumn = 0;
 }
 
-void Tty_PutChar(Tty* tty, char c)
-{
+void Tty_PutChar(Tty* tty, char c) {
     unsigned char * video = tty->buffer;
 
-    if ('\n' == c || '\r' == c)
-    {
+    if ('\n' == c || '\r' == c) {
         ++tty->currentLine;
         tty->currentColumn = 0;
 
-        if (tty->currentLine >= tty->lineCount - 0)
-        {
+        if (tty->currentLine >= tty->lineCount - 0) {
             --tty->currentLine;
             Tty_ScrollUp(tty);
         }
@@ -108,10 +95,8 @@ void Tty_PutChar(Tty* tty, char c)
         Tty_MoveCursor(tty, tty->currentLine, tty->currentColumn);
         return;
     }
-    else if ('\b' == c)
-    {
-        if (tty->currentColumn > 0)
-        {
+    else if ('\b' == c) {
+        if (tty->currentColumn > 0) {
             --tty->currentColumn;
             c = '\0';
             video = tty->buffer + (tty->currentLine * tty->columnCount + tty->currentColumn) * 2;
@@ -120,10 +105,8 @@ void Tty_PutChar(Tty* tty, char c)
             Tty_MoveCursor(tty, tty->currentLine, tty->currentColumn);
             return;
         }
-        else if (tty->currentColumn == 0)
-        {
-            if (tty->currentLine > 0)
-            {
+        else if (tty->currentColumn == 0) {
+            if (tty->currentLine > 0) {
                 --tty->currentLine;
                 tty->currentColumn = tty->columnCount - 1;
                 c = '\0';
@@ -136,14 +119,12 @@ void Tty_PutChar(Tty* tty, char c)
         }
     }
 
-    if (tty->currentColumn >= tty->columnCount)
-    {
+    if (tty->currentColumn >= tty->columnCount) {
         ++tty->currentLine;
         tty->currentColumn = 0;
     }
 
-    if (tty->currentLine >= tty->lineCount - 0)
-    {
+    if (tty->currentLine >= tty->lineCount - 0) {
         --tty->currentLine;
         Tty_ScrollUp(tty);
     }
@@ -158,18 +139,15 @@ void Tty_PutChar(Tty* tty, char c)
     Tty_MoveCursor(tty, tty->currentLine, tty->currentColumn);
 }
 
-void Tty_PutText(Tty* tty, const char* text)
-{
+void Tty_PutText(Tty* tty, const char* text) {
     const char* c = text;
-    while (*c)
-    {
+    while (*c) {
         Tty_PutChar(tty, *c);
         ++c;
     }
 }
 
-void Tty_MoveCursor(Tty* tty, uint16 line, uint16 column)
-{
+void Tty_MoveCursor(Tty* tty, uint16 line, uint16 column) {
     tty->currentLine = line;
     tty->currentColumn = column;
 }
diff --git a/kernel.soso/tty.h b/kernel.soso/tty.h
index bf6beb3a..df39e6cd 100644
--- a/kernel.soso/tty.h
+++ b/kernel.soso/tty.h
@@ -11,8 +11,7 @@ typedef struct Tty Tty;
 
 typedef void (*TtyFlushScreenFunction)(Tty* tty);
 
-typedef struct Tty
-{
+typedef struct Tty {
     uint16 lineCount;
     uint16 columnCount;
     uint8* buffer;
diff --git a/kernel.soso/ttydriver.c b/kernel.soso/ttydriver.c
index b2f19542..755cda15 100644
--- a/kernel.soso/ttydriver.c
+++ b/kernel.soso/ttydriver.c
@@ -22,16 +22,14 @@ static uint8 gKeyModifier = 0;
 
 static uint32 gPseudoTerminalNameGenerator = 0;
 
-typedef enum KeyModifier
-{
+typedef enum KeyModifier {
     KM_LeftShift = 1,
     KM_RightShift = 2,
     KM_Ctrl = 4,
     KM_Alt = 8
 } KeyModifier;
 
-enum
-{
+enum {
     KEY_LEFTSHIFT = 0x2A,
     KEY_RIGHTSHIFT = 0x36,
     KEY_CTRL = 0x1D,
@@ -78,8 +76,7 @@ enum
 
 
 
-static uint8 gKeyMap[256] =
-{
+static uint8 gKeyMap[256] = {
   NO,   0x1B, '1',  '2',  '3',  '4',  '5',  '6',  // 0x00
   '7',  '8',  '9',  '0',  '-',  '=',  '\b', '\t',
   'q',  'w',  'e',  'r',  't',  'y',  'u',  'i',  // 0x10
@@ -115,8 +112,7 @@ static uint8 gKeyMap[256] =
   [0xD3] = KEY_DELETE
 };
 
-static uint8 gKeyShiftMap[256] =
-{
+static uint8 gKeyShiftMap[256] = {
   NO,   033,  '!',  '@',  '#',  '$',  '%',  '^',  // 0x00
   '&',  '*',  '(',  ')',  '_',  '+',  '\b', '\t',
   'Q',  'W',  'E',  'R',  'T',  'Y',  'U',  'I',  // 0x10
@@ -162,21 +158,17 @@ static int32 write(Tty* tty, uint32 size, uint8 *buffer);
 static uint8 getCharacterForScancode(KeyModifier modifier, uint8 scancode);
 static void processScancode(uint8 scancode);
 
-void initializeTTYs(BOOL graphicMode)
-{
+void initializeTTYs(BOOL graphicMode) {
     gTtyList = List_Create();
 
     gReaderList = List_Create();
 
-    for (int i = 1; i <= 9; ++i)
-    {
+    for (int i = 1; i <= 9; ++i) {
         Tty* tty = NULL;
-        if (graphicMode)
-        {
+        if (graphicMode) {
             tty = createTty(768 / 16, 1024 / 9, Gfx_FlushFromTty);
         }
-        else
-        {
+        else {
             tty = createTty(25, 80, Screen_FlushFromTty);
         }
 
@@ -200,13 +192,11 @@ void initializeTTYs(BOOL graphicMode)
     gActiveTty = List_GetFirstNode(gTtyList)->data;
 }
 
-Tty* getActiveTTY()
-{
+Tty* getActiveTTY() {
     return gActiveTty;
 }
 
-FileSystemNode* createPseudoTerminal()
-{
+FileSystemNode* createPseudoTerminal() {
     Tty* tty = createTty(768 / 16, 1024 / 9, Gfx_FlushFromTty);
 
     tty->color = 0x0A;
@@ -222,22 +212,19 @@ FileSystemNode* createPseudoTerminal()
     device.write = tty_write;
     device.privateData = tty;
     FileSystemNode* node = registerDevice(&device);
-    if (NULL == node)
-    {
+    if (NULL == node) {
         destroyTty(tty);
     }
 
     return node;
 }
 
-static void sendInputToKeyBuffer(Tty* tty, uint8 scancode, uint8 character)
-{
+static void sendInputToKeyBuffer(Tty* tty, uint8 scancode, uint8 character) {
     char seq[8];
     memset(seq, 0, 8);
 
     switch (character) {
-    case KEY_PAGEUP:
-    {
+    case KEY_PAGEUP: {
         seq[0] = 27;
         seq[1] = 91;
         seq[2] = 53;
@@ -245,8 +232,7 @@ static void sendInputToKeyBuffer(Tty* tty, uint8 scancode, uint8 character)
         FifoBuffer_enqueue(tty->keyBuffer, seq, 4);
     }
         break;
-    case KEY_PAGEDOWN:
-    {
+    case KEY_PAGEDOWN: {
         seq[0] = 27;
         seq[1] = 91;
         seq[2] = 54;
@@ -254,24 +240,21 @@ static void sendInputToKeyBuffer(Tty* tty, uint8 scancode, uint8 character)
         FifoBuffer_enqueue(tty->keyBuffer, seq, 4);
     }
         break;
-    case KEY_HOME:
-    {
+    case KEY_HOME: {
         seq[0] = 27;
         seq[1] = 91;
         seq[2] = 72;
         FifoBuffer_enqueue(tty->keyBuffer, seq, 3);
     }
         break;
-    case KEY_END:
-    {
+    case KEY_END: {
         seq[0] = 27;
         seq[1] = 91;
         seq[2] = 70;
         FifoBuffer_enqueue(tty->keyBuffer, seq, 3);
     }
         break;
-    case KEY_INSERT:
-    {
+    case KEY_INSERT: {
         seq[0] = 27;
         seq[1] = 91;
         seq[2] = 50;
@@ -279,8 +262,7 @@ static void sendInputToKeyBuffer(Tty* tty, uint8 scancode, uint8 character)
         FifoBuffer_enqueue(tty->keyBuffer, seq, 4);
     }
         break;
-    case KEY_DELETE:
-    {
+    case KEY_DELETE: {
         seq[0] = 27;
         seq[1] = 91;
         seq[2] = 51;
@@ -288,32 +270,28 @@ static void sendInputToKeyBuffer(Tty* tty, uint8 scancode, uint8 character)
         FifoBuffer_enqueue(tty->keyBuffer, seq, 4);
     }
         break;
-    case KEY_UP:
-    {
+    case KEY_UP: {
         seq[0] = 27;
         seq[1] = 91;
         seq[2] = 65;
         FifoBuffer_enqueue(tty->keyBuffer, seq, 3);
     }
         break;
-    case KEY_DOWN:
-    {
+    case KEY_DOWN: {
         seq[0] = 27;
         seq[1] = 91;
         seq[2] = 66;
         FifoBuffer_enqueue(tty->keyBuffer, seq, 3);
     }
         break;
-    case KEY_RIGHT:
-    {
+    case KEY_RIGHT: {
         seq[0] = 27;
         seq[1] = 91;
         seq[2] = 67;
         FifoBuffer_enqueue(tty->keyBuffer, seq, 3);
     }
         break;
-    case KEY_LEFT:
-    {
+    case KEY_LEFT: {
         seq[0] = 27;
         seq[1] = 91;
         seq[2] = 68;
@@ -326,8 +304,7 @@ static void sendInputToKeyBuffer(Tty* tty, uint8 scancode, uint8 character)
     }
 }
 
-void sendKeyInputToTTY(Tty* tty, uint8 scancode)
-{
+void sendKeyInputToTTY(Tty* tty, uint8 scancode) {
     beginCriticalSection();
 
     processScancode(scancode);
@@ -336,49 +313,39 @@ void sendKeyInputToTTY(Tty* tty, uint8 scancode)
 
     uint8 keyRelease = (0x80 & scancode); //ignore release event
 
-    if (character > 0 && keyRelease == 0)
-    {
+    if (character > 0 && keyRelease == 0) {
         //enqueue for non-canonical readers
         sendInputToKeyBuffer(tty, scancode, character);
         //FifoBuffer_enqueue(tty->keyBuffer, &scancode, 1);
 
-        if (tty->lineBufferIndex >= TTY_LINEBUFFER_SIZE - 1)
-        {
+        if (tty->lineBufferIndex >= TTY_LINEBUFFER_SIZE - 1) {
             tty->lineBufferIndex = 0;
         }
 
-        if (character == '\b')
-        {
-            if (tty->lineBufferIndex > 0)
-            {
+        if (character == '\b') {
+            if (tty->lineBufferIndex > 0) {
                 tty->lineBuffer[--tty->lineBufferIndex] = '\0';
 
-                if ((tty->term.c_lflag & ECHO) == ECHO)
-                {
+                if ((tty->term.c_lflag & ECHO) == ECHO) {
                     write(tty, 1, &character);
                 }
             }
         }
-        else
-        {
+        else {
             tty->lineBuffer[tty->lineBufferIndex++] = character;
 
-            if ((tty->term.c_lflag & ECHO) == ECHO)
-            {
+            if ((tty->term.c_lflag & ECHO) == ECHO) {
                 write(tty, 1, &character);
             }
         }
     }
 
     //Wake readers
-    List_Foreach(n, gReaderList)
-    {
+    List_Foreach(n, gReaderList) {
         File* file = n->data;
 
-        if (file->thread->state == TS_WAITIO)
-        {
-            if (file->thread->state_privateData == tty)
-            {
+        if (file->thread->state == TS_WAITIO) {
+            if (file->thread->state_privateData == tty) {
                 file->thread->state = TS_RUN;
                 file->thread->state_privateData = NULL;
             }
@@ -388,8 +355,7 @@ void sendKeyInputToTTY(Tty* tty, uint8 scancode)
     endCriticalSection();
 }
 
-static BOOL tty_open(File *file, uint32 flags)
-{
+static BOOL tty_open(File *file, uint32 flags) {
     //printkf("tty_open: pid:%d\n", file->process->pid);
 
     Tty* tty = (Tty*)file->node->privateNodeData;
@@ -401,19 +367,15 @@ static BOOL tty_open(File *file, uint32 flags)
     return TRUE;
 }
 
-static void tty_close(File *file)
-{
+static void tty_close(File *file) {
     List_RemoveFirstOccurrence(gReaderList, file);
 }
 
-static int32 tty_ioctl(File *file, int32 request, void * argp)
-{
+static int32 tty_ioctl(File *file, int32 request, void * argp) {
     Tty* tty = (Tty*)file->node->privateNodeData;
 
-    switch (request)
-    {
-    case 0:
-    {
+    switch (request) {
+    case 0: {
         sendKeyInputToTTY(tty, (uint8)(uint32)argp);
 
         return 0;
@@ -422,16 +384,14 @@ static int32 tty_ioctl(File *file, int32 request, void * argp)
     case 1:
         return tty->columnCount * tty->lineCount * 2;
         break;
-    case 2:
-    {
+    case 2: {
         //set
         TtyUserBuffer* userTtyBuffer = (TtyUserBuffer*)argp;
         memcpy(tty->buffer, (uint8*)userTtyBuffer->buffer, tty->columnCount * tty->lineCount * 2);
         return 0;
     }
         break;
-    case 3:
-    {
+    case 3: {
         //get
         TtyUserBuffer* userTtyBuffer = (TtyUserBuffer*)argp;
         userTtyBuffer->columnCount = tty->columnCount;
@@ -442,8 +402,7 @@ static int32 tty_ioctl(File *file, int32 request, void * argp)
         return 0;
     }
         break;
-    case TCGETS:
-    {
+    case TCGETS: {
         struct termios* term = (struct termios*)argp;
 
         //Debug_PrintF("TCGETS\n");
@@ -456,8 +415,7 @@ static int32 tty_ioctl(File *file, int32 request, void * argp)
     case TCSETS:
     case TCSETSW:
         break;
-    case TCSETSF:
-    {
+    case TCSETSF: {
         struct termios* term = (struct termios*)argp;
 
         //Debug_PrintF("TCSETSF\n");
@@ -474,28 +432,21 @@ static int32 tty_ioctl(File *file, int32 request, void * argp)
     return -1;
 }
 
-static int32 tty_read(File *file, uint32 size, uint8 *buffer)
-{
+static int32 tty_read(File *file, uint32 size, uint8 *buffer) {
     enableInterrupts();
 
-    if (size > 0)
-    {
+    if (size > 0) {
         Tty* tty = (Tty*)file->node->privateNodeData;
 
-        if ((tty->term.c_lflag & ICANON) == ICANON)
-        {
-            while (TRUE)
-            {
-                for (int i = 0; i < tty->lineBufferIndex; ++i)
-                {
+        if ((tty->term.c_lflag & ICANON) == ICANON) {
+            while (TRUE) {
+                for (int i = 0; i < tty->lineBufferIndex; ++i) {
                     char chr = tty->lineBuffer[i];
 
-                    if (chr == '\n')
-                    {
+                    if (chr == '\n') {
                         int bytesToCopy = MIN(tty->lineBufferIndex, size);
 
-                        if (bytesToCopy >= tty->term.c_cc[VMIN])
-                        {
+                        if (bytesToCopy >= tty->term.c_cc[VMIN]) {
                             tty->lineBufferIndex = 0;
                             memcpy(buffer, tty->lineBuffer, bytesToCopy);
 
@@ -509,15 +460,12 @@ static int32 tty_read(File *file, uint32 size, uint8 *buffer)
                 halt();
             }
         }
-        else
-        {
-            while (TRUE)
-            {
+        else {
+            while (TRUE) {
                 uint32 neededSize = tty->term.c_cc[VMIN];
                 uint32 bufferLen = FifoBuffer_getSize(tty->keyBuffer);
 
-                if (bufferLen >= neededSize)
-                {
+                if (bufferLen >= neededSize) {
                     int readSize = FifoBuffer_dequeue(tty->keyBuffer, buffer, MIN(bufferLen, size));
 
                     return readSize;
@@ -533,16 +481,13 @@ static int32 tty_read(File *file, uint32 size, uint8 *buffer)
     return -1;
 }
 
-static int32 write(Tty* tty, uint32 size, uint8 *buffer)
-{
+static int32 write(Tty* tty, uint32 size, uint8 *buffer) {
     buffer[size] = '\0';
 
     Tty_PutText(tty, (const char*)buffer);
 
-    if (gActiveTty == tty)
-    {
-        if (gActiveTty->flushScreen)
-        {
+    if (gActiveTty == tty) {
+        if (gActiveTty->flushScreen) {
             gActiveTty->flushScreen(gActiveTty);
         }
     }
@@ -550,31 +495,25 @@ static int32 write(Tty* tty, uint32 size, uint8 *buffer)
     return size;
 }
 
-static int32 tty_write(File *file, uint32 size, uint8 *buffer)
-{
+static int32 tty_write(File *file, uint32 size, uint8 *buffer) {
     return write(file->node->privateNodeData, size, buffer);
 }
 
-static void setActiveTty(Tty* tty)
-{
+static void setActiveTty(Tty* tty) {
     gActiveTty = tty;
 
     Gfx_Fill(0xFFFFFFFF);
 
-    if (tty->flushScreen)
-    {
+    if (tty->flushScreen) {
         tty->flushScreen(tty);
     }
 
     //Serial_PrintF("line:%d column:%d\r\n", gActiveTty->currentLine, gActiveTty->currentColumn);
 }
 
-BOOL isValidTTY(Tty* tty)
-{
-    List_Foreach(n, gTtyList)
-    {
-        if (n->data == tty)
-        {
+BOOL isValidTTY(Tty* tty) {
+    List_Foreach(n, gTtyList) {
+        if (n->data == tty) {
             return TRUE;
         }
     }
@@ -582,31 +521,24 @@ BOOL isValidTTY(Tty* tty)
     return FALSE;
 }
 
-static uint8 getCharacterForScancode(KeyModifier modifier, uint8 scancode)
-{
+static uint8 getCharacterForScancode(KeyModifier modifier, uint8 scancode) {
     //return gKeyboardLayout[scancode];
-    if ((modifier & KM_LeftShift) == KM_LeftShift || (modifier & KM_RightShift) == KM_RightShift)
-    {
+    if ((modifier & KM_LeftShift) == KM_LeftShift || (modifier & KM_RightShift) == KM_RightShift) {
         return gKeyShiftMap[scancode];
     }
 
     return gKeyMap[scancode];
 }
 
-static void applyModifierKeys(KeyModifier modifier, uint8 scancode)
-{
-    if ((modifier & KM_Ctrl) == KM_Ctrl)
-    {
+static void applyModifierKeys(KeyModifier modifier, uint8 scancode) {
+    if ((modifier & KM_Ctrl) == KM_Ctrl) {
         int ttyIndex = scancode - KEY_F1;
         //printkf("TTY:%d\n", ttyIndex);
         int ttyCount = List_GetCount(gTtyList);
-        if (ttyIndex >= 0 && ttyIndex < ttyCount)
-        {
+        if (ttyIndex >= 0 && ttyIndex < ttyCount) {
             int i = 0;
-            List_Foreach(n, gTtyList)
-            {
-                if (ttyIndex == i)
-                {
+            List_Foreach(n, gTtyList) {
+                if (ttyIndex == i) {
                     setActiveTty(n->data);
                     break;
                 }
@@ -616,18 +548,15 @@ static void applyModifierKeys(KeyModifier modifier, uint8 scancode)
     }
 }
 
-static void processScancode(uint8 scancode)
-{
+static void processScancode(uint8 scancode) {
     uint8 lastBit = scancode & 0x80;
 
     scancode &= 0x7F;
 
-    if (lastBit)
-    {
+    if (lastBit) {
         //key release
 
-        switch (scancode)
-        {
+        switch (scancode) {
         case KEY_LEFTSHIFT:
             gKeyModifier &= ~KM_LeftShift;
             break;
@@ -644,12 +573,10 @@ static void processScancode(uint8 scancode)
 
         //printkf("released: %x (%d)\n", scancode, scancode);
     }
-    else
-    {
+    else {
         //key pressed
 
-        switch (scancode)
-        {
+        switch (scancode) {
         case KEY_LEFTSHIFT:
             gKeyModifier |= KM_LeftShift;
             break;
diff --git a/kernel.soso/vimrc.vim b/kernel.soso/vimrc.vim
new file mode 100644
index 00000000..d9be6ee4
--- /dev/null
+++ b/kernel.soso/vimrc.vim
@@ -0,0 +1,2 @@
+set tabstop=4
+set noexpandtab
diff --git a/kernel.soso/vmm.c b/kernel.soso/vmm.c
index 740763b3..7dad53be 100644
--- a/kernel.soso/vmm.c
+++ b/kernel.soso/vmm.c
@@ -16,8 +16,7 @@ static int gTotalPageCount = 0;
 static void handlePageFault(Registers *regs);
 static void syncPageDirectoriesKernelMemory();
 
-void initializeMemory(uint32 high_mem)
-{
+void initializeMemory(uint32 high_mem) {
     int pg;
     unsigned long i;
 
@@ -25,41 +24,34 @@ void initializeMemory(uint32 high_mem)
 
     gTotalPageCount = (high_mem * 1024) / PAGESIZE_4M;
 
-    for (pg = 0; pg < gTotalPageCount / 8; ++pg)
-    {
+    for (pg = 0; pg < gTotalPageCount / 8; ++pg) {
         gPhysicalPageFrameBitmap[pg] = 0;
     }
 
-    for (pg = gTotalPageCount / 8; pg < RAM_AS_4M_PAGES / 8; ++pg)
-    {
+    for (pg = gTotalPageCount / 8; pg < RAM_AS_4M_PAGES / 8; ++pg) {
         gPhysicalPageFrameBitmap[pg] = 0xFF;
     }
 
     //Pages reserved for the kernel
-    for (pg = PAGE_INDEX_4M(0x0); pg < (int)(PAGE_INDEX_4M(RESERVED_AREA)); ++pg)
-    {
+    for (pg = PAGE_INDEX_4M(0x0); pg < (int)(PAGE_INDEX_4M(RESERVED_AREA)); ++pg) {
         SET_PAGEFRAME_USED(gPhysicalPageFrameBitmap, pg);
     }
 
     //Heap pages reserved
-    for (pg = 0; pg < RAM_AS_4K_PAGES / 8; ++pg)
-    {
+    for (pg = 0; pg < RAM_AS_4K_PAGES / 8; ++pg) {
         gKernelPageHeapBitmap[pg] = 0xFF;
     }
 
-    for (pg = PAGE_INDEX_4K(KERN_PD_AREA_BEGIN); pg < (int)(PAGE_INDEX_4K(KERN_PD_AREA_END)); ++pg)
-    {
+    for (pg = PAGE_INDEX_4K(KERN_PD_AREA_BEGIN); pg < (int)(PAGE_INDEX_4K(KERN_PD_AREA_END)); ++pg) {
         SET_PAGEHEAP_UNUSED(pg * PAGESIZE_4K);
     }
 
     //Identity map
-    for (i = 0; i < 4; ++i)
-    {
+    for (i = 0; i < 4; ++i) {
         gKernelPageDirectory[i] = (i * PAGESIZE_4M | (PG_PRESENT | PG_WRITE | PG_4MB));//add PG_USER for accesing kernel code in user mode
     }
 
-    for (i = 4; i < 1024; ++i)
-    {
+    for (i = 4; i < 1024; ++i) {
         gKernelPageDirectory[i] = 0;
     }
 
@@ -76,19 +68,14 @@ void initializeMemory(uint32 high_mem)
     initializeKernelHeap();
 }
 
-char* getPageFrame4M()
-{
+char* getPageFrame4M() {
     int byte, bit;
     uint32 page = -1;
 
-    for (byte = 0; byte < RAM_AS_4M_PAGES / 8; byte++)
-    {
-        if (gPhysicalPageFrameBitmap[byte] != 0xFF)
-        {
-            for (bit = 0; bit < 8; bit++)
-            {
-                if (!(gPhysicalPageFrameBitmap[byte] & (1 << bit)))
-                {
+    for (byte = 0; byte < RAM_AS_4M_PAGES / 8; byte++) {
+        if (gPhysicalPageFrameBitmap[byte] != 0xFF) {
+            for (bit = 0; bit < 8; bit++) {
+                if (!(gPhysicalPageFrameBitmap[byte] & (1 << bit))) {
                     page = 8 * byte + bit;
                     SET_PAGEFRAME_USED(gPhysicalPageFrameBitmap, page);
                     Debug_PrintF("DEBUG: got 4M on physical %x\n", page * PAGESIZE_4M);
@@ -102,28 +89,22 @@ char* getPageFrame4M()
     return (char *) -1;
 }
 
-void releasePageFrame4M(uint32 p_addr)
-{
+void releasePageFrame4M(uint32 p_addr) {
     Debug_PrintF("DEBUG: released 4M on physical %x\n", p_addr);
 
     SET_PAGEFRAME_UNUSED(gPhysicalPageFrameBitmap, p_addr);
 }
 
-uint32* getPdFromReservedArea4K()
-{
+uint32* getPdFromReservedArea4K() {
     int byte, bit;
     int page = -1;
 
     //printkf("DEBUG: getPdFromReservedArea4K() begin\n");
 
-    for (byte = 0; byte < RAM_AS_4K_PAGES / 8; byte++)
-    {
-        if (gKernelPageHeapBitmap[byte] != 0xFF)
-        {
-            for (bit = 0; bit < 8; bit++)
-            {
-                if (!(gKernelPageHeapBitmap[byte] & (1 << bit)))
-                {
+    for (byte = 0; byte < RAM_AS_4K_PAGES / 8; byte++) {
+        if (gKernelPageHeapBitmap[byte] != 0xFF) {
+            for (bit = 0; bit < 8; bit++) {
+                if (!(gKernelPageHeapBitmap[byte] & (1 << bit))) {
                     page = 8 * byte + bit;
                     SET_PAGEHEAP_USED(page);
                     //printkf("DEBUG: getPdFromReservedArea4K() found pageIndex:%d\n", page);
@@ -137,45 +118,38 @@ uint32* getPdFromReservedArea4K()
     return (uint32 *) -1;
 }
 
-void releasePdFromReservedArea4K(uint32 *v_addr)
-{
+void releasePdFromReservedArea4K(uint32 *v_addr) {
     SET_PAGEHEAP_UNUSED(v_addr);
 }
 
-uint32 *createPd()
-{
+uint32 *createPd() {
     int i;
 
     uint32* pd = getPdFromReservedArea4K();
 
 
-    for (i = 0; i < KERNELMEMORY_PAGE_COUNT; ++i)
-    {
+    for (i = 0; i < KERNELMEMORY_PAGE_COUNT; ++i) {
         pd[i] = gKernelPageDirectory[i];
     }
 
 
-    for (i = KERNELMEMORY_PAGE_COUNT; i < 1024; ++i)
-    {
+    for (i = KERNELMEMORY_PAGE_COUNT; i < 1024; ++i) {
         pd[i] = 0;
     }
 
     return pd;
 }
 
-void destroyPd(uint32 *pd)
-{
+void destroyPd(uint32 *pd) {
     int startIndex = PAGE_INDEX_4M(USER_OFFSET);
     int lastIndex = PAGE_INDEX_4M(USER_OFFSET_END);
 
     ///we don't touch mmapped areas
 
-    for (int i = startIndex; i < lastIndex; ++i)
-    {
+    for (int i = startIndex; i < lastIndex; ++i) {
         uint32 p_addr = pd[i] & 0xFFC00000;
 
-        if (p_addr)
-        {
+        if (p_addr) {
             releasePageFrame4M(p_addr);
         }
 
@@ -185,26 +159,22 @@ void destroyPd(uint32 *pd)
     releasePdFromReservedArea4K(pd);
 }
 
-uint32 *copyPd(uint32* pd)
-{
+uint32 *copyPd(uint32* pd) {
     int i;
 
     uint32* newPd = getPdFromReservedArea4K();
 
 
-    for (i = 0; i < KERNELMEMORY_PAGE_COUNT; ++i)
-    {
+    for (i = 0; i < KERNELMEMORY_PAGE_COUNT; ++i) {
         newPd[i] = gKernelPageDirectory[i];
     }
 
     disablePaging();
 
-    for (i = KERNELMEMORY_PAGE_COUNT; i < 1024; ++i)
-    {
+    for (i = KERNELMEMORY_PAGE_COUNT; i < 1024; ++i) {
         newPd[i] = 0;
 
-        if ((pd[i] & PG_PRESENT) == PG_PRESENT)
-        {
+        if ((pd[i] & PG_PRESENT) == PG_PRESENT) {
             uint32 pagePyhsical = pd[i] & 0xFFC00000;
             char* newPagePhysical = getPageFrame4M();
 
@@ -226,8 +196,7 @@ uint32 *copyPd(uint32* pd)
 //When calling this function:
 //If it is intended to alloc kernel memory, v_addr must be < KERN_HEAP_END.
 //If it is intended to alloc user memory, v_addr must be > KERN_HEAP_END.
-BOOL addPageToPd(uint32* pd, char *v_addr, char *p_addr, int flags)
-{
+BOOL addPageToPd(uint32* pd, char *v_addr, char *p_addr, int flags) {
     uint32 *pde = NULL;
 
     //printkf("DEBUG: addPageToPd(): v_addr:%x p_addr:%x flags:%x\n", v_addr, p_addr, flags);
@@ -235,8 +204,7 @@ BOOL addPageToPd(uint32* pd, char *v_addr, char *p_addr, int flags)
 
     int index = (((uint32) v_addr & 0xFFC00000) >> 22);
     pde = pd + index;
-    if ((*pde & PG_PRESENT) == PG_PRESENT)
-    {
+    if ((*pde & PG_PRESENT) == PG_PRESENT) {
         //Already assigned!
         Debug_PrintF("ERROR: addPageToPd(): pde:%x is already assigned!!\n", pde);
         return FALSE;
@@ -251,21 +219,16 @@ BOOL addPageToPd(uint32* pd, char *v_addr, char *p_addr, int flags)
 
     asm("invlpg %0"::"m"(v_addr));
 
-    if (v_addr <= (char*)(KERN_HEAP_END - PAGESIZE_4M))
-    {
-        if (pd == gKernelPageDirectory)
-        {
+    if (v_addr <= (char*)(KERN_HEAP_END - PAGESIZE_4M)) {
+        if (pd == gKernelPageDirectory) {
             syncPageDirectoriesKernelMemory();
         }
-        else
-        {
+        else {
             PANIC("Attemped to allocate kernel memory to a page directory which is not the kernel page directory!!!\n");
         }
     }
-    else
-    {
-        if (pd == gKernelPageDirectory)
-        {
+    else {
+        if (pd == gKernelPageDirectory) {
             //No panic here. Because we allow kernel to map anywhere!
         }
     }
@@ -273,16 +236,13 @@ BOOL addPageToPd(uint32* pd, char *v_addr, char *p_addr, int flags)
     return TRUE;
 }
 
-BOOL removePageFromPd(uint32* pd, char *v_addr, BOOL releasePageFrame)
-{
+BOOL removePageFromPd(uint32* pd, char *v_addr, BOOL releasePageFrame) {
     int index = (((uint32) v_addr & 0xFFC00000) >> 22);
     uint32* pde = pd + index;
-    if ((*pde & PG_PRESENT) == PG_PRESENT)
-    {
+    if ((*pde & PG_PRESENT) == PG_PRESENT) {
         uint32 p_addr = *pde & 0xFFC00000;
 
-        if (releasePageFrame)
-        {
+        if (releasePageFrame) {
             releasePageFrame4M(p_addr);
         }
 
@@ -290,10 +250,8 @@ BOOL removePageFromPd(uint32* pd, char *v_addr, BOOL releasePageFrame)
 
         asm("invlpg %0"::"m"(v_addr));
 
-        if (v_addr <= (char*)(KERN_HEAP_END - PAGESIZE_4M))
-        {
-            if (pd == gKernelPageDirectory)
-            {
+        if (v_addr <= (char*)(KERN_HEAP_END - PAGESIZE_4M)) {
+            if (pd == gKernelPageDirectory) {
                 syncPageDirectoriesKernelMemory();
             }
         }
@@ -304,24 +262,18 @@ BOOL removePageFromPd(uint32* pd, char *v_addr, BOOL releasePageFrame)
     return FALSE;
 }
 
-static void syncPageDirectoriesKernelMemory()
-{
+static void syncPageDirectoriesKernelMemory() {
     //get page directory list
     //it can be easier to traverse proccesses(and access its pd) here
-    for (int byte = 0; byte < RAM_AS_4M_PAGES / 8; byte++)
-    {
-        if (gKernelPageHeapBitmap[byte] != 0xFF)
-        {
-            for (int bit = 0; bit < 8; bit++)
-            {
-                if ((gKernelPageHeapBitmap[byte] & (1 << bit)))
-                {
+    for (int byte = 0; byte < RAM_AS_4M_PAGES / 8; byte++) {
+        if (gKernelPageHeapBitmap[byte] != 0xFF) {
+            for (int bit = 0; bit < 8; bit++) {
+                if ((gKernelPageHeapBitmap[byte] & (1 << bit))) {
                     int page = 8 * byte + bit;
 
                     uint32* pd = (uint32*)(page * PAGESIZE_4K);
 
-                    for (int i = 0; i < KERNELMEMORY_PAGE_COUNT; ++i)
-                    {
+                    for (int i = 0; i < KERNELMEMORY_PAGE_COUNT; ++i) {
                         pd[i] = gKernelPageDirectory[i];
                     }
                 }
@@ -330,18 +282,14 @@ static void syncPageDirectoriesKernelMemory()
     }
 }
 
-uint32 getTotalPageCount()
-{
+uint32 getTotalPageCount() {
     return gTotalPageCount;
 }
 
-uint32 getUsedPageCount()
-{
+uint32 getUsedPageCount() {
     int count = 0;
-    for (int i = 0; i < gTotalPageCount; ++i)
-    {
-        if(IS_PAGEFRAME_USED(gPhysicalPageFrameBitmap, i))
-        {
+    for (int i = 0; i < gTotalPageCount; ++i) {
+        if(IS_PAGEFRAME_USED(gPhysicalPageFrameBitmap, i)) {
             ++count;
         }
     }
@@ -349,13 +297,11 @@ uint32 getUsedPageCount()
     return count;
 }
 
-uint32 getFreePageCount()
-{
+uint32 getFreePageCount() {
     return gTotalPageCount - getUsedPageCount();
 }
 
-static void printPageFaultInfo(uint32 faultingAddress, Registers *regs)
-{
+static void printPageFaultInfo(uint32 faultingAddress, Registers *regs) {
     int present = regs->errorCode & 0x1;
     int rw = regs->errorCode & 0x2;
     int us = regs->errorCode & 0x4;
@@ -365,21 +311,18 @@ static void printPageFaultInfo(uint32 faultingAddress, Registers *regs)
     printkf("Page fault!!! When trying to %s %x - IP:%x\n", rw ? "write to" : "read from", faultingAddress, regs->eip);
     printkf("The page was %s\n", present ? "present" : "not present");
 
-    if (reserved)
-    {
+    if (reserved) {
         printkf("Reserved bit was set\n");
     }
 
-    if (id)
-    {
+    if (id) {
         printkf("Caused by an instruction fetch\n");
     }
 
     printkf("CPU was in %s\n", us ? "user-mode" : "supervisor mode");
 }
 
-static void handlePageFault(Registers *regs)
-{
+static void handlePageFault(Registers *regs) {
     // A page fault has occurred.
 
     // The faulting address is stored in the CR2 register.
@@ -390,30 +333,25 @@ static void handlePageFault(Registers *regs)
     //Debug_PrintF("stack of handler is %x\n", &faultingAddress);
 
     Thread* faultingThread = getCurrentThread();
-    if (NULL != faultingThread)
-    {
+    if (NULL != faultingThread) {
         Thread* mainThread = getMainKernelThread();
 
-        if (mainThread == faultingThread)
-        {
+        if (mainThread == faultingThread) {
             printPageFaultInfo(faultingAddress, regs);
 
             PANIC("Page fault in Kernel main thread!!!");
         }
-        else
-        {
+        else {
             printPageFaultInfo(faultingAddress, regs);
 
             Debug_PrintF("Faulting thread is %d\n", faultingThread->threadId);
 
-            if (faultingThread->userMode)
-            {
+            if (faultingThread->userMode) {
                 Debug_PrintF("Destroying process %d\n", faultingThread->owner->pid);
 
                 destroyProcess(faultingThread->owner);
             }
-            else
-            {
+            else {
                 Debug_PrintF("Destroying kernel thread %d\n", faultingThread->threadId);
 
                 destroyThread(faultingThread);
@@ -422,26 +360,22 @@ static void handlePageFault(Registers *regs)
             waitForSchedule();
         }
     }
-    else
-    {
+    else {
         printPageFaultInfo(faultingAddress, regs);
 
         PANIC("Page fault!!!");
     }
 }
 
-void initializeProcessMmap(Process* process)
-{
+void initializeProcessMmap(Process* process) {
     int page = 0;
 
-    for (page = 0; page < RAM_AS_4M_PAGES / 8; ++page)
-    {
+    for (page = 0; page < RAM_AS_4M_PAGES / 8; ++page) {
         process->mmappedVirtualMemory[page] = 0xFF;
     }
 
     //Virtual pages reserved for mmap
-    for (page = PAGE_INDEX_4M(USER_OFFSET_MMAP); page < (int)(PAGE_INDEX_4M(USER_OFFSET_MMAP_END)); ++page)
-    {
+    for (page = PAGE_INDEX_4M(USER_OFFSET_MMAP); page < (int)(PAGE_INDEX_4M(USER_OFFSET_MMAP_END)); ++page) {
 //?         printkf("reserving for mmap: %x\n", page*PAGESIZE_4M);
         SET_PAGEFRAME_UNUSED(process->mmappedVirtualMemory, page * PAGESIZE_4M);
     }
@@ -449,10 +383,8 @@ void initializeProcessMmap(Process* process)
 
 //this functions uses either pAddress or pAddressList
 //both of them must not be null!
-void* mapMemory(Process* process, uint32 nBytes, uint32 pAddress, List* pAddressList)
-{
-    if (nBytes == 0)
-    {
+void* mapMemory(Process* process, uint32 nBytes, uint32 pAddress, List* pAddressList) {
+    if (nBytes == 0) {
         return NULL;
     }
 
@@ -460,15 +392,12 @@ void* mapMemory(Process* process, uint32 nBytes, uint32 pAddress, List* pAddress
 
     int neededPages = (nBytes / PAGESIZE_4M) + 1;
 
-    if (pAddressList)
-    {
-        if (List_GetCount(pAddressList) < neededPages)
-        {
+    if (pAddressList) {
+        if (List_GetCount(pAddressList) < neededPages) {
             return NULL;
         }
     }
-    else if (0 == pAddress)
-    {
+    else if (0 == pAddress) {
         return NULL;
     }
 
@@ -476,61 +405,50 @@ void* mapMemory(Process* process, uint32 nBytes, uint32 pAddress, List* pAddress
 
     uint32 vMem = 0;
 
-    for (pageIndex = PAGE_INDEX_4M(USER_OFFSET_MMAP); pageIndex < (int)(PAGE_INDEX_4M(USER_OFFSET_MMAP_END)); ++pageIndex)
-    {
-        if (IS_PAGEFRAME_USED(process->mmappedVirtualMemory, pageIndex))
-        {
+    for (pageIndex = PAGE_INDEX_4M(USER_OFFSET_MMAP); pageIndex < (int)(PAGE_INDEX_4M(USER_OFFSET_MMAP_END)); ++pageIndex) {
+        if (IS_PAGEFRAME_USED(process->mmappedVirtualMemory, pageIndex)) {
             foundAdjacent = 0;
             vMem = 0;
         }
-        else
-        {
-            if (0 == foundAdjacent)
-            {
+        else {
+            if (0 == foundAdjacent) {
                 vMem = pageIndex * PAGESIZE_4M;
             }
             ++foundAdjacent;
         }
 
-        if (foundAdjacent == neededPages)
-        {
+        if (foundAdjacent == neededPages) {
             break;
         }
     }
 
     //Debug_PrintF("mapMemory: needed:%d foundAdjacent:%d vMem:%x\n", neededPages, foundAdjacent, vMem);
 
-    if (foundAdjacent == neededPages)
-    {
+    if (foundAdjacent == neededPages) {
         uint32 p = 0;
         ListNode* pListNode = NULL;
-        if (pAddressList)
-        {
+        if (pAddressList) {
             pListNode = List_GetFirstNode(pAddressList);
             p = (uint32)(uint32*)pListNode->data;
         }
-        else
-        {
+        else {
             p = pAddress;
         }
         p = p & 0xFFC00000;
         uint32 v = vMem;
-        for (int i = 0; i < neededPages; ++i)
-        {
+        for (int i = 0; i < neededPages; ++i) {
             addPageToPd(process->pd, (char*)v, (char*)p, PG_USER);
 
             SET_PAGEFRAME_USED(process->mmappedVirtualMemory, PAGE_INDEX_4M(v));
 
             v += PAGESIZE_4M;
 
-            if (pAddressList)
-            {
+            if (pAddressList) {
                 pListNode = pListNode->next;
                 p = (uint32)(uint32*)pListNode->data;
                 p = p & 0xFFC00000;
             }
-            else
-            {
+            else {
                 p += PAGESIZE_4M;
             }
         }
@@ -541,15 +459,12 @@ void* mapMemory(Process* process, uint32 nBytes, uint32 pAddress, List* pAddress
     return NULL;
 }
 
-BOOL unmapMemory(Process* process, uint32 nBytes, uint32 vAddress)
-{
-    if (nBytes == 0)
-    {
+BOOL unmapMemory(Process* process, uint32 nBytes, uint32 vAddress) {
+    if (nBytes == 0) {
         return FALSE;
     }
 
-    if (vAddress < USER_OFFSET_MMAP)
-    {
+    if (vAddress < USER_OFFSET_MMAP) {
         return FALSE;
     }
 
@@ -562,10 +477,8 @@ BOOL unmapMemory(Process* process, uint32 nBytes, uint32 vAddress)
 
     BOOL result = FALSE;
 
-    for (pageIndex = startIndex; pageIndex < endIndex; ++pageIndex)
-    {
-        if (IS_PAGEFRAME_USED(process->mmappedVirtualMemory, pageIndex))
-        {
+    for (pageIndex = startIndex; pageIndex < endIndex; ++pageIndex) {
+        if (IS_PAGEFRAME_USED(process->mmappedVirtualMemory, pageIndex)) {
             char* vAddr = (char*)(pageIndex * PAGESIZE_4M);
 
             removePageFromPd(process->pd, vAddr, FALSE);