All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ivan Shmakov <ivan@gray.siamics.net>
To: linux-ext4@vger.kernel.org
Subject: a (documented) way to get the Ext2+ filesystem size?
Date: Tue, 16 Aug 2011 18:37:23 +0700	[thread overview]
Message-ID: <86aab94mfg.fsf@gray.siamics.net> (raw)

	How do I get the Ext2+ filesystem size (in blocks)?

	Currently, I do it like:

static uint_fast64_t
e2fs_size (ext2_filsys e2)
{
  uint_fast32_t hi
    = (uint_fast32_t)e2->super->s_blocks_count_hi;
  uint_fast32_t lo
    = (uint_fast32_t)e2->super->s_blocks_count;

  /* . */
  return (((uint64_t)hi << 32) | lo);
}

	However, it seems that there's no documentation for both the
	ext2_filsys and struct ext2_super_block structure types, and
	their respective member fields.

	Am I safe with the code above?

-- 
FSF associate member #7257


             reply	other threads:[~2011-08-16 11:37 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-16 11:37 Ivan Shmakov [this message]
2011-08-16 14:21 ` a (documented) way to get the Ext2+ filesystem size? Jan Kara
2011-08-17 18:31 ` Ted Ts'o
2011-08-17 18:50   ` Ivan Shmakov
2011-08-17 22:09     ` Ted Ts'o
2011-08-18  2:34       ` Steven Liu
2011-08-18  4:25         ` e2dis example usage pattern Ivan Shmakov
2011-08-18  3:49       ` a (documented) way to get the Ext2+ filesystem size? Ivan Shmakov
2011-08-18 21:03         ` Ted Ts'o
2011-08-19  4:34           ` Ivan Shmakov

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=86aab94mfg.fsf@gray.siamics.net \
    --to=ivan@gray.siamics.net \
    --cc=linux-ext4@vger.kernel.org \
    --cc=oneingray@gmail.com \
    /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 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.