$filterdir/nbdkit-swab-filter.so
The filter.
Use "nbdkit --dump-config" to find the location of $filterdir.
Nbdkit filter for swapping byte order
nbdkit --filter=swab
PLUGIN
[PLUGIN-ARGS ...]
[{swab-bits=8 | 16 | 32 | 64}]
"nbdkit-swab-filter" is a filter for nbdkit(1) which swaps bytes in the underlying plugin.
One use for this is to read disk images which were formatted on the Atari Falcon, where the IDE controller is wired in reverse order.
nbdkit --filter=swab file file=disk.img
The above command serves the disk image disk.img, swapping even and odd bytes:
disk.img 0 1 2 3 4 5 ...╳ ╳ ╳output 1 0 3 2 5 4 ...
This filter truncates the size of the plugin down to the alignment determined by swab-bits (since operating on an unaligned tail would be awkward). If you need to round the image size up instead to access the last few bytes, combine this filter with nbdkit-truncate-filter(1); fortunately, sector-based disk images are already suitably sized.
Note that this filter fails operations where the offset or count are not aligned to the swab-bits boundaries; if you need byte-level access, apply the nbdkit-blocksize-filter(1) before this one, to get read-modify-write access to individual bytes.
swab-bits=8This turns off the filter.
swab-bits=16This is the default setting which swaps pairs of bytes. This is suitable when reading and writing to Atari Falcon drives.
swab-bits=32This swaps the endianness of each 4 byte word in the disk, ie:
input 0 1 2 3 4 5 6 7
output 3 2 1 0 7 6 5 4
swab-bits=64This swaps the endianness of each 8 byte word in the disk, ie:
input 0 1 2 3 4 5 6 7
output 7 6 5 4 3 2 1 0
This can be used to make nbdkit-pattern-plugin(1) little endian instead of big endian.
$filterdir/nbdkit-swab-filter.so
The filter.
Use "nbdkit --dump-config" to find the location of $filterdir.
"nbdkit-swab-filter" first appeared in nbdkit 1.22.
3 releases since Debian 11 (Bullseye); the text changed 2 times.