All of lore.kernel.org
 help / color / mirror / Atom feed
* How to get the size of the block device ???? (Important)
@ 2002-12-17 14:22 Sanjay Kumar
  2002-12-17 14:36 ` Richard B. Johnson
  0 siblings, 1 reply; 5+ messages in thread
From: Sanjay Kumar @ 2002-12-17 14:22 UTC (permalink / raw)
  To: linux-kernel; +Cc: Matt_Domsch

Hi,
  I am Sanjay Kumar and wants to write my own file
system on Linux. I have almost written the code.
  But,now i have a problem while writing the code 
for "mkfs" for my filesystem.

Problem Summary : I need the size of the block device
in bytes on which my file system will be created.
Actually, there is a feild in the super block, needs
the total no of blocks on the device while while
creating the filesystem. So, Can you Plz. help me out
of this problem.

I got your email id from :

 http://lwn.net/2001/0906/a/last-sector.php3

Sanjay Kumar.
M.C.A.,
Univeristy of Pune,
India.

________________________________________________________________________
Missed your favourite TV serial last night? Try the new, Yahoo! TV.
       visit http://in.tv.yahoo.com

^ permalink raw reply	[flat|nested] 5+ messages in thread
* Re: How to get the size of the block device ???? (Important)
@ 2002-12-17 14:39 Nicholas Berry
  0 siblings, 0 replies; 5+ messages in thread
From: Nicholas Berry @ 2002-12-17 14:39 UTC (permalink / raw)
  To: root, sanju93csd; +Cc: Matt_Domsch, linux-kernel

I think the question being asked is 'how do I find out how many block
long the device is?'

You can open it, seek to the end, then the file postiton will tell you
the size of the device.

Nik


>>> "Richard B. Johnson" <root@chaos.analogic.com> 12/17/02 09:36AM
>>>
On Tue, 17 Dec 2002, [iso-8859-1] Sanjay Kumar wrote:

> Hi,
>   I am Sanjay Kumar and wants to write my own file
> system on Linux. I have almost written the code.
>   But,now i have a problem while writing the code 
> for "mkfs" for my filesystem.
> 
> Problem Summary : I need the size of the block device
> in bytes on which my file system will be created.
> Actually, there is a feild in the super block, needs
> the total no of blocks on the device while while
> creating the filesystem. So, Can you Plz. help me out
> of this problem.
> 

You make an ioctl() function for your file-system that returns
the block-size that you selected when you designed the system.


Cheers,
Dick Johnson
Penguin : Linux version 2.4.18 on an i686 machine (797.90 BogoMips).
Why is the government concerned about the lunatic fringe? Think about
it.


^ permalink raw reply	[flat|nested] 5+ messages in thread
* RE: How to get the size of the block device ???? (Important)
@ 2002-12-17 18:49 Matt_Domsch
  0 siblings, 0 replies; 5+ messages in thread
From: Matt_Domsch @ 2002-12-17 18:49 UTC (permalink / raw)
  To: nikberry, root, sanju93csd; +Cc: linux-kernel

> I think the question being asked is 'how do I find out how many block
> long the device is?'

You can use the BLKGETSIZE64 ioctl() too.  I refer you to the GNU Parted
code (ftp.gnu.org/gnu/parted) in libparted/linux.c to see how it's done
there.  It first tries BLKGETSIZE64, then if that fails, tries BLKGETSIZE
instead.

Thanks,
Matt

--
Matt Domsch
Sr. Software Engineer, Lead Engineer, Architect
Dell Linux Solutions www.dell.com/linux
Linux on Dell mailing lists @ http://lists.us.dell.com


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2002-12-17 18:41 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-12-17 14:22 How to get the size of the block device ???? (Important) Sanjay Kumar
2002-12-17 14:36 ` Richard B. Johnson
2002-12-17 14:40   ` Sean Neakums
  -- strict thread matches above, loose matches on Subject: below --
2002-12-17 14:39 Nicholas Berry
2002-12-17 18:49 Matt_Domsch

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.