From: Ivan Shmakov <ivan@gray.siamics.net>
To: linux-ext4@vger.kernel.org
Subject: debugfs: list inode numbers?
Date: Wed, 17 Aug 2011 12:21:22 +0700 [thread overview]
Message-ID: <86ippw1ulp.fsf_-_@gray.siamics.net> (raw)
In-Reply-To: alpine.LFD.2.00.1108151759040.3695@dhcp-27-109.brq.redhat.com
>>>>> Lukas Czerner <lczerner@redhat.com> writes:
>>>>> On Mon, 15 Aug 2011, Ivan Shmakov wrote:
>>>>> Lukas Czerner <lczerner@redhat.com> writes:
[…]
>>> and with a little bit of scripting around it you should be able dig
>>> any information you desire from the file system so I do not think
>>> that new application is needed. But I might be wrong, just take a
>>> look at it.
>> Indeed, my first try was to use debugfs(8). However, there're
>> several issues with it:
>> • I see no way to obtain the list of used inodes in debugfs(8)
>> (as of 1.41.12 debian 2); therefore, I have had to resort to
>> trying the ‘stat’ command on every possible inode number;
> I am not sure if there is a way to list used inodes in debugfs but it
> should be very easy to implement.
Something along the lines of the following, perhaps (assuming
ISO C99):
{
int only_with_blocks_p
= 0;
ext2_inode_scan scan;
{
errcode_t r
= ext2fs_open_inode_scan (e2, 0, &scan);
assert (r == 0);
}
FILE *out
= stdout;
errcode_t r;
ext2_ino_t ino;
struct ext2_inode inode;
int column;
/* FIXME: handle EXT2_ET_BAD_BLOCK_IN_INODE_TABLE, too */
while (((r = ext2fs_get_next_inode (scan, &ino, &inode)) == 0)
&& ino != 0) {
if (! only_with_blocks_p
|| ext2fs_inode_has_valid_blocks (inode)) {
/* skip over the inodes lacking valid blocks, if requested */
continue;
}
int n
= fprintf (out, " <%d>");
assert (n >= 0);
column += n;
/* NB: assuming that a typical inode number will be less than 9
decimal digits long, and that the terminal has 80 columns
*/
if (column >= 80 - 12) {
fputc ('\n', out);
}
}
/* FIXME: handle EXT2_ET_BAD_BLOCK_IN_INODE_TABLE, too */
assert (r == 0);
}
Or should I develop a proper patch?
[…]
--
FSF associate member #7257
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2011-08-17 5:21 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-08-13 10:21 e2dis: a Jigdo-like tool for Ext2+ FS Ivan Shmakov
2011-08-14 6:56 ` Ivan Shmakov
2011-08-15 9:29 ` Lukas Czerner
2011-08-15 11:10 ` Ivan Shmakov
2011-08-15 16:12 ` Lukas Czerner
2011-08-17 5:21 ` Ivan Shmakov [this message]
2011-08-17 5:49 ` Ivan Shmakov
2011-08-18 16:27 ` ext2fs_test_block_bitmap (): Unknown code ext2 47 #0, etc Ivan Shmakov
2011-08-22 4:31 ` Ted Ts'o
2011-08-23 17:26 ` 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=86ippw1ulp.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).