1nbdkit-swab-filter(1) NBDKIT nbdkit-swab-filter(1)
2
3
4
6 nbdkit-swab-filter - nbdkit filter for swapping byte order
7
9 nbdkit --filter=swab PLUGIN [PLUGIN-ARGS...] [swab-bits=8|16|32|64]
10
12 "nbdkit-swab-filter" is a filter for nbdkit(1) which swaps bytes in the
13 underlying plugin.
14
15 One use for this is to read disk images which were formatted on the
16 Atari Falcon, where the IDE controller is wired in reverse order.
17
19 Swap bytes from a disk image
20 nbdkit --filter=swab file file=disk.img
21
22 The above command serves the disk image disk.img, swapping even and odd
23 bytes:
24
25 disk.img 0 1 2 3 4 5 ...
26 ╳ ╳ ╳
27 output 1 0 3 2 5 4 ...
28
29 This filter truncates the size of the plugin down to the alignment
30 determined by swab-bits (since operating on an unaligned tail would be
31 awkward). If you need to round the image size up instead to access the
32 last few bytes, combine this filter with nbdkit-truncate-filter(1);
33 fortunately, sector-based disk images are already suitably sized.
34
36 swab-bits=8
37 This turns off the filter.
38
39 swab-bits=16
40 This is the default setting which swaps pairs of bytes. This is
41 suitable when reading and writing to Atari Falcon drives.
42
43 swab-bits=32
44 This swaps the endianness of each 4 byte word in the disk, ie:
45
46 input 0 1 2 3 4 5 6 7
47
48 output 3 2 1 0 7 6 5 4
49
50 swab-bits=64
51 This swaps the endianness of each 8 byte word in the disk, ie:
52
53 input 0 1 2 3 4 5 6 7
54
55 output 7 6 5 4 3 2 1 0
56
57 This can be used to make nbdkit-pattern-plugin(1) little endian
58 instead of big endian.
59
61 $filterdir/nbdkit-swab-filter.so
62 The filter.
63
64 Use "nbdkit --dump-config" to find the location of $filterdir.
65
67 "nbdkit-swab-filter" first appeared in nbdkit 1.22.
68
70 nbdkit(1), nbdkit-file-plugin(1), nbdkit-pattern-plugin(1),
71 nbdkit-filter(3), nbdkit-truncate-filter(1).
72
74 François Revol
75
77 Copyright (C) 2020 François Revol
78
80 Redistribution and use in source and binary forms, with or without
81 modification, are permitted provided that the following conditions are
82 met:
83
84 • Redistributions of source code must retain the above copyright
85 notice, this list of conditions and the following disclaimer.
86
87 • Redistributions in binary form must reproduce the above copyright
88 notice, this list of conditions and the following disclaimer in the
89 documentation and/or other materials provided with the
90 distribution.
91
92 • Neither the name of Red Hat nor the names of its contributors may
93 be used to endorse or promote products derived from this software
94 without specific prior written permission.
95
96 THIS SOFTWARE IS PROVIDED BY RED HAT AND CONTRIBUTORS ''AS IS'' AND ANY
97 EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
98 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
99 PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL RED HAT OR CONTRIBUTORS BE
100 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
101 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
102 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
103 BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
104 WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
105 OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
106 ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
107
108
109
110nbdkit-1.25.8 2021-05-25 nbdkit-swab-filter(1)