2011-08-18 16:27:45

by Ivan Shmakov

[permalink] [raw]
Subject: ext2fs_test_block_bitmap (): Unknown code ext2 47 #0, etc.

>>>>> Ivan Shmakov <[email protected]> writes:

[…]

> (The support for the whole-image and metadata message digests is not
> yet committed.)

The code is now ready to be committed. However, I'm getting the
following message on stderr upon a call (only the first one?) to
ext2fs_test_block_bitmap ():

--cut--
Unknown code ext2 47 #0 for block bitmap for /dev/stdin
--cut--

Otherwise, e2dis seems to behave sanely.

Also, do I understand it correctly that I need to call
ext2fs_read_block_bitmap () before accessing the block_map
member of the ext2_filsys structure?

[…]

--
FSF associate member #7257 Coming soon: Software Freedom Day
http://mail.sf-day.org/lists/listinfo/ planning-ru (ru), sfd-discuss (en)


2011-08-22 05:13:35

by Theodore Ts'o

[permalink] [raw]
Subject: Re: ext2fs_test_block_bitmap (): Unknown code ext2 47 #0, etc.

On Thu, Aug 18, 2011 at 11:27:30PM +0700, Ivan Shmakov wrote:
> >>>>> Ivan Shmakov <[email protected]> writes:
>
> […]
>
> > (The support for the whole-image and metadata message digests is not
> > yet committed.)
>
> The code is now ready to be committed. However, I'm getting the
> following message on stderr upon a call (only the first one?) to
> ext2fs_test_block_bitmap ():
>
> --cut--
> Unknown code ext2 47 #0 for block bitmap for /dev/stdin
> --cut--

You're not getting a human-readable error message because you need to
add the following at the beginning of your program:

add_error_table(&et_ext2_error_table);

(The error messages are printed by the libcom_err library, and are
defined in lib/ext2fs/ext2_err.et.in, processed to
lib/ext2fs/ext2_err.et, and then compiled to ext2_err.c and ext2_err.h
by the compile_et script in lib/et of e2fsprogs.)

The 47th error message in the ext2 error table, which would have been
printed if you had called add_error_table(), is:

Illegal block number passed to ext2fs_test_block_bitmap

This means you've passed in a block number which is out-of-range for
the block bitmap.

> Also, do I understand it correctly that I need to call
> ext2fs_read_block_bitmap () before accessing the block_map
> member of the ext2_filsys structure?

Yes, or if you are going to need to read in both the block and inode
bitmaps, you can use ext2fs_read_bitmaps(), which will be more optimal
for reading in the block bitmaps.

- Ted

2011-08-23 17:26:56

by Ivan Shmakov

[permalink] [raw]
Subject: Re: ext2fs_test_block_bitmap (): Unknown code ext2 47 #0, etc.

>>>>> Ted Ts'o <[email protected]> writes:
>>>>> On Thu, Aug 18, 2011 at 11:27:30PM +0700, Ivan Shmakov wrote:

[…]

>> However, I'm getting the following message on stderr upon a call
>> (only the first one?) to ext2fs_test_block_bitmap ():

>> --cut--
>> Unknown code ext2 47 #0 for block bitmap for /dev/stdin
>> --cut--

> You're not getting a human-readable error message because you need to
> add the following at the beginning of your program:

> add_error_table(&et_ext2_error_table);

Thanks for the suggestion!

[…]

> The 47th error message in the ext2 error table, which would have been
> printed if you had called add_error_table(), is:

> Illegal block number passed to ext2fs_test_block_bitmap

> This means you've passed in a block number which is out-of-range for
> the block bitmap.

Do I understand it correctly that the block #0 isn't covered by
any bitmap? (I guess it's reserved for bootloaders, etc.)

>> Also, do I understand it correctly that I need to call
>> ext2fs_read_block_bitmap () before accessing the block_map member of
>> the ext2_filsys structure?

> Yes, or if you are going to need to read in both the block and inode
> bitmaps, you can use ext2fs_read_bitmaps(), which will be more
> optimal for reading in the block bitmaps.

ACK. Thanks.

--
FSF associate member #7257 Coming soon: Software Freedom Day
http://mail.sf-day.org/lists/listinfo/ planning-ru (ru), sfd-discuss (en)