For Programmers: Free Programming Magazines  


Home > Archive > Unix Programming > May 2004 > Retrieving block size of a filesystem









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Retrieving block size of a filesystem
Kieran Simkin

2004-05-22, 11:31 pm

I'm writing some code in C to check user's disk space usage. The quotactl()
function I'm using gives me a block count for each user, but I need to
transform this into a byte count, I know on my personal system that each
block is 512 bytes big, but is there a better (read more portable) way find
out how many blocks are used per byte on a specific filesystem?

Thanks in advance.


~Kieran Simkin
Digital Crocus
http://digital-crocus.com/


Barry Margolin

2004-05-23, 2:31 am

In article <HQUrc.218$Ux3.202@newsfe4-gui>,
"Kieran Simkin" <kieran@digital-crocus.com> wrote:

> I'm writing some code in C to check user's disk space usage. The quotactl()
> function I'm using gives me a block count for each user, but I need to
> transform this into a byte count, I know on my personal system that each
> block is 512 bytes big, but is there a better (read more portable) way find
> out how many blocks are used per byte on a specific filesystem?


fsstat()

--
Barry Margolin, barmar@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***
Barry Margolin

2004-05-23, 2:31 am

In article <HQUrc.218$Ux3.202@newsfe4-gui>,
"Kieran Simkin" <kieran@digital-crocus.com> wrote:

> I'm writing some code in C to check user's disk space usage. The quotactl()
> function I'm using gives me a block count for each user, but I need to
> transform this into a byte count, I know on my personal system that each
> block is 512 bytes big, but is there a better (read more portable) way find
> out how many blocks are used per byte on a specific filesystem?


Oops, ignore my last response. I meant statfs(), or statvfs().

--
Barry Margolin, barmar@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***
Kieran Simkin

2004-05-23, 8:33 am

Great, just what I was looking for, thanks.

--


~Kieran Simkin
Digital Crocus
http://digital-crocus.com/

"Barry Margolin" <barmar@alum.mit.edu> wrote in message
news:barmar-39F4BD.01104923052004@comcast.dca.giganews.com...
> In article <HQUrc.218$Ux3.202@newsfe4-gui>,
> "Kieran Simkin" <kieran@digital-crocus.com> wrote:
>
quotactl()[color=darkred]
find[color=darkred]
>
> Oops, ignore my last response. I meant statfs(), or statvfs().
>
> --
> Barry Margolin, barmar@alum.mit.edu
> Arlington, MA
> *** PLEASE post questions in newsgroups, not directly to me ***



Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com