11 #include <linux/module.h>
24 #define PROC_FIFO "record-fifo"
50 struct kfifo_rec_ptr_1
test;
58 static const char *expected_result[] = {
71 static int __init testfunc(
void)
76 struct {
unsigned char buf[6]; } hello = {
"hello" };
80 kfifo_in(&test, &hello,
sizeof(hello));
86 for (i = 0; i < 10; i++) {
87 memset(buf,
'a' + i, i + 1);
105 ret =
kfifo_out(&test, buf,
sizeof(buf));
108 if (
strcmp(buf, expected_result[i++])) {
123 size_t count, loff_t *ppos)
135 return ret ? ret : copied;
138 static ssize_t fifo_read(
struct file *file,
char __user *buf,
139 size_t count, loff_t *ppos)
151 return ret ? ret : copied;
161 static int __init example_init(
void)
174 if (testfunc() < 0) {
190 static void __exit example_exit(
void)