Re: block device drivers

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

 



On 9/17/05, Sanjay Kumar, Noida <sanjayku@xxxxxxxxxxxxxxxxx> wrote:
> >    I am trying to implement a linux block device driver.And  I have
> >some doubts while understanding the drivers.I am listing them.Will you
> >please help me.
> >
> >1.In the struct gendisk structure wht is the field
> >int first_minor;
> >                refer to?
> >is it the first partion number?wht is the partion number mean?
> 
> first_minor denotes the starting minor device number for this gendisk.
> For e.g. if you initialize first_minor with 5 and you create 2
> partitions on this disk, then the disk will have minor number 5 and the
> two partitions will have minor number 6 and 7. This basically decides
> how minor numbers are allocated.
> 

I want to add one more example, that hda and hdb both have same major
number which is 3 but the starting minor numbers of both devices are
different means hda have first_minor=0 and  minors=64, where as hdb
has first_minor=64 and minors=64

So, hda starts with 3,0 to 3,63 and hdb with 3,64 to 3,127


> >
> >and wht is the field minors refer to?
> 
> "minors" refer to maximum number of partitions possible on the disk
> 
> Please correct me if I am wrong.
> 
> >
> >and while implementing in a sample driver they are using
> >dev->gd->first_minor = which*NUM_OF_MINORS;
> >where gd is the reference to gendisk structure
> >wht is the word 'which' refer to and in which file it is defined?
> >
> >i am using the
> >set_capacity(dev->gd, nsectors*(hardsect_size/KERNEL_SECTOR_SIZE));
> >then
> >and i am getting the error undefined symbol KERNEL_SECTOR_SIZE.
> >where it is located.
> >
> >

I think you missed to see in the start of the sbull (LDD3 sample) code
that it is #define KERNEL_SECTOR_SIZE 512

-- 
Fawad Lateef

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