Messages in this thread | | | Date | Wed, 07 Jan 2009 07:00:25 +0100 | From | Németh Márton <> | Subject | pair of alloc_disk()? |
| |
Hi,
I cannot find free_disk() or similar function which takes "struct gendisk" as a parameter and can do the reverse thing what alloc_disk() do.
Could you please give me a hint what would be the correct function call in the following example in test_exit_module() so the module do not leak?
#include <linux/module.h> #include <linux/genhd.h>
MODULE_AUTHOR("Márton Németh <nm127@freemail.hu>"); MODULE_DESCRIPTION("Test alloc_disk"); MODULE_LICENSE("GPL");
static struct gendisk *gd_ptr;
static int test_init_module(void) { printk(KERN_DEBUG "starting module\n");
gd_ptr = alloc_disk(1); if (!gd_ptr) { return -ENOMEM; }
printk(KERN_DEBUG "gd_ptr after alloc=%p\n", gd_ptr);
return 0; }
static void test_exit_module(void) { printk(KERN_DEBUG "unloading module\n");
/* FIXME: no free_disk(gd_ptr) is available */ }
module_init(test_init_module); module_exit(test_exit_module);
Regards,
Márton Németh -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |