]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commit
xfs_db: use iocursor type to guess btree geometry if bad magic
authorDarrick J. Wong <darrick.wong@oracle.com>
Tue, 2 May 2017 16:12:55 +0000 (11:12 -0500)
committerEric Sandeen <sandeen@redhat.com>
Tue, 2 May 2017 16:12:55 +0000 (11:12 -0500)
commit58615a7a8851275887815c635560d1f0c57edcf7
tree71cb16542c849a3df05c1a94c90c5061d6e31603
parent966ef874a8920c238d24b45bd1e8697b8dfcd4da
xfs_db: use iocursor type to guess btree geometry if bad magic

The function block_to_bt plays an integral role in determining the btree
geometry of a block that we want to manipulate with the debugger.
Normally we use the block magic to find the geometry profile, but if the
magic is bad we'll never find it and return NULL.  The callers of this
function do not check for NULL and crash.

Therefore, if we can't find a geometry profile matching the magic
number, use the iocursor type to guess the profile and scowl about that
to stdout.  This makes it so that even with a corrupt magic we can try
to print the fields instead of crashing the debugger.

[sandeen: comment changes, add magic ASSERT, keep other ASSERTs]

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
db/btblock.c