How can I retrieve the mount count for an ext3 volume?

Ben Scott dragonhawk at gmail.com
Tue Oct 6 12:31:30 EDT 2009


On Tue, Oct 6, 2009 at 12:17 PM, Bill McGonigle <bill at bfccomputing.com> wrote:
> No need to stick it in /proc, but parsing the output of utilities with
> scripts is subject to all kinds of potential errors and inefficiencies.

  If that's your concern, the utility should have an output mode
that's more friendly to machine interpretation.  :)

  But frankly, for something like mount statistics, it's not worth
worrying about efficiency, and parsing isn't complicated enough to
worry about errors.  An API is an API, regardless of whether it's a C
struct via ioctl() or text output from e2fsck.  If nothing changes,
both work equally well, and if things change, the later handles change
much better.  :)

  You just think the C struct way works better because when that
changes, your program just segfaults when it's doing something
completely different, so you never learn why.  The text method fails
gracefully, and you actually have a chance of diagnosing it and fixing
it.  :)

  And it's not like /proc or /sys *aren't* giving you text output.  :)

  Unix is built on a bunch of small, independent utilities exchanging
text data. Among other things, that builds an easily diagnosed system,
and one which handles change gracefully.  :)

> I'd have guessed this would be exposed in sysfs ...

  Just as bad as sticking it in /proc.  Just a different name.  :)

-- Ben


More information about the gnhlug-discuss mailing list