summaryrefslogtreecommitdiff
path: root/fs.c
diff options
context:
space:
mode:
authorrtm <rtm>2006-07-29 09:35:02 +0000
committerrtm <rtm>2006-07-29 09:35:02 +0000
commit32630628a996e29018641af262272339ed6fef88 (patch)
tree73c9a7dee75f96c0ce0e9c804d379dd60bf254b4 /fs.c
parente46fb46fcf4302bf5ed913101c5c7b510fe03ad4 (diff)
downloadxv6-labs-32630628a996e29018641af262272339ed6fef88.tar.gz
xv6-labs-32630628a996e29018641af262272339ed6fef88.tar.bz2
xv6-labs-32630628a996e29018641af262272339ed6fef88.zip
open()
Diffstat (limited to 'fs.c')
-rw-r--r--fs.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/fs.c b/fs.c
index 3b06bc7..0e987c2 100644
--- a/fs.c
+++ b/fs.c
@@ -12,7 +12,7 @@
// these are inodes currently in use
// an entry is free if count == 0
struct inode inode[NINODE];
-struct spinlock inode_table_lock;
+struct spinlock inode_table_lock = { "inode_table" };
uint rootdev = 1;
@@ -111,11 +111,14 @@ iput(struct inode *ip)
}
void
-iincref(struct inode *ip)
+idecref(struct inode *ip)
{
acquire(&inode_table_lock);
- ip->count += 1;
+ if(ip->count < 1)
+ panic("idecref");
+
+ ip->count -= 1;
release(&inode_table_lock);
}