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/