dummy.h
Aller à la documentation de ce fichier.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 MODULE_LICENSE("GPL\0 rulez !!!");
00020 MODULE_AUTHOR("VINCENT MARTIN");
00021 MODULE_DESCRIPTION("dummy");
00022 MODULE_SUPPORTED_DEVICE("dummy");
00023
00024 #ifndef DUMMY_H
00025 #define DUMMY_H
00026
00028 #define DUMMY_MAJOR 0
00029
00031 #define BUF_SIZE 1024
00032
00034 #define DEBUG 1
00035
00037 struct element_fifo
00038 {
00039 size_t used_bytes;
00040 char buffer[BUF_SIZE];
00041 int position;
00042 struct element_fifo *next;
00043 struct element_fifo *prev;
00044 };
00045
00047 struct private_dummy
00048 {
00049 int index;
00050 int in_use;
00051 struct element_fifo *head;
00052 struct semaphore in_use_critique;
00053 struct semaphore rw_critique;
00054 };
00055
00056 static int dummy_open (struct inode *inode, struct file *file);
00057 static int dummy_release (struct inode *inode, struct file *file);
00058 static ssize_t dummy_write (struct file *file, const char *buffer, size_t size, loff_t *offset);
00059 static ssize_t dummy_read (struct file *file, char *buffer, size_t size, loff_t *offset);
00060 static int dummy_init(void);
00061 static void dummy_cleanup(void);
00062
00064 static struct file_operations dummy_fops = {
00065 read: dummy_read,
00066 write: dummy_write,
00067 open: dummy_open,
00068 release: dummy_release,
00069 };
00070
00072 static int DeviceCount = 2;
00073
00075 static char *DeviceName = "dummy";
00076
00078 static int dummy_major = DUMMY_MAJOR;
00079
00081 static int *already_opened = NULL;
00082
00084 static struct semaphore *open_critique = NULL;
00085
00087 static struct private_dummy *device_fifo = NULL;
00088
00089 #endif //DUMMY_H