diff --git a/asm.h b/asm.h index b8a7353e4c..599479c818 100644 --- a/asm.h +++ b/asm.h @@ -1,3 +1,5 @@ +#ifndef ASM_H_5FC4D1F4_CAAF_11EE_AA2B_90B11C0C0FF8 +#define ASM_H_5FC4D1F4_CAAF_11EE_AA2B_90B11C0C0FF8 // // assembler macros to create x86 segments // @@ -16,3 +18,4 @@ #define STA_X 0x8 // Executable segment #define STA_W 0x2 // Writeable (non-executable segments) #define STA_R 0x2 // Readable (executable segments) +#endif diff --git a/buf.h b/buf.h index 3266495cf3..61e8145eba 100644 --- a/buf.h +++ b/buf.h @@ -1,3 +1,5 @@ +#ifndef BUF_H_5FB86900_CAAF_11EE_8313_90B11C0C0FF8 +#define BUF_H_5FB86900_CAAF_11EE_8313_90B11C0C0FF8 struct buf { int flags; uint dev; @@ -12,3 +14,4 @@ struct buf { #define B_VALID 0x2 // buffer has been read from disk #define B_DIRTY 0x4 // buffer needs to be written to disk +#endif diff --git a/date.h b/date.h index 94aec4b77d..c393c4f62f 100644 --- a/date.h +++ b/date.h @@ -1,3 +1,5 @@ +#ifndef DATE_H_5FBD64BE_CAAF_11EE_B4B1_90B11C0C0FF8 +#define DATE_H_5FBD64BE_CAAF_11EE_B4B1_90B11C0C0FF8 struct rtcdate { uint second; uint minute; @@ -6,3 +8,4 @@ struct rtcdate { uint month; uint year; }; +#endif diff --git a/defs.h b/defs.h index 82fb982837..bb3f5dc11a 100644 --- a/defs.h +++ b/defs.h @@ -1,3 +1,5 @@ +#ifndef DEFS_H_5FCEEDA6_CAAF_11EE_B851_90B11C0C0FF8 +#define DEFS_H_5FCEEDA6_CAAF_11EE_B851_90B11C0C0FF8 struct buf; struct context; struct file; @@ -188,3 +190,4 @@ void clearpteu(pde_t *pgdir, char *uva); // number of elements in fixed-size array #define NELEM(x) (sizeof(x)/sizeof((x)[0])) +#endif diff --git a/elf.h b/elf.h index d16c96753a..5dcb4cb756 100644 --- a/elf.h +++ b/elf.h @@ -1,3 +1,5 @@ +#ifndef ELF_H_5FA195AE_CAAF_11EE_8AD1_90B11C0C0FF8 +#define ELF_H_5FA195AE_CAAF_11EE_8AD1_90B11C0C0FF8 // Format of an ELF executable file #define ELF_MAGIC 0x464C457FU // "\x7FELF" in little endian @@ -40,3 +42,4 @@ struct proghdr { #define ELF_PROG_FLAG_EXEC 1 #define ELF_PROG_FLAG_WRITE 2 #define ELF_PROG_FLAG_READ 4 +#endif diff --git a/fcntl.h b/fcntl.h index d565483ad9..8d26504958 100644 --- a/fcntl.h +++ b/fcntl.h @@ -1,4 +1,7 @@ +#ifndef FCNTL_H_5FB34556_CAAF_11EE_8D47_90B11C0C0FF8 +#define FCNTL_H_5FB34556_CAAF_11EE_8D47_90B11C0C0FF8 #define O_RDONLY 0x000 #define O_WRONLY 0x001 #define O_RDWR 0x002 #define O_CREATE 0x200 +#endif diff --git a/file.h b/file.h index 0990c82f46..f32685e094 100644 --- a/file.h +++ b/file.h @@ -1,3 +1,5 @@ +#ifndef FILE_H_5FBFEB30_CAAF_11EE_B018_90B11C0C0FF8 +#define FILE_H_5FBFEB30_CAAF_11EE_B018_90B11C0C0FF8 struct file { enum { FD_NONE, FD_PIPE, FD_INODE } type; int ref; // reference count @@ -35,3 +37,4 @@ struct devsw { extern struct devsw devsw[]; #define CONSOLE 1 +#endif diff --git a/fs.h b/fs.h index 3214f1d7f7..6ee818cdbc 100644 --- a/fs.h +++ b/fs.h @@ -1,3 +1,5 @@ +#ifndef FS_H_5FC27350_CAAF_11EE_8DCB_90B11C0C0FF8 +#define FS_H_5FC27350_CAAF_11EE_8DCB_90B11C0C0FF8 // On-disk file system format. // Both the kernel and user programs use this header file. @@ -55,3 +57,4 @@ struct dirent { char name[DIRSIZ]; }; +#endif diff --git a/kbd.h b/kbd.h index babbd6ed4e..79da4876f8 100644 --- a/kbd.h +++ b/kbd.h @@ -1,3 +1,5 @@ +#ifndef KBD_H_5FC7143C_CAAF_11EE_A572_90B11C0C0FF8 +#define KBD_H_5FC7143C_CAAF_11EE_A572_90B11C0C0FF8 // PC keyboard interface constants #define KBSTATP 0x64 // kbd controller status port(I) @@ -110,3 +112,4 @@ static uchar ctlmap[256] = [0xD2] KEY_INS, [0xD3] KEY_DEL }; +#endif diff --git a/memlayout.h b/memlayout.h index d1615f7abc..e85069d301 100644 --- a/memlayout.h +++ b/memlayout.h @@ -1,3 +1,5 @@ +#ifndef MEMLAYOUT_H_5FABE5CC_CAAF_11EE_9944_90B11C0C0FF8 +#define MEMLAYOUT_H_5FABE5CC_CAAF_11EE_9944_90B11C0C0FF8 // Memory layout #define EXTMEM 0x100000 // Start of extended memory @@ -13,3 +15,4 @@ #define V2P_WO(x) ((x) - KERNBASE) // same as V2P, but without casts #define P2V_WO(x) ((x) + KERNBASE) // same as P2V, but without casts +#endif diff --git a/mmu.h b/mmu.h index a82d8e26ec..c347d68fde 100644 --- a/mmu.h +++ b/mmu.h @@ -1,3 +1,5 @@ +#ifndef MMU_H_5FCC4614_CAAF_11EE_B100_90B11C0C0FF8 +#define MMU_H_5FCC4614_CAAF_11EE_B100_90B11C0C0FF8 // This file contains definitions for the // x86 memory management unit (MMU). @@ -179,3 +181,4 @@ struct gatedesc { } #endif +#endif diff --git a/mp.h b/mp.h index 4d172839bb..18c97c1927 100644 --- a/mp.h +++ b/mp.h @@ -1,3 +1,5 @@ +#ifndef MP_H_5FA4371E_CAAF_11EE_9652_90B11C0C0FF8 +#define MP_H_5FA4371E_CAAF_11EE_9652_90B11C0C0FF8 // See MultiProcessor Specification Version 1.[14] struct mp { // floating pointer @@ -54,3 +56,4 @@ struct mpioapic { // I/O APIC table entry //PAGEBREAK! // Blank page. +#endif diff --git a/param.h b/param.h index a7e90efff4..a8e11347c3 100644 --- a/param.h +++ b/param.h @@ -1,3 +1,5 @@ +#ifndef PARAM_H_5FA945E2_CAAF_11EE_ADF4_90B11C0C0FF8 +#define PARAM_H_5FA945E2_CAAF_11EE_ADF4_90B11C0C0FF8 #define NPROC 64 // maximum number of processes #define KSTACKSIZE 4096 // size of per-process kernel stack #define NCPU 8 // maximum number of CPUs @@ -12,3 +14,4 @@ #define NBUF (MAXOPBLOCKS*3) // size of disk block cache #define FSSIZE 1000 // size of file system in blocks +#endif diff --git a/proc.h b/proc.h index 1647114179..827a69a564 100644 --- a/proc.h +++ b/proc.h @@ -1,3 +1,5 @@ +#ifndef PROC_H_5FBAE11C_CAAF_11EE_B85B_90B11C0C0FF8 +#define PROC_H_5FBAE11C_CAAF_11EE_B85B_90B11C0C0FF8 // Per-CPU state struct cpu { uchar apicid; // Local APIC ID @@ -56,3 +58,4 @@ struct proc { // original data and bss // fixed-size stack // expandable heap +#endif diff --git a/sleeplock.h b/sleeplock.h index 110e6f3d7f..de77151dfd 100644 --- a/sleeplock.h +++ b/sleeplock.h @@ -1,3 +1,5 @@ +#ifndef SLEEPLOCK_H_5FB5EE8C_CAAF_11EE_B022_90B11C0C0FF8 +#define SLEEPLOCK_H_5FB5EE8C_CAAF_11EE_B022_90B11C0C0FF8 // Long-term locks for processes struct sleeplock { uint locked; // Is the lock held? @@ -8,3 +10,4 @@ struct sleeplock { int pid; // Process holding lock }; +#endif diff --git a/spinlock.h b/spinlock.h index 0a9d8e23a7..ce6fdb3bf4 100644 --- a/spinlock.h +++ b/spinlock.h @@ -1,3 +1,5 @@ +#ifndef SPINLOCK_H_5FAE6694_CAAF_11EE_AA29_90B11C0C0FF8 +#define SPINLOCK_H_5FAE6694_CAAF_11EE_AA29_90B11C0C0FF8 // Mutual exclusion lock. struct spinlock { uint locked; // Is the lock held? @@ -9,3 +11,4 @@ struct spinlock { // that locked the lock. }; +#endif diff --git a/stat.h b/stat.h index 8a809339f4..d439bd9b9f 100644 --- a/stat.h +++ b/stat.h @@ -1,3 +1,5 @@ +#ifndef STAT_H_5F9EF308_CAAF_11EE_9131_90B11C0C0FF8 +#define STAT_H_5F9EF308_CAAF_11EE_9131_90B11C0C0FF8 #define T_DIR 1 // Directory #define T_FILE 2 // File #define T_DEV 3 // Device @@ -9,3 +11,4 @@ struct stat { short nlink; // Number of links to file uint size; // Size of file in bytes }; +#endif diff --git a/syscall.h b/syscall.h index bc5f35651c..bedbf85d94 100644 --- a/syscall.h +++ b/syscall.h @@ -1,3 +1,5 @@ +#ifndef SYSCALL_H_5FC98D3E_CAAF_11EE_81F6_90B11C0C0FF8 +#define SYSCALL_H_5FC98D3E_CAAF_11EE_81F6_90B11C0C0FF8 // System call numbers #define SYS_fork 1 #define SYS_exit 2 @@ -20,3 +22,4 @@ #define SYS_link 19 #define SYS_mkdir 20 #define SYS_close 21 +#endif diff --git a/traps.h b/traps.h index 0bd1fd8454..d570f1be88 100644 --- a/traps.h +++ b/traps.h @@ -1,3 +1,5 @@ +#ifndef TRAPS_H_5FD18188_CAAF_11EE_ADFC_90B11C0C0FF8 +#define TRAPS_H_5FD18188_CAAF_11EE_ADFC_90B11C0C0FF8 // x86 trap and interrupt constants. // Processor-defined: @@ -36,3 +38,4 @@ #define IRQ_ERROR 19 #define IRQ_SPURIOUS 31 +#endif diff --git a/types.h b/types.h index e4adf644ae..c9b2426c59 100644 --- a/types.h +++ b/types.h @@ -1,4 +1,7 @@ +#ifndef TYPES_H_5FA6C7AE_CAAF_11EE_B06B_90B11C0C0FF8 +#define TYPES_H_5FA6C7AE_CAAF_11EE_B06B_90B11C0C0FF8 typedef unsigned int uint; typedef unsigned short ushort; typedef unsigned char uchar; typedef uint pde_t; +#endif diff --git a/user.h b/user.h index 4f99c52ba6..0acb10e457 100644 --- a/user.h +++ b/user.h @@ -1,3 +1,5 @@ +#ifndef USER_H_5FB0CF7E_CAAF_11EE_B782_90B11C0C0FF8 +#define USER_H_5FB0CF7E_CAAF_11EE_B782_90B11C0C0FF8 struct stat; struct rtcdate; @@ -37,3 +39,4 @@ void* memset(void*, int, uint); void* malloc(uint); void free(void*); int atoi(const char*); +#endif diff --git a/x86.h b/x86.h index 07312a539f..5414af3923 100644 --- a/x86.h +++ b/x86.h @@ -1,3 +1,5 @@ +#ifndef X86_H_5F9C3CA8_CAAF_11EE_B26D_90B11C0C0FF8 +#define X86_H_5F9C3CA8_CAAF_11EE_B26D_90B11C0C0FF8 // Routines to let C code use special x86 instructions. static inline uchar @@ -181,3 +183,4 @@ struct trapframe { ushort ss; ushort padding6; }; +#endif