root/kernel/defs.h

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

INCLUDED FROM


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

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