pair of alloc_disk()?

From: NÃmeth MÃrton
Date: Wed Jan 07 2009 - 01:00:40 EST


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@xxxxxxxxxxx>");
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@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/