root/kernel/defs.h

/* [<][>][^][v][top][bottom][index][help] */

INCLUDED FROM


   1 struct buf;
   2 struct context;
   3 struct file;
   4 struct inode;
   5 struct pipe;
   6 struct proc;
   7 struct spinlock;
   8 struct sleeplock;
   9 struct stat;
  10 struct superblock;
  11 
  12 // bio.c
  13 void            binit(void);
  14 struct buf*     bread(uint, uint);
  15 void            brelse(struct buf*);
  16 void            bwrite(struct buf*);
  17 void            bpin(struct buf*);
  18 void            bunpin(struct buf*);
  19 
  20 // console.c
  21 void            consoleinit(void);
  22 void            consoleintr(int);
  23 void            consputc(int);
  24 
  25 // exec.c
  26 int             kexec(char*, char**);
  27 
  28 // file.c
  29 struct file*    filealloc(void);
  30 void            fileclose(struct file*);
  31 struct file*    filedup(struct file*);
  32 void            fileinit(void);
  33 int             fileread(struct file*, uint64, int n);
  34 int             filestat(struct file*, uint64 addr);
  35 int             filewrite(struct file*, uint64, int n);
  36 
  37 // fs.c
  38 void            fsinit(int);
  39 int             dirlink(struct inode*, char*, uint);
  40 struct inode*   dirlookup(struct inode*, char*, uint*);
  41 struct inode*   ialloc(uint, short);
  42 struct inode*   idup(struct inode*);
  43 void            iinit();
  44 void            ilock(struct inode*);
  45 void            iput(struct inode*);
  46 void            iunlock(struct inode*);
  47 void            iunlockput(struct inode*);
  48 void            iupdate(struct inode*);
  49 int             namecmp(const char*, const char*);
  50 struct inode*   namei(char*);
  51 struct inode*   nameiparent(char*, char*);
  52 int             readi(struct inode*, int, uint64, uint, uint);
  53 void            stati(struct inode*, struct stat*);
  54 int             writei(struct inode*, int, uint64, uint, uint);
  55 void            itrunc(struct inode*);
  56 void            ireclaim(int);
  57 
  58 // kalloc.c
  59 void*           kalloc(void);
  60 void            kfree(void *);
  61 void            kinit(void);
  62 
  63 // log.c
  64 void            initlog(int, struct superblock*);
  65 void            log_write(struct buf*);
  66 void            begin_op(void);
  67 void            end_op(void);
  68 
  69 // pipe.c
  70 int             pipealloc(struct file**, struct file**);
  71 void            pipeclose(struct pipe*, int);
  72 int             piperead(struct pipe*, uint64, int);
  73 int             pipewrite(struct pipe*, uint64, int);
  74 
  75 // printf.c
  76 int             printf(char*, ...) __attribute__ ((format (printf, 1, 2)));
  77 void            panic(char*) __attribute__((noreturn));
  78 void            printfinit(void);
  79 
  80 // proc.c
  81 int             cpuid(void);
  82 void            kexit(int);
  83 int             kfork(void);
  84 int             growproc(int);
  85 void            proc_mapstacks(pagetable_t);
  86 pagetable_t     proc_pagetable(struct proc *);
  87 void            proc_freepagetable(pagetable_t, uint64);
  88 int             kkill(int);
  89 int             killed(struct proc*);
  90 void            setkilled(struct proc*);
  91 struct cpu*     mycpu(void);
  92 struct proc*    myproc();
  93 void            procinit(void);
  94 void            scheduler(void) __attribute__((noreturn));
  95 void            sched(void);
  96 void            sleep(void*, struct spinlock*);
  97 void            userinit(void);
  98 int             kwait(uint64);
  99 void            wakeup(void*);
 100 void            yield(void);
 101 int             either_copyout(int user_dst, uint64 dst, void *src, uint64 len);
 102 int             either_copyin(void *dst, int user_src, uint64 src, uint64 len);
 103 void            procdump(void);
 104 
 105 // swtch.S
 106 void            swtch(struct context*, struct context*);
 107 
 108 // spinlock.c
 109 void            acquire(struct spinlock*);
 110 int             holding(struct spinlock*);
 111 void            initlock(struct spinlock*, char*);
 112 void            release(struct spinlock*);
 113 void            push_off(void);
 114 void            pop_off(void);
 115 
 116 // sleeplock.c
 117 void            acquiresleep(struct sleeplock*);
 118 void            releasesleep(struct sleeplock*);
 119 int             holdingsleep(struct sleeplock*);
 120 void            initsleeplock(struct sleeplock*, char*);
 121 
 122 // string.c
 123 int             memcmp(const void*, const void*, uint);
 124 void*           memmove(void*, const void*, uint);
 125 void*           memset(void*, int, uint);
 126 char*           safestrcpy(char*, const char*, int);
 127 int             strlen(const char*);
 128 int             strncmp(const char*, const char*, uint);
 129 char*           strncpy(char*, const char*, int);
 130 
 131 // syscall.c
 132 void            argint(int, int*);
 133 int             argstr(int, char*, int);
 134 void            argaddr(int, uint64 *);
 135 int             fetchstr(uint64, char*, int);
 136 int             fetchaddr(uint64, uint64*);
 137 void            syscall();
 138 
 139 // trap.c
 140 extern uint     ticks;
 141 void            trapinit(void);
 142 void            trapinithart(void);
 143 extern struct spinlock tickslock;
 144 void            prepare_return(void);
 145 
 146 // uart.c
 147 void            uartinit(void);
 148 void            uartintr(void);
 149 void            uartwrite(char [], int);
 150 void            uartputc_sync(int);
 151 int             uartgetc(void);
 152 
 153 // vm.c
 154 void            kvminit(void);
 155 void            kvminithart(void);
 156 void            kvmmap(pagetable_t, uint64, uint64, uint64, int);
 157 int             mappages(pagetable_t, uint64, uint64, uint64, int);
 158 pagetable_t     uvmcreate(void);
 159 uint64          uvmalloc(pagetable_t, uint64, uint64, int);
 160 uint64          uvmdealloc(pagetable_t, uint64, uint64);
 161 int             uvmcopy(pagetable_t, pagetable_t, uint64);
 162 void            uvmfree(pagetable_t, uint64);
 163 void            uvmunmap(pagetable_t, uint64, uint64, int);
 164 void            uvmclear(pagetable_t, uint64);
 165 pte_t *         walk(pagetable_t, uint64, int);
 166 uint64          walkaddr(pagetable_t, uint64);
 167 int             copyout(pagetable_t, uint64, char *, uint64);
 168 int             copyin(pagetable_t, char *, uint64, uint64);
 169 int             copyinstr(pagetable_t, char *, uint64, uint64);
 170 int             ismapped(pagetable_t, uint64);
 171 uint64          vmfault(pagetable_t, uint64, int);
 172 
 173 // plic.c
 174 void            plicinit(void);
 175 void            plicinithart(void);
 176 int             plic_claim(void);
 177 void            plic_complete(int);
 178 
 179 // virtio_disk.c
 180 void            virtio_disk_init(void);
 181 void            virtio_disk_rw(struct buf *, int);
 182 void            virtio_disk_intr(void);
 183 
 184 // number of elements in fixed-size array
 185 #define NELEM(x) (sizeof(x)/sizeof((x)[0]))

/* [<][>][^][v][top][bottom][index][help] */