1nbdkit-swab-filter(1)               NBDKIT               nbdkit-swab-filter(1)
2
3
4

NAME

6       nbdkit-swab-filter - nbdkit filter for swapping byte order
7

SYNOPSIS

9        nbdkit --filter=swab PLUGIN [PLUGIN-ARGS...] [swab-bits=8|16|32|64]
10

DESCRIPTION

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

EXAMPLE

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
35       Note that this filter fails operations where the offset or count are
36       not aligned to the swab-bits boundaries; if you need byte-level access,
37       apply the nbdkit-blocksize-filter(1) before this one, to get read-
38       modify-write access to individual bytes.
39

PARAMETERS

41       swab-bits=8
42           This turns off the filter.
43
44       swab-bits=16
45           This is the default setting which swaps pairs of bytes.  This is
46           suitable when reading and writing to Atari Falcon drives.
47
48       swab-bits=32
49           This swaps the endianness of each 4 byte word in the disk, ie:
50
51             input    0   1   2   3   4   5   6   7
52
53            output    3   2   1   0   7   6   5   4
54
55       swab-bits=64
56           This swaps the endianness of each 8 byte word in the disk, ie:
57
58             input    0   1   2   3   4   5   6   7
59
60            output    7   6   5   4   3   2   1   0
61
62           This can be used to make nbdkit-pattern-plugin(1) little endian
63           instead of big endian.
64

FILES

66       $filterdir/nbdkit-swab-filter.so
67           The filter.
68
69           Use "nbdkit --dump-config" to find the location of $filterdir.
70

VERSION

72       "nbdkit-swab-filter" first appeared in nbdkit 1.22.
73

SEE ALSO

75       nbdkit(1), nbdkit-file-plugin(1), nbdkit-pattern-plugin(1),
76       nbdkit-filter(3), nbdkit-blocksize-filter(1).
77       nbdkit-truncate-filter(1).
78

AUTHORS

80       François Revol
81
83       Copyright (C) 2020 François Revol
84

LICENSE

86       Redistribution and use in source and binary forms, with or without
87       modification, are permitted provided that the following conditions are
88       met:
89
90       •   Redistributions of source code must retain the above copyright
91           notice, this list of conditions and the following disclaimer.
92
93       •   Redistributions in binary form must reproduce the above copyright
94           notice, this list of conditions and the following disclaimer in the
95           documentation and/or other materials provided with the
96           distribution.
97
98       •   Neither the name of Red Hat nor the names of its contributors may
99           be used to endorse or promote products derived from this software
100           without specific prior written permission.
101
102       THIS SOFTWARE IS PROVIDED BY RED HAT AND CONTRIBUTORS ''AS IS'' AND ANY
103       EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
104       IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
105       PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL RED HAT OR CONTRIBUTORS BE
106       LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
107       CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
108       SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
109       BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
110       WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
111       OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
112       ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
113
114
115
116nbdkit-1.36.2                     2023-11-26             nbdkit-swab-filter(1)
Impressum