-#ifndef HEADER_16550A_H
-#define HEADER_16550A_H 1
+#ifndef DEVICES_16550A_H
+#define DEVICES_16550A_H
#include <debug.h>
#include <stdbool.h>
#define MSR_RI 0x40 /* Ring Indicator. */
#define MSR_DCD 0x80 /* Data Carrier Detect. */
-#endif /* 16550a.h */
+#endif /* devices/16550a.h */
-#ifndef HEADER_DISK_H
-#define HEADER_DISK_H 1
+#ifndef DEVICES_DISK_H
+#define DEVICES_DISK_H
#include <inttypes.h>
#include <stdint.h>
void disk_read (struct disk *, disk_sector_t, void *);
void disk_write (struct disk *, disk_sector_t, const void *);
-#endif /* disk.h */
+#endif /* devices/disk.h */
-#ifndef HEADER_KBD_H
-#define HEADER_KBD_H 1
+#ifndef DEVICES_KBD_H
+#define DEVICES_KBD_H
void kbd_init (void);
-#endif /* kbd.h */
+#endif /* devices/kbd.h */
-#ifndef HEADER_SERIAL_H
-#define HEADER_SERIAL_H 1
+#ifndef DEVICES_SERIAL_H
+#define DEVICES_SERIAL_H
#include <stdint.h>
void serial_init (void);
void serial_outb (uint8_t);
-#endif /* serial.h */
+#endif /* devices/serial.h */
-#ifndef HEADER_TIMER_H
-#define HEADER_TIMER_H 1
+#ifndef DEVICES_TIMER_H
+#define DEVICES_TIMER_H
#include <stdint.h>
void timer_usleep (int64_t us);
void timer_nsleep (int64_t ns);
-#endif /* timer.h */
+#endif /* devices/timer.h */
-#ifndef HEADER_VGA_H
-#define HEADER_VGA_H 1
+#ifndef DEVICES_VGA_H
+#define DEVICES_VGA_H
void vga_init (void);
void vga_putc (int);
-#endif /* vga.h */
+#endif /* devices/vga.h */
-#ifndef HEADER_DIRECTORY_H
-#define HEADER_DIRECTORY_H 1
+#ifndef FILESYS_DIRECTORY_H
+#define FILESYS_DIRECTORY_H
#include <stdbool.h>
#include <stddef.h>
void dir_list (const struct dir *);
void dir_dump (const struct dir *);
-#endif /* directory.h */
+#endif /* filesys/directory.h */
-#ifndef HEADER_FILE_H
-#define HEADER_FILE_H 1
+#ifndef FILESYS_FILE_H
+#define FILESYS_FILE_H
#include <stdbool.h>
#include <stdint.h>
void file_seek (struct file *, off_t);
off_t file_tell (struct file *);
-#endif /* file.h */
+#endif /* filesys/file.h */
-#ifndef HEADER_FILEHDR_H
-#define HEADER_FILEHDR_H 1
+#ifndef FILESYS_FILEHDR_H
+#define FILESYS_FILEHDR_H
#include <stdbool.h>
#include <stddef.h>
off_t filehdr_length (const struct filehdr *);
void filehdr_print (const struct filehdr *);
-#endif /* filehdr.h */
+#endif /* filesys/filehdr.h */
-#ifndef HEADER_FILESYS_H
-#define HEADER_FILESYS_H 1
+#ifndef FILESYS_FILESYS_H
+#define FILESYS_FILESYS_H
#include <stdbool.h>
#include <stdint.h>
void filesys_self_test (void);
-#endif /* filesys.h */
+#endif /* filesys/filesys.h */
-#ifndef HEADER_FSUTIL_H
-#define HEADER_FSUTIL_H 1
+#ifndef FILESYS_FSUTIL_H
+#define FILESYS_FSUTIL_H
#include <stdbool.h>
void fsutil_run (void);
void fsutil_print (const char *filename);
-#endif /* fsutil.h */
+#endif /* filesys/fsutil.h */
-#ifndef HEADER_OFF_T_H
-#define HEADER_OFF_T_H 1
+#ifndef FILESYS_OFF_T_H
+#define FILESYS_OFF_T_H
#include <stdint.h>
definition but not any others. */
typedef int32_t off_t;
-#endif /* off_t.h */
+#endif /* filesys/off_t.h */
-#ifndef LIB_CTYPE_H
-#define LIB_CTYPE_H 1
+#ifndef __LIB_CTYPE_H
+#define __LIB_CTYPE_H
static inline int islower (int c) { return c >= 'a' && c <= 'z'; }
static inline int isupper (int c) { return c >= 'A' && c <= 'Z'; }
-#ifndef HEADER_DEBUG_H
-#define HEADER_DEBUG_H 1
+#ifndef __LIB_DEBUG_H
+#define __LIB_DEBUG_H
/* GCC lets us add "attributes" to functions, function
parameters, etc. to indicate their properties.
#else
#define ASSERT(CONDITION) ((void) 0)
#define NOT_REACHED() for (;;)
-#endif
+#endif /* lib/debug.h */
-#ifndef LIB_INTTYPES_H
-#define LIB_INTTYPES_H
+#ifndef __LIB_INTTYPES_H
+#define __LIB_INTTYPES_H
#define PRId8 "hhd"
#define PRId16 "hd"
-#ifndef HEADER_BITMAP_H
-#define HEADER_BITMAP_H 1
+#ifndef __LIB_KERNEL_BITMAP_H
+#define __LIB_KERNEL_BITMAP_H
#include <stdbool.h>
#include <stddef.h>
void bitmap_dump (const struct bitmap *);
-#endif /* bitmap.h */
+#endif /* lib/kernel/bitmap.h */
-#ifndef HEADER_HASH_H
-#define HEADER_HASH_H 1
+#ifndef __LIB_KERNEL_HASH_H
+#define __LIB_KERNEL_HASH_H
/* Hash table.
unsigned hash_string (const char *);
unsigned hash_int (int);
-#endif /* hash.h */
+#endif /* lib/kernel/hash.h */
-#ifndef HEADER_LIST_H
-#define HEADER_LIST_H 1
+#ifndef __LIB_KERNEL_LIST_H
+#define __LIB_KERNEL_LIST_H
/* Doubly linked list.
void list_unique (struct list *, struct list *duplicates,
list_less_func *, void *aux);
-#endif /* list.h */
+#endif /* lib/kernel/list.h */
-#ifndef LIB_LIMITS_H
-#define LIB_LIMITS_H
+#ifndef __LIB_LIMITS_H
+#define __LIB_LIMITS_H
#define CHAR_BIT 8
-#ifndef HEADER_RANDOM_H
-#define HEADER_RANDOM_H 1
+#ifndef __LIB_RANDOM_H
+#define __LIB_RANDOM_H
#include <stddef.h>
void random_bytes (void *, size_t);
unsigned long random_ulong (void);
-#endif /* random.h */
+#endif /* lib/random.h */
-#ifndef LIB_ROUND_H
-#define LIB_ROUND_H
+#ifndef __LIB_ROUND_H
+#define __LIB_ROUND_H
/* Yields X rounded up to the nearest multiple of STEP.
For X >= 0, STEP >= 1 only. */
-#ifndef LIB_STDARG_H
-#define LIB_STDARG_H
+#ifndef __LIB_STDARG_H
+#define __LIB_STDARG_H
/* GCC has <stdarg.h> functionality as built-ins,
so all we need is to use it. */
-#ifndef LIB_STDBOOL_H
-#define LIB_STDBOOL_H
+#ifndef __LIB_STDBOOL_H
+#define __LIB_STDBOOL_H
#define bool _Bool
#define true 1
-#ifndef LIB_STDDEF_H
-#define LIB_STDDEF_H
+#ifndef __LIB_STDDEF_H
+#define __LIB_STDDEF_H
#define NULL ((void *) 0)
#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *) 0)->MEMBER)
-#ifndef LIB_STDINT_H
-#define LIB_STDINT_H
+#ifndef __LIB_STDINT_H
+#define __LIB_STDINT_H
typedef signed char int8_t;
#define INT8_MAX 127
-#ifndef LIB_STDIO_H
-#define LIB_STDIO_H
+#ifndef __LIB_STDIO_H
+#define __LIB_STDIO_H
#include <debug.h>
#include <stdbool.h>
-#ifndef LIB_STDLIB_H
-#define LIB_STDLIB_H
+#ifndef __LIB_STDLIB_H
+#define __LIB_STDLIB_H
#include "stddef.h"
-#ifndef LIB_STRING_H
-#define LIB_STRING_H 1
+#ifndef __LIB_STRING_H
+#define __LIB_STRING_H
#include "stddef.h"
-#ifndef LIB_SYSCALL_NR_H
-#define LIB_SYSCALL_NR_H 1
+#ifndef __LIB_SYSCALL-NR_H
+#define __LIB_SYSCALL-NR_H
/* System call numbers. */
#define SYS_halt 0 /* Halts the operating system. */
-#ifndef LIB_USER_SYSCALL_STUB_H
-#define LIB_USER_SYSCALL_STUB_H 1
+#ifndef __LIB_USER_SYSCALL-STUB_H
+#define __LIB_USER_SYSCALL-STUB_H
int syscall (int nr, ...);
-#ifndef LIB_USER_SYSCALL_H
-#define LIB_USER_SYSCALL_H 1
+#ifndef __LIB_USER_SYSCALL_H
+#define __LIB_USER_SYSCALL_H
#include <stdbool.h>
#include <debug.h>
-#ifndef LIB_USER_H
-#define LIB_USER_H 1
+#ifndef __LIB_USER_USER_H
+#define __LIB_USER_USER_H
#ifdef KERNEL
#error This header is user-only.
void exit (int);
void abort (void);
-#endif /* lib/user.h */
+#endif /* lib/user/user.h */
-#ifndef HEADER_INIT_H
-#define HEADER_INIT_H 1
+#ifndef THREADS_INIT_H
+#define THREADS_INIT_H
#include <stddef.h>
/* Physical memory size, in 4 kB pages. */
size_t ram_pages;
-#endif /* init.h */
+#endif /* threads/init.h */
-#ifndef HEADER_INTERRUPT_H
-#define HEADER_INTERRUPT_H 1
+#ifndef THREADS_INTERRUPT_H
+#define THREADS_INTERRUPT_H
#include <stdbool.h>
#include <stdint.h>
void intr_dump_frame (const struct intr_frame *);
const char *intr_name (uint8_t vec);
-#endif /* interrupt.h */
+#endif /* threads/interrupt.h */
-#ifndef HEADER_INTR_STUBS_H
-#define HEADER_INTR_STUBS_H
+#ifndef THREADS_INTR-STUBS_H
+#define THREADS_INTR-STUBS_H
/* Interrupt stubs.
/* Interrupt return path. */
void intr_exit (void);
-#endif /* intr-stubs.h */
+#endif /* threads/intr-stubs.h */
* the copyright notices, if any, listed below.
*/
-#ifndef HEADER_IO_H
-#define HEADER_IO_H 1
+#ifndef THREADS_IO_H
+#define THREADS_IO_H
#include <stddef.h>
#include <stdint.h>
: "cc");
}
-#endif /* io.h */
+#endif /* threads/io.h */
-#ifndef HEADER_LOADER_H
-#define HEADER_LOADER_H
+#ifndef THREADS_LOADER_H
+#define THREADS_LOADER_H
/* Constants fixed by the PC BIOS. */
#define LOADER_BASE 0x7c00 /* Physical address of loader's base. */
#define SEL_KCSEG 0x08 /* Kernel code selector. */
#define SEL_KDSEG 0x10 /* Kernel data selector. */
-#endif /* loader.h */
+#endif /* threads/loader.h */
-#ifndef HEADER_MALLOC_H
-#define HEADER_MALLOC_H
+#ifndef THREADS_MALLOC_H
+#define THREADS_MALLOC_H
#include <debug.h>
#include <stddef.h>
void *calloc (size_t, size_t) __attribute__ ((malloc));
void free (void *);
-#endif /* malloc.h */
+#endif /* threads/malloc.h */
-#ifndef HEADER_MMU_H
-#define HEADER_MMU_H 1
+#ifndef THREADS_MMU_H
+#define THREADS_MMU_H
#ifndef __ASSEMBLER__
#include <debug.h>
#define FLAG_MBS 0x00000002 /* Must be set. */
#define FLAG_IF 0x00000200 /* Interrupt Flag. */
-#endif /* mmu.h */
+#endif /* threads/mmu.h */
-#ifndef HEADER_PAGING_H
-#define HEADER_PAGING_H 1
+#ifndef THREADS_PAGING_H
+#define THREADS_PAGING_H
#include <stdbool.h>
#include <stdint.h>
void pagedir_activate (uint32_t *pagedir);
-#endif /* paging.h */
+#endif /* threads/paging.h */
-#ifndef HEADER_PALLOC_H
-#define HEADER_PALLOC_H 1
+#ifndef THREADS_PALLOC_H
+#define THREADS_PALLOC_H
#include <stdint.h>
void *palloc_get (enum palloc_flags);
void palloc_free (void *);
-#endif /* palloc.h */
+#endif /* threads/palloc.h */
-#ifndef HEADER_SWITCH_H
-#define HEADER_SWITCH_H 1
+#ifndef THREADS_SWITCH_H
+#define THREADS_SWITCH_H
#ifndef __ASSEMBLER__
/* switch_thread()'s stack frame. */
#define SWITCH_CUR 20
#define SWITCH_NEXT 24
-#endif /* switch.h */
+#endif /* threads/switch.h */
-#ifndef HEADER_SYNCH_H
-#define HEADER_SYNCH_H 1
+#ifndef THREADS_SYNCH_H
+#define THREADS_SYNCH_H
#include <list.h>
#include <stdbool.h>
void cond_broadcast (struct condition *, struct lock *);
const char *cond_name (const struct condition *);
-#endif /* synch.h */
+#endif /* threads/synch.h */
-#ifndef HEADER_THREAD_H
-#define HEADER_THREAD_H 1
+#ifndef THREADS_THREAD_H
+#define THREADS_THREAD_H
#include <debug.h>
#include <list.h>
void thread_yield (void);
void thread_block (void);
-#endif /* thread.h */
+#endif /* threads/thread.h */
-#ifndef HEADER_ADDRSPACE_H
-#define HEADER_ADDRSPACE_H 1
+#ifndef USERPROG_ADDRSPACE_H
+#define USERPROG_ADDRSPACE_H
#include <stdbool.h>
void addrspace_destroy (struct thread *);
void addrspace_activate (struct thread *);
-#endif /* addrspace.h */
+#endif /* userprog/addrspace.h */
-#ifndef HEADER_EXCEPTION_H
-#define HEADER_EXCEPTION_H 1
+#ifndef USERPROG_EXCEPTION_H
+#define USERPROG_EXCEPTION_H
void exception_init (void);
-#endif /* exception.h */
+#endif /* userprog/exception.h */
-#ifndef HEADER_GDT_H
-#define HEADER_GDT_H 1
+#ifndef USERPROG_GDT_H
+#define USERPROG_GDT_H
#include "threads/loader.h"
void gdt_init (void);
-#endif /* gdt.h */
+#endif /* userprog/gdt.h */
-#ifndef HEADER_SYSCALL_H
-#define HEADER_SYSCALL_H 1
+#ifndef USERPROG_SYSCALL_H
+#define USERPROG_SYSCALL_H
void syscall_init (void);
-#endif /* syscall.h */
+#endif /* userprog/syscall.h */
-#ifndef HEADER_TSS_H
-#define HEADER_TSS_H
+#ifndef USERPROG_TSS_H
+#define USERPROG_TSS_H
#include <stdint.h>
struct tss *tss_get (void);
void tss_set_esp0 (uint8_t *);
-#endif /* tss.h */
+#endif /* userprog/tss.h */