1 # Filters for btrfs command output
3 . ./common.filter.btrfs
5 # Some, but not all, commands emit "Btrfs <version>"
6 _filter_btrfs_version()
13 sed -e "s/\(devid\s\+\)[0-9]\+/\1 <DEVID>/g"
16 # If passed a number as first arg, filter that number of devices
17 # If passed a UUID as second arg, filter that exact UUID
18 _filter_btrfs_filesystem_show()
22 NUM_SUBST="<EXACTNUM>"
33 # the uniq collapses all device lines into 1
34 _filter_uuid $UUID | _filter_scratch | _filter_scratch_pool | \
35 _filter_size | _filter_btrfs_version | _filter_devid | \
36 sed -e "s/\(Total devices\) $NUMDEVS/\1 $NUM_SUBST/g" | \
40 # This eliminates all numbers, and shows only unique lines,
41 # to accomodate a varying nr. of devices.
42 # If given an argument, make sure we saw that many devices
44 _filter_btrfs_device_stats()
50 NUMDEVS="thiswillnotmatch"
54 _filter_scratch | _filter_scratch_pool | \
55 sed -e "s/[0-9]\+$/<NUM>/g" | sort | uniq $UNIQ_OPT | \
56 sed -e "s/$NUMDEVS /<NUMDEVS> /g"
59 # make sure this script returns success