xv6/file.c File Reference

#include "types.h"
#include "defs.h"
#include "param.h"
#include "fs.h"
#include "file.h"
#include "spinlock.h"

Go to the source code of this file.

Functions

void fileinit (void)
struct filefilealloc (void)
struct filefiledup (struct file *f)
void fileclose (struct file *f)
int filestat (struct file *f, struct stat *st)
int fileread (struct file *f, char *addr, int n)
int filewrite (struct file *f, char *addr, int n)

Variables

struct devsw devsw [NDEV]
struct {
   struct spinlock   lock
   struct file   file [NFILE]
ftable


Function Documentation

struct file* filealloc ( void   )  [read]

Definition at line 22 of file file.c.

References acquire(), ftable, NFILE, file::ref, and release().

Referenced by pipealloc(), and sys_open().

void fileclose ( struct file f  ) 

struct file* filedup ( struct file f  )  [read]

Definition at line 40 of file file.c.

References acquire(), ftable, panic(), file::ref, and release().

Referenced by fork(), and sys_dup().

void fileinit ( void   ) 

Definition at line 15 of file file.c.

References ftable, and initlock().

Referenced by mpmain().

int fileread ( struct file f,
char *  addr,
int  n 
)

int filestat ( struct file f,
struct stat st 
)

Definition at line 76 of file file.c.

References file::FD_INODE, ilock(), file::ip, iunlock(), stati(), and file::type.

Referenced by sys_fstat().

int filewrite ( struct file f,
char *  addr,
int  n 
)


Variable Documentation

struct devsw devsw[NDEV]

Definition at line 8 of file file.c.

struct file file[NFILE]

Definition at line 11 of file file.c.

struct { ... } ftable

struct spinlock lock

Definition at line 10 of file file.c.


Generated on Fri Jan 7 12:25:49 2011 for xv6 by  doxygen 1.5.6