public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* pair of alloc_disk()?
@ 2009-01-07  6:00 Németh Márton
  2009-01-08  5:56 ` pair of alloc_disk()? + OOPS Németh Márton
  0 siblings, 1 reply; 3+ messages in thread
From: Németh Márton @ 2009-01-07  6:00 UTC (permalink / raw)
  To: LKML

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2009-01-08  6:27 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-01-07  6:00 pair of alloc_disk()? Németh Márton
2009-01-08  5:56 ` pair of alloc_disk()? + OOPS Németh Márton
2009-01-08  6:27   ` Németh Márton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox