Re: questions about gendisk

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Sascha Effert wrote:
Sascha Effert wrote:

Hello,

I have some questions about using the gendisk-structure in the 2.6-Kernels. I am writing a module which has to be initialised with 0 Partitions, and gets the partitions later. The numer of partitions changes during the lifetime of the module (online).

The first problem exists during initialisation of the gendisk. Which value is the right for gendisk->minors? include/linux/genhd.h says it must be the maximum number of minors. So if i set it to 680 the initialisation runs, but when I call the del_gendisk in the exit-function I get an error, that the system got an NULL-Pointer (gendisk is not NULL, but the partitions). If I set minors to the current count of partitions (0) it runs. And how must I initialise gendisk->part?

Second Problem: what do I have to do to add a partition to a gendisk? Do I have to build a new array of *hd_struct with one *hd_struct more? Or has gendisk->part to be initialised with the maximum count of partitions I need? Have I to do a del_gendisk and a add_disk to say the system that there is a new partition?

My third question has to do with get_gendisk. In my 2.6 Kernel this function gets two parameters: a dev_t (the device-number) and an *Integer (called part). In 2.4 there was only the device-number (a kdev_t). Why is the second parameter needed? Can a dev_t refer to more than one gendisk? Which value has *part to have?


At my third question I think I discovered the net problem. Could it be that get_gendisk is no longer exported? My books about the 2.6 Kernel tell me that this is the function to get a gendisk of a dev_t (and the *part Pointer, which is anymore unknown to me..). But if I use it, I get the following Warning during building the module:

*** Warning: "get_gendisk" [/afs/uni-paderborn.de/user/f/fermat/VDrive/cvs/driver.RAD/src/2_6/device_driver/rad.ko] undefined!

In include/linux/genhd.h the function is declared as extern. In the drivers/block/genhd.c it is also defined, but not exported. There is no EXPORT_SYMBOL(get_gendisk). Can anyone help me?

Hello,

...hmmm, this seems to become a soliloquy... :-)

Nevertheless I want to post my new cognitions: The function get_gendisk is away and should not be used anymore (Damm it, I have two books about 2.6 kernel and both are outdated...). But that seems to be no problem, because a bdget(dev)->bd_disk seems to be the same as get_gendisk(dev) earlier.

But my first and second problem exist anymore and I don't know what to do. Any suggestions?



tschau


Sascha Effert

--
Being evil means it can be christmas every day.

--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux