summaryrefslogtreecommitdiff
path: root/fd.c
diff options
context:
space:
mode:
authorrsc <rsc>2006-07-16 02:04:58 +0000
committerrsc <rsc>2006-07-16 02:04:58 +0000
commit4ed974f5ea8cbb6ee296782d94d83d8edbc92026 (patch)
tree94319b1962e66057038e86700150637ebe188d46 /fd.c
parent6f2b626d2882c2b9df5039b324c4167be3d74f28 (diff)
downloadxv6-labs-4ed974f5ea8cbb6ee296782d94d83d8edbc92026.tar.gz
xv6-labs-4ed974f5ea8cbb6ee296782d94d83d8edbc92026.tar.bz2
xv6-labs-4ed974f5ea8cbb6ee296782d94d83d8edbc92026.zip
more name cleanup
Diffstat (limited to 'fd.c')
-rw-r--r--fd.c16
1 files changed, 7 insertions, 9 deletions
diff --git a/fd.c b/fd.c
index 68f75e3..ce2931b 100644
--- a/fd.c
+++ b/fd.c
@@ -37,7 +37,7 @@ fd_alloc()
for(i = 0; i < NFD; i++){
if(fds[i].type == FD_CLOSED){
fds[i].type = FD_NONE;
- fds[i].count = 1;
+ fds[i].ref = 1;
release(&fd_table_lock);
return fds + i;
}
@@ -80,18 +80,16 @@ fd_close(struct fd *fd)
{
acquire(&fd_table_lock);
- if(fd->count < 1 || fd->type == FD_CLOSED)
+ if(fd->ref < 1 || fd->type == FD_CLOSED)
panic("fd_close");
- fd->count -= 1;
-
- if(fd->count == 0){
+ if(--fd->ref == 0){
if(fd->type == FD_PIPE){
pipe_close(fd->pipe, fd->writeable);
} else {
panic("fd_close");
}
- fd->count = 0;
+ fd->ref = 0;
fd->type = FD_CLOSED;
}
@@ -102,8 +100,8 @@ void
fd_incref(struct fd *fd)
{
acquire(&fd_table_lock);
- if(fd->count < 1 || fd->type == FD_CLOSED)
- panic("fd_reference");
- fd->count++;
+ if(fd->ref < 1 || fd->type == FD_CLOSED)
+ panic("fd_incref");
+ fd->ref++;
release(&fd_table_lock);
}