#include <linux/module.h>
#include <linux/init.h>
#include <linux/list.h>
struct node {
int id;
struct list_head list;
};
static LIST_HEAD(nodes);
static int __init dev_init(void)
{
struct node *n;
n = kzalloc(sizeof(*n),
GFP_KERNEL);
if (!n)
return -ENOMEM;
list_add_tail(&n->list,
&nodes);
pr_info("hello\n");
return 0;
}
static void __exit dev_exit(void)
{
struct node *n, *tmp;
list_for_each_entry_safe(n, tmp,
&nodes, list) {
list_del(&n->list);
kfree(n);
}
}
module_init(dev_init);
module_exit(dev_exit);
MODULE_LICENSE("GPL");
p.
peterborough.dev
peterborough.dev provides access to development tools & resources on an invitation-only basis. To request access or for business inquiries, please email newbusiness@peterborough.dev .
To report abuse, please email abuse@peterborough.dev .
Useful links
Hosting & virtualization
Cloudflare web hosting & secure access Docker quick container deployment Proxmox powerful & scalable open source virtualization
Collaboration & security
Nextcloud open source collaboration platform Vikunja open source task management Wazuh open source XDR & SIEM platform