From d80b06a1e0232f4c5e9b9c8ff635e4022e13667c Mon Sep 17 00:00:00 2001 From: rsc Date: Wed, 8 Aug 2007 09:30:42 +0000 Subject: iincref returns new ref --- fs.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'fs.c') diff --git a/fs.c b/fs.c index 8f7b872..9e9626e 100644 --- a/fs.c +++ b/fs.c @@ -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); } -- cgit v1.2.3