diff options
author | Matthias Schiffer <mschiffer@universe-factory.net> | 2013-10-11 21:02:07 +0200 |
---|---|---|
committer | Matthias Schiffer <mschiffer@universe-factory.net> | 2013-10-11 21:02:07 +0200 |
commit | 83930b4eff0277ca69a0800ccdd4f7552cdf1460 (patch) | |
tree | d876f56b65b24f70c854578b6c0f7fb9a65a21da | |
download | modfastd-83930b4eff0277ca69a0800ccdd4f7552cdf1460.tar modfastd-83930b4eff0277ca69a0800ccdd4f7552cdf1460.zip |
Some basic initialization
-rw-r--r-- | COPYRIGHT | 22 | ||||
-rw-r--r-- | Makefile | 17 | ||||
-rw-r--r-- | fastd.c | 90 |
3 files changed, 129 insertions, 0 deletions
diff --git a/COPYRIGHT b/COPYRIGHT new file mode 100644 index 0000000..eebfc12 --- /dev/null +++ b/COPYRIGHT @@ -0,0 +1,22 @@ +Copyright (c) 2013, Matthias Schiffer <mschiffer@universe-factory.net> +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..82e3e7a --- /dev/null +++ b/Makefile @@ -0,0 +1,17 @@ +ifneq ($(KERNELRELEASE),) +obj-m := fastd.o + +else +KDIR := /lib/modules/$(shell uname -r)/build +PWD := $(shell pwd) + +all: + $(MAKE) -C $(KDIR) SUBDIRS=$(PWD) modules + +endif + + +.PHONY: clean + +clean: + rm -rf *.o .depend .*.cmd *.ko *.mod.c *.markers *.symvers *.order @@ -0,0 +1,90 @@ +/* + Copyright (c) 2012-2013, Matthias Schiffer <mschiffer@universe-factory.net> + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE + FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + + +#define DRV_NAME "fastd" +#define DRV_VERSION "1" +#define DRV_DESCRIPTION "fastd tunnel driver" +#define DRV_COPYRIGHT "(C) 2013 Matthias Schiffer <mschiffer@universe-factory.net>" + + +#include <linux/module.h> +#include <linux/errno.h> +#include <linux/init.h> +#include <linux/kernel.h> +#include <linux/miscdevice.h> +#include <linux/poll.h> + + +static const struct file_operations fastd_fops = { + .owner = THIS_MODULE, + .llseek = no_llseek, + .read = do_sync_read, +// .aio_read = fastd_chr_aio_read, + .write = do_sync_write, +// .aio_write = fastd_chr_aio_write, +// .poll = fastd_chr_poll, +// .unlocked_ioctl = fastd_chr_ioctl, +//#ifdef CONFIG_COMPAT +// .compat_ioctl = fastd_chr_compat_ioctl, +//#endif +// .open = fastd_chr_open, +// .release = fastd_chr_close, +// .fasync = fastd_chr_fasync +}; + +static struct miscdevice fastd_miscdev = { + .minor = MISC_DYNAMIC_MINOR, + .name = "fastd", + .nodename = "net/fastd", + .fops = &fastd_fops, +}; + + +static int __init fastd_init(void) +{ + int ret; + + ret = misc_register(&fastd_miscdev); + if (ret) { + pr_err("Can't register misc device\n"); + return ret; + } + + return 0; +} + +static void fastd_cleanup(void) +{ + misc_deregister(&fastd_miscdev); +} + + +module_init(fastd_init); +module_exit(fastd_cleanup); +MODULE_DESCRIPTION(DRV_DESCRIPTION); +MODULE_AUTHOR(DRV_COPYRIGHT); +MODULE_LICENSE("Dual BSD/GPL"); +MODULE_ALIAS("devname:net/fastd"); |