Re: Patch?: 2.5.46/drivers/block/genhd.c - static allocation of gendisks

From: Adam J. Richter (adam@yggdrasil.com)
Date: Wed Nov 06 2002 - 10:18:10 EST


        Sorry pelting you with duplicate patches. Here is yet
another version of my init_disk() patch.

        I changed init_disk to take the disk partitions pointer
as a parameter to make it hard for users of this interface to
forget to set it.

        Also, I replaced disk.destructor() with disk.kfree_arg,
to avoid having to write a bunch of destructors that look like this:

void foo_destructor(struct gendisk *disk)
{
        struct foo_private *foo_priv =
                container_of(disk, struct foo_private, mygendisk);
        kfree(foo_priv);
}

        foo's hardware removal function would call put_disk,
and the disk's destructor would be called when the disk's reference
count dropped to zero. However, I'd rather not have to write
a bunch of duplicative destructor functions and I think they
all would just call kfree.

        By the way, I believe that the example of the IDE changes that
I posted does not currently have this issue because the gendisks are in
the static hwifs[] array, which is not deallocated until the module is
unloaded, and the module is protected by a reference count.

-- 
Adam J. Richter     __     ______________   575 Oroville Road
adam@yggdrasil.com     \ /                  Milpitas, California 95035
+1 408 309-6081         | g g d r a s i l   United States of America
                         "Free Software For The Rest Of Us."


- 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/



This archive was generated by hypermail 2b29 : Thu Nov 07 2002 - 22:00:43 EST