Re: Association between block device and block_device struct

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

 



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/


[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