From: Shaun Savage <savages@savages.net>
To: linux-kernel@vger.kernel.org
Subject: get partition size of block device from another block device.
Date: Sun, 25 Sep 2005 17:05:17 -0700 [thread overview]
Message-ID: <43373B3D.10602@savages.net> (raw)
HI All
I am writing a block device driver that uses another block device for
its "base storage".
First the block device sturctures questions.
there is one 'struct gendisk' per disk. with partitions under this
->part[N].
there is one 'struct block_device' is the file system device, one per
disk or one part partition?
Is ther one kobject for each disk or partition?
-----------------------------------
one of the module parameters passed in is the base device. eather
/dev/hda1 or 0x0301, which format is the best?
module_parm_array(str_dev, charp, &dev_cnt,0);
or
module_parm_array(dev_dev, ushort, &dev_cnt,0);
from string to gendisk
bdev = lookup_bdev(str_dev); then finds the
block_device
gd = get_gendisk(bdev->bd_dev,MINOR(bdev->bd_dev))
OR
gd= get_gendisk(dev_dev,MINOR(dev_dev))
bdev = bdget_disk(gd, MINOR(dev_dev))
This confuses me, if there is one gendisk per disk why does get_gendisk
need a partition number?
OR
something with kobject?
----------------------------------------------------------
Now to get ther size.
numberOfSectors =gd->part[MINOR(dev)]->nr_sects
Now I need to 'open' the device for r/w
bd_claim()
or
open_bdev_excl()
Now read and write data to the sub block device
reply other threads:[~2005-09-26 0:05 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=43373B3D.10602@savages.net \
--to=savages@savages.net \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox