Re: Re: Association between block device and block_device struct

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

 



  
Don't think there are any global array of block_devices in 2.6 as it was in 2.4  If you are writing a driver or working on a kernel code, then you should be able to get the block_device bdev corresponding to a /dev/hdx that was opened - from inode->bdev. Don't have to open the device in your driver code though!

Hope this helps.

Thanks,
Vinod


On Thu, 07 Oct 2004 Ahmed A wrote :
>Hi,
>
>blksize_size, hardsect_size  etc. does not exist in
>2.6. I am looking for the info that was contained in
>these global variables in Kernel 2.4.
>
>Regards,
>Ahmed.
>
>
>--- Bijoy Thomas <bijoyjth@xxxxxxx> wrote:
>
> >
> > Hi,
> >
> >    What kind of information are you looking for once
> > you give /dev/hda as input?
> >
> >     There are two arrays called hardsect_size and
> > blksize_size in the kernel that store information
> > regarding a block device. hardsect_size[3][N] will
> > give you the sector size of /dev/hdaN.
> > blksize_size[m][n] gives you the blocksize for a
> > block device with major number m and minor number n.
> > Hope this helps.
> >
> > Regards,
> > Bijoy.
> >
> > ----- Original Message -----
> > From: Ahmed A <ahmedcali@xxxxxxxxx>
> > Date: Thursday, October 7, 2004 0:47 am
> > Subject: Re: Association between block device and
> > block_device struct
> >
> > >
> > > Hi,
> > >
> > > I was wondering if there is an alternate way than
> > > opening a file in kernel space.  I am not sure if
> > I
> > > can effectively open an device (the block device
> > > specifically) in kernel space.
> > >
> > > Is there a global array variable of all the block
> > > devices recognized by the kernel that I can scan
> > to
> > > find out the the exact one for a corresponding dev
> > > entry (e.g /dev/hda).  This is for 2.6 kernel.
> > >
> > > Regards,
> > > Ahmed.
> > >
> > > --- Vinod Sreedharan
> > <vinod.sreedharan@xxxxxxxxxxxxxx>
> > > wrote:
> > >
> > > > Ahmed,
> > > >
> > > > inode->i_bdev will give you block_device for any
> > > > opened device file,
> > > > since during open file->dentry->inode
> > association
> > > > has already been made.
> > > >
> > > > Thanks,
> > > > Vinod
> > > >
> > > > On Thu, 07 Oct 2004 Ahmed A wrote :
> > > > >Hello,
> > > > >
> > > > >I am trying to find the corresponding
> > block_device
> > > > >struct for a certain block device (e.g.
> > /dev/hda)
> > > > in
> > > > >2.6.  Is there a way I can find the
> > association.
> > > > >
> > > > >If not, can someone suggest some code, by which
> > > > give a
> > > > >block device name (e.g. hda), I can find out
> > it's
> > > > >corresponding block_device struct.  I was
> > thinking
> > > > of
> > > > >one approach - "open" the block devive, get a
> > file
> > > > >pointer back, and from that obtain the
> > block_device
> > > > >pointer.  Any code sample or pointers would be
> > > > highly
> > > > >appreciated.
> > > > >
> > > > >Regards,
> > > > >Ahmed.
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >_______________________________
> > > > >Do you Yahoo!?
> > > > >Declare Yourself - Register online to vote
> > today!
> > > > >http://vote.yahoo.com
> > > > >
> > > > >--
> > > > >Kernelnewbies: Help each other learn about the
> > > > Linux kernel.
> > > > >Archive:
> > > > http://mail.nl.linux.org/kernelnewbies/
> > > > >FAQ:           http://kernelnewbies.org/faq/
> > > > >
> > > >
> > >
> > >
> > >
> > >
> > > __________________________________
> > > Do you Yahoo!?
> > > Yahoo! Mail Address AutoComplete - You start. We
> > finish.
> > > http://promotions.yahoo.com/new_mail
> > >
> > > --
> > > Kernelnewbies: Help each other learn about the
> > Linux kernel.
> > > Archive:
> > http://mail.nl.linux.org/kernelnewbies/
> > > FAQ:           http://kernelnewbies.org/faq/
> > >
> > >
> >
> >
> > --
> > Kernelnewbies: Help each other learn about the Linux
> > kernel.
> > Archive:
> > http://mail.nl.linux.org/kernelnewbies/
> > FAQ:           http://kernelnewbies.org/faq/
> >
> >
>
>
>
>
>_______________________________
>Do you Yahoo!?
>Declare Yourself - Register online to vote today!
>http://vote.yahoo.com
>
>--
>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