diff options
author | rsc <rsc> | 2007-08-24 20:54:23 +0000 |
---|---|---|
committer | rsc <rsc> | 2007-08-24 20:54:23 +0000 |
commit | 07090dd705df557cba5ce4ea46b2a274876343a5 (patch) | |
tree | 4e4c4415c702ff4c041e101ab3c7173fd636d9d0 /file.c | |
parent | fa1b34106ad99cf8021227b4c1e62353ae4d0fda (diff) | |
download | xv6-labs-07090dd705df557cba5ce4ea46b2a274876343a5.tar.gz xv6-labs-07090dd705df557cba5ce4ea46b2a274876343a5.tar.bz2 xv6-labs-07090dd705df557cba5ce4ea46b2a274876343a5.zip |
Remove struct uinode.
Remove type arg to mknod (assume T_DEV).
Diffstat (limited to 'file.c')
-rw-r--r-- | file.c | 22 |
1 files changed, 9 insertions, 13 deletions
@@ -56,17 +56,16 @@ int fileread(struct file *f, char *addr, int n) { int r; - struct inode *ip; if(f->readable == 0) return -1; if(f->type == FD_PIPE) return pipe_read(f->pipe, addr, n); if(f->type == FD_INODE){ - ip = ilock(f->ip); - if((r = readi(ip, addr, f->off, n)) > 0) + ilock(f->ip); + if((r = readi(f->ip, addr, f->off, n)) > 0) f->off += r; - iunlock(ip); + iunlock(f->ip); return r; } panic("fileread"); @@ -77,17 +76,16 @@ int filewrite(struct file *f, char *addr, int n) { int r; - struct inode *ip; if(f->writable == 0) return -1; if(f->type == FD_PIPE) return pipe_write(f->pipe, addr, n); if(f->type == FD_INODE){ - ip = ilock(f->ip); - if((r = writei(ip, addr, f->off, n)) > 0) + ilock(f->ip); + if((r = writei(f->ip, addr, f->off, n)) > 0) f->off += r; - iunlock(ip); + iunlock(f->ip); return r; } panic("filewrite"); @@ -97,12 +95,10 @@ filewrite(struct file *f, char *addr, int n) int filestat(struct file *f, struct stat *st) { - struct inode *ip; - if(f->type == FD_INODE){ - ip = ilock(f->ip); - stati(ip, st); - iunlock(ip); + ilock(f->ip); + stati(f->ip, st); + iunlock(f->ip); return 0; } return -1; |