From a7f89980e5b3f4b9a74c70dbc5ffe8aabd28be28 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Frings-F=C3=BCrst?= Date: Sun, 6 Jul 2014 18:04:32 +0200 Subject: Imported Upstream version 2.9.3 --- test/dopanic_drv.c | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 test/dopanic_drv.c (limited to 'test/dopanic_drv.c') diff --git a/test/dopanic_drv.c b/test/dopanic_drv.c new file mode 100644 index 0000000..a8540ff --- /dev/null +++ b/test/dopanic_drv.c @@ -0,0 +1,51 @@ +/* dopanic.c + * + * Cause a panic in a loadable driver. + */ +#include /* We're doing kernel work */ +#include /* Specifically, a module */ + +static int device_open(void *inode, + void *file) +{ + printk (KERN_DEBUG "device_open(%p,%p)\n", inode, file); + return 0; +} + +static int device_release(void *inode, + void *file) +{ + printk ("device_release(%p,%p)\n", inode, file); + return 0; +} + + +static int device_read(void *file, + char *buffer, /* The buffer to fill with data */ + int length, /* The length of the buffer */ + int *offset) /* Our offset in the file */ +{ + return 0; +} + +static int device_write(void *file, + const char *buffer, /* The buffer */ + int length, /* The length of the buffer */ + int *offset) /* Our offset in the file */ +{ + return -1; +} + +/* Initialize the module */ +int init_module() +{ + panic("dopanic: init_module calls panic"); + return 0; +} + + +/* Cleanup - unregister the appropriate file from /proc */ +void cleanup_module() +{ +} + -- cgit v1.2.3