[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <86ippw1ulp.fsf_-_@gray.siamics.net>
Date: Wed, 17 Aug 2011 12:21:22 +0700
From: Ivan Shmakov <ivan@...y.siamics.net>
To: linux-ext4@...r.kernel.org
Subject: debugfs: list inode numbers?
>>>>> Lukas Czerner <lczerner@...hat.com> writes:
>>>>> On Mon, 15 Aug 2011, Ivan Shmakov wrote:
>>>>> Lukas Czerner <lczerner@...hat.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@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists