]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commit
db: limit AGFL bno array printing
authorDave Chinner <dchinner@redhat.com>
Mon, 30 May 2016 00:33:16 +0000 (10:33 +1000)
committerDave Chinner <david@fromorbit.com>
Mon, 30 May 2016 00:33:16 +0000 (10:33 +1000)
commit0ebbf1d58898af19dec167a4a06bba5ac86ac776
tree04fd36c7702bd8f15b3bc9d611d49b18a256c8ea
parent86769b32d01827daeda160ebcfbf814a49a4ef74
db: limit AGFL bno array printing

When asking for a single agfl entry such as:

# xfs_db -c "agfl 0" -c "p bno[1]" /dev/ram0
bno[1] = 1:6 2:7 3:8 4:null .....

The result should be just the single entry being asked for.
Currently this outputs the entire remainder of the array starting at
the given index. This makes it difficult to extract single entry
values.

This occurs because the printing of a flat array of number types
does not take into account the range that is specified on the
command line, which is held in fl->low and fl->high. To make this
work for flat arrays of number types (print function fp_num), change
print_flist() to limit the count of values to be emitted to the
range specified. This now gives:

# xfs_db -c "agfl 0" -c "p bno[1-2]" /dev/ram0
bno[1-2] = 1:6 2:7

To further simplify external parsing of single entry values, if only
a single value is requested from the array of fp_num type, don't
print the array index - it's already known. Hence:

# xfs_db -c "agfl 0" -c "p bno[1]" /dev/ram0
bno[1] = 6

This change will take effect on all types of flat number arrays that
are printed. e.g. the range limiting will work for things like the
AGI unlinked list arrays.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Carlos Maiolino <cmaiolino@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dave Chinner <david@fromorbit.com>
db/fprint.c
db/print.c