f 32 kernel/file.c struct file *f; f 35 kernel/file.c for(f = ftable.file; f < ftable.file + NFILE; f++){ f 36 kernel/file.c if(f->ref == 0){ f 37 kernel/file.c f->ref = 1; f 39 kernel/file.c return f; f 48 kernel/file.c filedup(struct file *f) f 51 kernel/file.c if(f->ref < 1) f 53 kernel/file.c f->ref++; f 55 kernel/file.c return f; f 60 kernel/file.c fileclose(struct file *f) f 65 kernel/file.c if(f->ref < 1) f 67 kernel/file.c if(--f->ref > 0){ f 71 kernel/file.c ff = *f; f 72 kernel/file.c f->ref = 0; f 73 kernel/file.c f->type = FD_NONE; f 88 kernel/file.c filestat(struct file *f, uint64 addr) f 93 kernel/file.c if(f->type == FD_INODE || f->type == FD_DEVICE){ f 94 kernel/file.c ilock(f->ip); f 95 kernel/file.c stati(f->ip, &st); f 96 kernel/file.c iunlock(f->ip); f 107 kernel/file.c fileread(struct file *f, uint64 addr, int n) f 111 kernel/file.c if(f->readable == 0) f 114 kernel/file.c if(f->type == FD_PIPE){ f 115 kernel/file.c r = piperead(f->pipe, addr, n); f 116 kernel/file.c } else if(f->type == FD_DEVICE){ f 117 kernel/file.c if(f->major < 0 || f->major >= NDEV || !devsw[f->major].read) f 119 kernel/file.c r = devsw[f->major].read(1, addr, n); f 120 kernel/file.c } else if(f->type == FD_INODE){ f 121 kernel/file.c ilock(f->ip); f 122 kernel/file.c if((r = readi(f->ip, 1, addr, f->off, n)) > 0) f 123 kernel/file.c f->off += r; f 124 kernel/file.c iunlock(f->ip); f 135 kernel/file.c filewrite(struct file *f, uint64 addr, int n) f 139 kernel/file.c if(f->writable == 0) f 142 kernel/file.c if(f->type == FD_PIPE){ f 143 kernel/file.c ret = pipewrite(f->pipe, addr, n); f 144 kernel/file.c } else if(f->type == FD_DEVICE){ f 145 kernel/file.c if(f->major < 0 || f->major >= NDEV || !devsw[f->major].write) f 147 kernel/file.c ret = devsw[f->major].write(1, addr, n); f 148 kernel/file.c } else if(f->type == FD_INODE){ f 163 kernel/file.c ilock(f->ip); f 164 kernel/file.c if ((r = writei(f->ip, 1, addr + i, f->off, n1)) > 0) f 165 kernel/file.c f->off += r; f 166 kernel/file.c iunlock(f->ip); f 357 kernel/proc.c struct file *f = p->ofile[fd]; f 358 kernel/proc.c fileclose(f); f 25 kernel/sysfile.c struct file *f; f 28 kernel/sysfile.c if(fd < 0 || fd >= NOFILE || (f=myproc()->ofile[fd]) == 0) f 33 kernel/sysfile.c *pf = f; f 40 kernel/sysfile.c fdalloc(struct file *f) f 47 kernel/sysfile.c p->ofile[fd] = f; f 57 kernel/sysfile.c struct file *f; f 60 kernel/sysfile.c if(argfd(0, 0, &f) < 0) f 62 kernel/sysfile.c if((fd=fdalloc(f)) < 0) f 64 kernel/sysfile.c filedup(f); f 71 kernel/sysfile.c struct file *f; f 77 kernel/sysfile.c if(argfd(0, 0, &f) < 0) f 79 kernel/sysfile.c return fileread(f, p, n); f 85 kernel/sysfile.c struct file *f; f 91 kernel/sysfile.c if(argfd(0, 0, &f) < 0) f 94 kernel/sysfile.c return filewrite(f, p, n); f 101 kernel/sysfile.c struct file *f; f 103 kernel/sysfile.c if(argfd(0, &fd, &f) < 0) f 106 kernel/sysfile.c fileclose(f); f 113 kernel/sysfile.c struct file *f; f 117 kernel/sysfile.c if(argfd(0, 0, &f) < 0) f 119 kernel/sysfile.c return filestat(f, st); f 309 kernel/sysfile.c struct file *f; f 344 kernel/sysfile.c if((f = filealloc()) == 0 || (fd = fdalloc(f)) < 0){ f 345 kernel/sysfile.c if(f) f 346 kernel/sysfile.c fileclose(f); f 353 kernel/sysfile.c f->type = FD_DEVICE; f 354 kernel/sysfile.c f->major = ip->major; f 356 kernel/sysfile.c f->type = FD_INODE; f 357 kernel/sysfile.c f->off = 0; f 359 kernel/sysfile.c f->ip = ip; f 360 kernel/sysfile.c f->readable = !(omode & O_WRONLY); f 361 kernel/sysfile.c f->writable = (omode & O_WRONLY) || (omode & O_RDWR); f 2590 user/usertests.c void (*f)(char *); f 2960 user/usertests.c run(void f(char *), char *s) { f 2970 user/usertests.c f(s); f 2986 user/usertests.c if(!run(t->f, t->s)){