/* foo.h * * author : marco corvi * date : mar 2001 * * */ #ifndef FOO_H #define FOO_H #include #include #include /* wait_queue */ #include /* ssize_t */ #include /* struct file, struct inode */ /* #include spinlock_t */ #define FOO_READ 0 #define FOO_WRITE 1 #ifdef __KERNEL__ struct foo_struct { int n_readers; /* number of readers */ int n_writers; /* number of writers */ int rpos; /* read position */ int wpos; /* write position */ int used; /* used buffer */ int max; /* max buffer */ unsigned char * buffer; /* struct wait_queue * wait; */ wait_queue_head_t * wait; spinlock_t lock; }; #endif // __KERNEL__ int foo_trim( struct foo_struct * foo ); ssize_t foo_read(struct file * f, char * buf, size_t len, loff_t * ); ssize_t foo_write(struct file * f, const char * buf, size_t len, loff_t * ); int foo_open(struct inode * in, struct file * f); int foo_close(struct inode * in, struct file * f); int foo_flush(struct file * f); int foo_init(); void foo_exit(); #endif // FOO_H