f                  29 file.c           struct file *f;
f                  32 file.c           for(f = ftable.file; f < ftable.file + NFILE; f++){
f                  33 file.c             if(f->ref == 0){
f                  34 file.c               f->ref = 1;
f                  36 file.c               return f;
f                  45 file.c         filedup(struct file *f)
f                  48 file.c           if(f->ref < 1)
f                  50 file.c           f->ref++;
f                  52 file.c           return f;
f                  57 file.c         fileclose(struct file *f)
f                  62 file.c           if(f->ref < 1)
f                  64 file.c           if(--f->ref > 0){
f                  68 file.c           ff = *f;
f                  69 file.c           f->ref = 0;
f                  70 file.c           f->type = FD_NONE;
f                  84 file.c         filestat(struct file *f, struct stat *st)
f                  86 file.c           if(f->type == FD_INODE){
f                  87 file.c             ilock(f->ip);
f                  88 file.c             stati(f->ip, st);
f                  89 file.c             iunlock(f->ip);
f                  97 file.c         fileread(struct file *f, char *addr, int n)
f                 101 file.c           if(f->readable == 0)
f                 103 file.c           if(f->type == FD_PIPE)
f                 104 file.c             return piperead(f->pipe, addr, n);
f                 105 file.c           if(f->type == FD_INODE){
f                 106 file.c             ilock(f->ip);
f                 107 file.c             if((r = readi(f->ip, addr, f->off, n)) > 0)
f                 108 file.c               f->off += r;
f                 109 file.c             iunlock(f->ip);
f                 118 file.c         filewrite(struct file *f, char *addr, int n)
f                 122 file.c           if(f->writable == 0)
f                 124 file.c           if(f->type == FD_PIPE)
f                 125 file.c             return pipewrite(f->pipe, addr, n);
f                 126 file.c           if(f->type == FD_INODE){
f                 141 file.c               ilock(f->ip);
f                 142 file.c               if ((r = writei(f->ip, addr + i, f->off, n1)) > 0)
f                 143 file.c                 f->off += r;
f                 144 file.c               iunlock(f->ip);
f                  25 sysfile.c        struct file *f;
f                  29 sysfile.c        if(fd < 0 || fd >= NOFILE || (f=myproc()->ofile[fd]) == 0)
f                  34 sysfile.c          *pf = f;
f                  41 sysfile.c      fdalloc(struct file *f)
f                  48 sysfile.c            curproc->ofile[fd] = f;
f                  58 sysfile.c        struct file *f;
f                  61 sysfile.c        if(argfd(0, 0, &f) < 0)
f                  63 sysfile.c        if((fd=fdalloc(f)) < 0)
f                  65 sysfile.c        filedup(f);
f                  72 sysfile.c        struct file *f;
f                  76 sysfile.c        if(argfd(0, 0, &f) < 0 || argint(2, &n) < 0 || argptr(1, &p, n) < 0)
f                  78 sysfile.c        return fileread(f, p, n);
f                  84 sysfile.c        struct file *f;
f                  88 sysfile.c        if(argfd(0, 0, &f) < 0 || argint(2, &n) < 0 || argptr(1, &p, n) < 0)
f                  90 sysfile.c        return filewrite(f, p, n);
f                  97 sysfile.c        struct file *f;
f                  99 sysfile.c        if(argfd(0, &fd, &f) < 0)
f                 102 sysfile.c        fileclose(f);
f                 109 sysfile.c        struct file *f;
f                 112 sysfile.c        if(argfd(0, 0, &f) < 0 || argptr(1, (void*)&st, sizeof(*st)) < 0)
f                 114 sysfile.c        return filestat(f, st);
f                 290 sysfile.c        struct file *f;
f                 317 sysfile.c        if((f = filealloc()) == 0 || (fd = fdalloc(f)) < 0){
f                 318 sysfile.c          if(f)
f                 319 sysfile.c            fileclose(f);
f                 327 sysfile.c        f->type = FD_INODE;
f                 328 sysfile.c        f->ip = ip;
f                 329 sysfile.c        f->off = 0;
f                 330 sysfile.c        f->readable = !(omode & O_WRONLY);
f                 331 sysfile.c        f->writable = (omode & O_WRONLY) || (omode & O_RDWR);