- 论坛徽章:
- 0
|
2_3_3___pipe.h
#ifndef __PIPE_H__
#define __PIPE_H__
#ifdef PIPE_DEBUG
#define DPRINTK(fmt, args...) { printk(KERN_DEBUG "%s(%d): " fmt, __FUNCTION__ , __LINE__, ## args); }
#else
#define DPRINTK(fmt, args...)
#endif
#define PIPE_NR_DEVS 2
#define DATA_BUFF_SIZE 4000
struct data_buff{
spinlock_t lock; /* lock to use this struct */
wait_queue_head_t inQ; /* write queue */
u8 inF; /* write flag */
wait_queue_head_t outQ; /* read queue */
u8 outF; /* read flag */
size_t in; /* total size for write */
size_t out; /* total size for read */
char data[ DATA_BUFF_SIZE ]; /* data buff */
};
struct pipe_chrdev{
int index; /* minor id */
spinlock_t olock; /* lock for open() */
int ocnt; /* open count */
struct data_buff buff; /* data buff */
struct data_buff *rb; /* pointer to read buff */
struct data_buff *wb; /* pointer to write buff */
struct cdev *cdev; /* pointer to char device */
};
#endif
返回目录
本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u2/68424/showart_681420.html |
|