diff options
author | rsc <rsc> | 2006-09-06 18:43:45 +0000 |
---|---|---|
committer | rsc <rsc> | 2006-09-06 18:43:45 +0000 |
commit | 50e514be986e4d5b136879d1221b721b17493a78 (patch) | |
tree | 02143f4bb428485d156c4671b35e31180aa5822c /file.c | |
parent | 9936bffa45c928ead9660a0df32d08a50b2b09c2 (diff) | |
download | xv6-labs-50e514be986e4d5b136879d1221b721b17493a78.tar.gz xv6-labs-50e514be986e4d5b136879d1221b721b17493a78.tar.bz2 xv6-labs-50e514be986e4d5b136879d1221b721b17493a78.zip |
fd_* => file_*
Diffstat (limited to 'file.c')
-rw-r--r-- | file.c | 26 |
1 files changed, 13 insertions, 13 deletions
@@ -17,14 +17,14 @@ struct devsw devsw[NDEV]; struct file file[NFILE]; void -fd_init(void) +fileinit(void) { initlock(&fd_table_lock, "fd_table"); } // Allocate a file descriptor number for curproc. int -fd_ualloc(void) +fdalloc(void) { int fd; struct proc *p = curproc[cpu()]; @@ -36,7 +36,7 @@ fd_ualloc(void) // Allocate a file descriptor structure struct file* -fd_alloc(void) +filealloc(void) { int i; @@ -56,7 +56,7 @@ fd_alloc(void) // Write to file descriptor; // addr is a kernel address, pointing into some process's p->mem. int -fd_write(struct file *fd, char *addr, int n) +filewrite(struct file *fd, char *addr, int n) { if(fd->writable == 0) return -1; @@ -71,14 +71,14 @@ fd_write(struct file *fd, char *addr, int n) iunlock(fd->ip); return r; } else { - panic("fd_write"); + panic("filewrite"); return -1; } } // Read from file descriptor. int -fd_read(struct file *fd, char *addr, int n) +fileread(struct file *fd, char *addr, int n) { if(fd->readable == 0) return -1; @@ -92,19 +92,19 @@ fd_read(struct file *fd, char *addr, int n) iunlock(fd->ip); return cc; } else { - panic("fd_read"); + panic("fileread"); return -1; } } // Close file descriptor. void -fd_close(struct file *fd) +fileclose(struct file *fd) { acquire(&fd_table_lock); if(fd->ref < 1 || fd->type == FD_CLOSED) - panic("fd_close"); + panic("fileclose"); if(--fd->ref == 0){ struct file dummy = *fd; @@ -118,7 +118,7 @@ fd_close(struct file *fd) } else if(dummy.type == FD_FILE){ idecref(dummy.ip); } else { - panic("fd_close"); + panic("fileclose"); } } else { release(&fd_table_lock); @@ -127,7 +127,7 @@ fd_close(struct file *fd) // Get metadata about file descriptor. int -fd_stat(struct file *fd, struct stat *st) +filestat(struct file *fd, struct stat *st) { if(fd->type == FD_FILE){ ilock(fd->ip); @@ -140,11 +140,11 @@ fd_stat(struct file *fd, struct stat *st) // Increment file descriptor reference count. void -fd_incref(struct file *fd) +fileincref(struct file *fd) { acquire(&fd_table_lock); if(fd->ref < 1 || fd->type == FD_CLOSED) - panic("fd_incref"); + panic("fileincref"); fd->ref++; release(&fd_table_lock); } |