diff options
author | rsc <rsc> | 2007-08-08 09:30:42 +0000 |
---|---|---|
committer | rsc <rsc> | 2007-08-08 09:30:42 +0000 |
commit | d80b06a1e0232f4c5e9b9c8ff635e4022e13667c (patch) | |
tree | a8967e433841b6987fbc1025564d339590c9fe67 /fs.c | |
parent | 35a24c8318dd784b62c57b1933ded6e880faaa55 (diff) | |
download | xv6-labs-d80b06a1e0232f4c5e9b9c8ff635e4022e13667c.tar.gz xv6-labs-d80b06a1e0232f4c5e9b9c8ff635e4022e13667c.tar.bz2 xv6-labs-d80b06a1e0232f4c5e9b9c8ff635e4022e13667c.zip |
iincref returns new ref
Diffstat (limited to 'fs.c')
-rw-r--r-- | fs.c | 10 |
1 files changed, 5 insertions, 5 deletions
@@ -266,8 +266,7 @@ iunlock(struct inode *ip) uint bmap(struct inode *ip, uint bn) { - unsigned x; - uint *a; + uint *a, x; struct buf *inbp; if(bn >= MAXFILE) @@ -350,12 +349,14 @@ idecref(struct inode *ip) } // Increment reference count for ip. -void +// Returns ip to enable ip = iincref(ip1) idiom. +struct inode* iincref(struct inode *ip) { ilock(ip); ip->ref++; iunlock(ip); + return ip; } // Copy stat information from inode. @@ -511,8 +512,7 @@ namei(char *path, int mode, uint *ret_off, if(*cp == '/') dp = iget(rootdev, 1); else { - dp = p->cwd; - iincref(dp); + dp = iincref(p->cwd); ilock(dp); } |