mirror of
https://github.com/cirosantilli/linux-kernel-module-cheat.git
synced 2026-01-23 02:05:57 +01:00
Move module license to bottom
This commit is contained in:
@@ -22,8 +22,6 @@ which reduces namespace pollution.
|
||||
|
||||
#include "anonymous_inode.h"
|
||||
|
||||
MODULE_LICENSE("GPL");
|
||||
|
||||
static struct dentry *debugfs_file;
|
||||
|
||||
static ssize_t read(struct file *filp, char __user *buf, size_t len, loff_t *off)
|
||||
@@ -83,3 +81,4 @@ static void myexit(void)
|
||||
|
||||
module_init(myinit)
|
||||
module_exit(myexit)
|
||||
MODULE_LICENSE("GPL");
|
||||
|
||||
@@ -29,8 +29,6 @@ and use that for the mknod.
|
||||
|
||||
#define NAME "lkmc_character_device"
|
||||
|
||||
MODULE_LICENSE("GPL");
|
||||
|
||||
static int major;
|
||||
|
||||
static ssize_t read(struct file *filp, char __user *buf, size_t len, loff_t *off)
|
||||
@@ -68,3 +66,4 @@ static void myexit(void)
|
||||
|
||||
module_init(myinit)
|
||||
module_exit(myexit)
|
||||
MODULE_LICENSE("GPL");
|
||||
|
||||
@@ -13,8 +13,6 @@ Requires `CONFIG_DEBUG_FS=y`.
|
||||
#include <linux/module.h>
|
||||
#include <uapi/linux/stat.h> /* S_IRUSR */
|
||||
|
||||
MODULE_LICENSE("GPL");
|
||||
|
||||
static struct dentry *dir;
|
||||
static u32 value = 42;
|
||||
|
||||
@@ -41,3 +39,4 @@ static void myexit(void)
|
||||
|
||||
module_init(myinit)
|
||||
module_exit(myexit)
|
||||
MODULE_LICENSE("GPL");
|
||||
|
||||
@@ -48,8 +48,6 @@ TODO: at what point does buildroot / busybox generate that file?
|
||||
#include <linux/kthread.h>
|
||||
#include <linux/module.h>
|
||||
|
||||
MODULE_LICENSE("GPL");
|
||||
|
||||
int lkmc_dep = 0;
|
||||
EXPORT_SYMBOL(lkmc_dep);
|
||||
static struct task_struct *kthread;
|
||||
@@ -77,3 +75,4 @@ static void myexit(void)
|
||||
|
||||
module_init(myinit)
|
||||
module_exit(myexit)
|
||||
MODULE_LICENSE("GPL");
|
||||
|
||||
@@ -3,8 +3,6 @@
|
||||
#include <linux/kthread.h>
|
||||
#include <linux/module.h>
|
||||
|
||||
MODULE_LICENSE("GPL");
|
||||
|
||||
extern int lkmc_dep;
|
||||
static struct task_struct *kthread;
|
||||
|
||||
@@ -31,3 +29,4 @@ static void myexit(void)
|
||||
|
||||
module_init(myinit)
|
||||
module_exit(myexit)
|
||||
MODULE_LICENSE("GPL");
|
||||
|
||||
@@ -26,8 +26,6 @@ Here we use debugfs.
|
||||
#include <linux/printk.h> /* printk */
|
||||
#include <uapi/linux/stat.h> /* S_IRUSR */
|
||||
|
||||
MODULE_LICENSE("GPL");
|
||||
|
||||
static struct dentry *debugfs_file;
|
||||
static char data[] = {'a', 'b', 'c', 'd'};
|
||||
|
||||
@@ -154,3 +152,4 @@ static void myexit(void)
|
||||
|
||||
module_init(myinit)
|
||||
module_exit(myexit)
|
||||
MODULE_LICENSE("GPL");
|
||||
|
||||
@@ -11,8 +11,6 @@ Hello world module.
|
||||
#include <linux/module.h>
|
||||
#include <linux/kernel.h>
|
||||
|
||||
MODULE_LICENSE("GPL");
|
||||
|
||||
static int myinit(void)
|
||||
{
|
||||
pr_info("hello init\n");
|
||||
@@ -26,3 +24,4 @@ static void myexit(void)
|
||||
|
||||
module_init(myinit)
|
||||
module_exit(myexit)
|
||||
MODULE_LICENSE("GPL");
|
||||
|
||||
@@ -7,8 +7,6 @@ Mostly to check that our build infrastructure can handle more than one module!
|
||||
#include <linux/module.h>
|
||||
#include <linux/kernel.h>
|
||||
|
||||
MODULE_LICENSE("GPL");
|
||||
|
||||
static int myinit(void)
|
||||
{
|
||||
pr_info("hello2 init\n");
|
||||
@@ -22,3 +20,4 @@ static void myexit(void)
|
||||
|
||||
module_init(myinit)
|
||||
module_exit(myexit)
|
||||
MODULE_LICENSE("GPL");
|
||||
|
||||
@@ -26,8 +26,6 @@ Documentation/ioctl/ioctl-number.txt has some info:
|
||||
|
||||
#include "ioctl.h"
|
||||
|
||||
MODULE_LICENSE("GPL");
|
||||
|
||||
static struct dentry *debugfs_file;
|
||||
|
||||
static long unlocked_ioctl(struct file *filp, unsigned int cmd, unsigned long argp)
|
||||
@@ -90,3 +88,4 @@ static void myexit(void)
|
||||
|
||||
module_init(myinit)
|
||||
module_exit(myexit)
|
||||
MODULE_LICENSE("GPL");
|
||||
|
||||
@@ -39,8 +39,6 @@ Then see how clicking the mouse and keyboard affect the interrupts. This will po
|
||||
#define NAME "lkmc_character_device"
|
||||
#define MAX_IRQS 256
|
||||
|
||||
MODULE_LICENSE("GPL");
|
||||
|
||||
static int irqs[MAX_IRQS];
|
||||
static int major;
|
||||
|
||||
@@ -93,3 +91,4 @@ static void myexit(void)
|
||||
|
||||
module_init(myinit)
|
||||
module_exit(myexit)
|
||||
MODULE_LICENSE("GPL");
|
||||
|
||||
@@ -14,8 +14,6 @@ See also:
|
||||
#include <linux/kthread.h>
|
||||
#include <linux/module.h>
|
||||
|
||||
MODULE_LICENSE("GPL");
|
||||
|
||||
static struct task_struct *kthread;
|
||||
|
||||
static int work_func(void *data)
|
||||
@@ -46,3 +44,4 @@ static void myexit(void)
|
||||
|
||||
module_init(myinit)
|
||||
module_exit(myexit)
|
||||
MODULE_LICENSE("GPL");
|
||||
|
||||
@@ -7,8 +7,6 @@
|
||||
#include <linux/kthread.h>
|
||||
#include <linux/module.h>
|
||||
|
||||
MODULE_LICENSE("GPL");
|
||||
|
||||
static struct task_struct *kthread1, *kthread2;
|
||||
|
||||
static int work_func1(void *data)
|
||||
@@ -54,3 +52,4 @@ static void myexit(void)
|
||||
|
||||
module_init(myinit)
|
||||
module_exit(myexit)
|
||||
MODULE_LICENSE("GPL");
|
||||
|
||||
@@ -13,8 +13,6 @@ vs module_init and module_exit?
|
||||
#include <linux/module.h>
|
||||
#include <linux/kernel.h>
|
||||
|
||||
MODULE_LICENSE("GPL");
|
||||
|
||||
int init_module(void)
|
||||
{
|
||||
pr_info("init_module\n");
|
||||
@@ -25,3 +23,4 @@ void cleanup_module(void)
|
||||
{
|
||||
pr_info("cleanup_module\n");
|
||||
}
|
||||
MODULE_LICENSE("GPL");
|
||||
|
||||
@@ -27,3 +27,4 @@ static void myexit(void)
|
||||
|
||||
module_init(myinit)
|
||||
module_exit(myexit)
|
||||
MODULE_LICENSE("GPL");
|
||||
|
||||
@@ -27,8 +27,6 @@ Those parameters can also be read and modified at runtime from /sys.
|
||||
#include <linux/module.h>
|
||||
#include <uapi/linux/stat.h> /* S_IRUSR | S_IWUSR */
|
||||
|
||||
MODULE_LICENSE("GPL");
|
||||
|
||||
static int i = 0;
|
||||
static int j = 0;
|
||||
module_param(i, int, S_IRUSR | S_IWUSR);
|
||||
@@ -61,3 +59,4 @@ static void myexit(void)
|
||||
|
||||
module_init(myinit)
|
||||
module_exit(myexit)
|
||||
MODULE_LICENSE("GPL");
|
||||
|
||||
@@ -95,8 +95,6 @@ TODO: does it have any side effects? Set in the edu device at:
|
||||
#define IO_IRQ_STATUS 0x24
|
||||
#define QEMU_VENDOR_ID 0x1234
|
||||
|
||||
MODULE_LICENSE("GPL");
|
||||
|
||||
static struct pci_device_id pci_ids[] = {
|
||||
{ PCI_DEVICE(QEMU_VENDOR_ID, EDU_DEVICE_ID), },
|
||||
{ 0, }
|
||||
@@ -285,3 +283,4 @@ static void myexit(void)
|
||||
|
||||
module_init(myinit);
|
||||
module_exit(myexit);
|
||||
MODULE_LICENSE("GPL");
|
||||
|
||||
@@ -20,8 +20,6 @@ probe already does a mmio write, which generates an IRQ and tests everything.
|
||||
#define EDU_DEVICE_ID 0x11e9
|
||||
#define QEMU_VENDOR_ID 0x1234
|
||||
|
||||
MODULE_LICENSE("GPL");
|
||||
|
||||
static struct pci_device_id id_table[] = {
|
||||
{ PCI_DEVICE(QEMU_VENDOR_ID, EDU_DEVICE_ID), },
|
||||
{ 0, }
|
||||
@@ -96,3 +94,4 @@ static void myexit(void)
|
||||
|
||||
module_init(myinit);
|
||||
module_exit(myexit);
|
||||
MODULE_LICENSE("GPL");
|
||||
|
||||
@@ -27,8 +27,6 @@ which touches from userland through /dev/mem.
|
||||
#include <linux/of_irq.h>
|
||||
#include <linux/platform_device.h>
|
||||
|
||||
MODULE_LICENSE("GPL");
|
||||
|
||||
static struct resource res;
|
||||
static unsigned int irq;
|
||||
static void __iomem *map;
|
||||
@@ -132,3 +130,4 @@ static void lkmc_platform_device_exit(void)
|
||||
|
||||
module_init(lkmc_platform_device_init)
|
||||
module_exit(lkmc_platform_device_exit)
|
||||
MODULE_LICENSE("GPL");
|
||||
|
||||
@@ -20,8 +20,6 @@ https://stackoverflow.com/questions/30035776/how-to-add-poll-function-to-the-ker
|
||||
#include <linux/wait.h> /* wait_queue_head_t, wait_event_interruptible, wake_up_interruptible */
|
||||
#include <uapi/linux/stat.h> /* S_IRUSR */
|
||||
|
||||
MODULE_LICENSE("GPL");
|
||||
|
||||
static char readbuf[1024];
|
||||
static size_t readbuflen;
|
||||
static struct dentry *debugfs_file;
|
||||
@@ -90,3 +88,4 @@ static void myexit(void)
|
||||
|
||||
module_init(myinit)
|
||||
module_exit(myexit)
|
||||
MODULE_LICENSE("GPL");
|
||||
|
||||
@@ -26,8 +26,6 @@ Then:
|
||||
#include <linux/module.h>
|
||||
#include <uapi/linux/stat.h> /* S_IRUSR | S_IWUSR */
|
||||
|
||||
MODULE_LICENSE("GPL");
|
||||
|
||||
static int yn = 1;
|
||||
module_param(yn, int, S_IRUSR | S_IWUSR);
|
||||
MODULE_PARM_DESC(yn, "A short integer");
|
||||
@@ -60,3 +58,4 @@ static void myexit(void)
|
||||
|
||||
module_init(myinit)
|
||||
module_exit(myexit)
|
||||
MODULE_LICENSE("GPL");
|
||||
|
||||
@@ -34,8 +34,6 @@ Bibliography:
|
||||
#include <linux/slab.h>
|
||||
#include <uapi/linux/stat.h> /* S_IRUSR */
|
||||
|
||||
MODULE_LICENSE("GPL");
|
||||
|
||||
static int max = 2;
|
||||
module_param(max, int, S_IRUSR | S_IWUSR);
|
||||
|
||||
@@ -136,3 +134,4 @@ static void myexit(void)
|
||||
|
||||
module_init(myinit)
|
||||
module_exit(myexit)
|
||||
MODULE_LICENSE("GPL");
|
||||
|
||||
@@ -17,8 +17,6 @@ This example behaves like a file that contains:
|
||||
#include <linux/seq_file.h> /* seq_read, seq_lseek, single_release */
|
||||
#include <uapi/linux/stat.h> /* S_IRUSR */
|
||||
|
||||
MODULE_LICENSE("GPL");
|
||||
|
||||
static struct dentry *debugfs_file;
|
||||
|
||||
static int show(struct seq_file *m, void *v)
|
||||
@@ -54,3 +52,4 @@ static void myexit(void)
|
||||
|
||||
module_init(myinit)
|
||||
module_exit(myexit)
|
||||
MODULE_LICENSE("GPL");
|
||||
|
||||
@@ -15,8 +15,6 @@ Since insmod returns, this also illustrates how the work queues are asynchronous
|
||||
#include <linux/types.h> /* atomic_t */
|
||||
#include <linux/workqueue.h>
|
||||
|
||||
MODULE_LICENSE("GPL");
|
||||
|
||||
static struct workqueue_struct *queue;
|
||||
static atomic_t run = ATOMIC_INIT(1);
|
||||
|
||||
@@ -48,3 +46,4 @@ static void myexit(void)
|
||||
|
||||
module_init(myinit)
|
||||
module_exit(myexit)
|
||||
MODULE_LICENSE("GPL");
|
||||
|
||||
@@ -15,8 +15,6 @@ See also:
|
||||
#include <linux/module.h>
|
||||
#include <linux/timer.h>
|
||||
|
||||
MODULE_LICENSE("GPL");
|
||||
|
||||
static void callback(unsigned long data);
|
||||
static unsigned long onesec;
|
||||
|
||||
@@ -42,3 +40,4 @@ static void myexit(void)
|
||||
|
||||
module_init(myinit)
|
||||
module_exit(myexit)
|
||||
MODULE_LICENSE("GPL");
|
||||
|
||||
@@ -19,8 +19,6 @@ and on QEMU monitor:
|
||||
#include <linux/module.h>
|
||||
#include <linux/seq_file.h> /* single_open, single_release */
|
||||
|
||||
MODULE_LICENSE("GPL");
|
||||
|
||||
static volatile u32 i = 0x12345678;
|
||||
|
||||
static struct dentry *debugfs_file;
|
||||
@@ -65,3 +63,4 @@ static void myexit(void)
|
||||
|
||||
module_init(myinit)
|
||||
module_exit(myexit)
|
||||
MODULE_LICENSE("GPL");
|
||||
|
||||
@@ -23,8 +23,6 @@ Outcome:
|
||||
#include <linux/module.h>
|
||||
#include <linux/wait.h> /* wait_queue_head_t, wait_event_interruptible, wake_up_interruptible */
|
||||
|
||||
MODULE_LICENSE("GPL");
|
||||
|
||||
static struct task_struct *kthread1, *kthread2;
|
||||
static wait_queue_head_t queue;
|
||||
static atomic_t awake = ATOMIC_INIT(0);
|
||||
@@ -74,3 +72,4 @@ static void myexit(void)
|
||||
|
||||
module_init(myinit)
|
||||
module_exit(myexit)
|
||||
MODULE_LICENSE("GPL");
|
||||
|
||||
@@ -8,8 +8,6 @@ Two threads waiting on a single event.
|
||||
#include <linux/module.h>
|
||||
#include <linux/wait.h> /* wait_queue_head_t, wait_event_interruptible, wake_up_interruptible */
|
||||
|
||||
MODULE_LICENSE("GPL");
|
||||
|
||||
static struct task_struct *kthread_wake;
|
||||
static struct task_struct *kthread_sleep1;
|
||||
static struct task_struct *kthread_sleep2;
|
||||
@@ -75,3 +73,4 @@ void cleanup_module(void)
|
||||
kthread_stop(kthread_sleep1);
|
||||
kthread_stop(kthread_wake);
|
||||
}
|
||||
MODULE_LICENSE("GPL");
|
||||
|
||||
@@ -6,8 +6,6 @@ Declare more work from a workqueue.
|
||||
#include <linux/module.h>
|
||||
#include <linux/workqueue.h>
|
||||
|
||||
MODULE_LICENSE("GPL");
|
||||
|
||||
static int i = 0;
|
||||
static struct workqueue_struct *queue;
|
||||
|
||||
@@ -39,3 +37,4 @@ static void myexit(void)
|
||||
|
||||
module_init(myinit)
|
||||
module_exit(myexit)
|
||||
MODULE_LICENSE("GPL");
|
||||
|
||||
@@ -21,8 +21,6 @@ Bibliography:
|
||||
#include <linux/module.h>
|
||||
#include <linux/workqueue.h>
|
||||
|
||||
MODULE_LICENSE("GPL");
|
||||
|
||||
static struct workqueue_struct *queue;
|
||||
|
||||
static void work_func(struct work_struct *work)
|
||||
@@ -47,3 +45,4 @@ static void myexit(void)
|
||||
|
||||
module_init(myinit)
|
||||
module_exit(myexit)
|
||||
MODULE_LICENSE("GPL");
|
||||
|
||||
Reference in New Issue
Block a user