Header guards (#pragma once) for all kernel headers
This commit is contained in:
parent
ada9625a1b
commit
a14ba848b3
17 changed files with 68 additions and 1 deletions
|
@ -1,3 +1,9 @@
|
|||
#pragma once
|
||||
|
||||
#include "types.h"
|
||||
#include "sleeplock.h"
|
||||
#include "fs.h"
|
||||
|
||||
struct buf {
|
||||
int valid; // has data been read from disk?
|
||||
int disk; // does disk "own" buf?
|
||||
|
|
|
@ -1,3 +1,8 @@
|
|||
#pragma once
|
||||
|
||||
#include "riscv.h"
|
||||
#include "types.h"
|
||||
|
||||
struct buf;
|
||||
struct context;
|
||||
struct file;
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
#pragma once
|
||||
|
||||
#include "types.h"
|
||||
|
||||
// Format of an ELF executable file
|
||||
|
||||
#define ELF_MAGIC 0x464C457FU // "\x7FELF" in little endian
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
#pragma once
|
||||
|
||||
#define O_RDONLY 0x000
|
||||
#define O_WRONLY 0x001
|
||||
#define O_RDWR 0x002
|
||||
|
|
|
@ -1,3 +1,9 @@
|
|||
#pragma once
|
||||
|
||||
#include "types.h"
|
||||
#include "sleeplock.h"
|
||||
#include "fs.h"
|
||||
|
||||
struct file {
|
||||
enum { FD_NONE, FD_PIPE, FD_INODE, FD_DEVICE } type;
|
||||
int ref; // reference count
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
#pragma once
|
||||
|
||||
#include "types.h"
|
||||
|
||||
// On-disk file system format.
|
||||
// Both the kernel and user programs use this header file.
|
||||
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
#pragma once
|
||||
|
||||
// Physical memory layout
|
||||
|
||||
// qemu -machine virt is set up like this,
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
#pragma once
|
||||
|
||||
#define NPROC 64 // maximum number of processes
|
||||
#define NCPU 8 // maximum number of CPUs
|
||||
#define NOFILE 16 // open files per process
|
||||
|
|
|
@ -1,3 +1,10 @@
|
|||
#pragma once
|
||||
|
||||
#include "types.h"
|
||||
#include "param.h"
|
||||
#include "riscv.h"
|
||||
#include "spinlock.h"
|
||||
|
||||
// Saved registers for kernel context switches.
|
||||
struct context {
|
||||
u64 ra;
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
#pragma once
|
||||
|
||||
#include "types.h"
|
||||
|
||||
#ifndef __ASSEMBLER__
|
||||
|
||||
// which hart (core) is this?
|
||||
|
|
|
@ -1,3 +1,8 @@
|
|||
#pragma once
|
||||
|
||||
#include "types.h"
|
||||
#include "spinlock.h"
|
||||
|
||||
// Long-term locks for processes
|
||||
struct sleeplock {
|
||||
u32 locked; // Is the lock held?
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
#pragma once
|
||||
|
||||
#include "types.h"
|
||||
|
||||
// Mutual exclusion lock.
|
||||
struct spinlock {
|
||||
u32 locked; // Is the lock held?
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
#pragma once
|
||||
|
||||
#include "types.h"
|
||||
|
||||
#define T_DIR 1 // Directory
|
||||
#define T_FILE 2 // File
|
||||
#define T_DEVICE 3 // Device
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
#pragma once
|
||||
|
||||
// System call numbers
|
||||
#define SYS_fork 1
|
||||
#define SYS_exit 2
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
#pragma once
|
||||
|
||||
typedef unsigned char u8;
|
||||
typedef unsigned short u16;
|
||||
typedef unsigned int u32;
|
||||
|
|
|
@ -1,4 +1,7 @@
|
|||
//
|
||||
#pragma once
|
||||
|
||||
#include "types.h"
|
||||
|
||||
// virtio device definitions.
|
||||
// for both the mmio interface, and virtio descriptors.
|
||||
// only tested with qemu.
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
#pragma once
|
||||
|
||||
#include "../kernel/types.h"
|
||||
|
||||
struct stat;
|
||||
|
||||
// system calls
|
||||
|
@ -22,6 +26,7 @@ int getpid(void);
|
|||
char *sbrk(int);
|
||||
int sleep(int);
|
||||
int uptime(void);
|
||||
int trace(int);
|
||||
|
||||
// ulib.c
|
||||
int stat(const char *, struct stat *);
|
||||
|
|
Loading…
Reference in a new issue