In v2, I had made the multi-conn filter possible by reverting several
patches to make the handle of filters.c a local struct instead of
reusing 'struct backend *' from internal.h, and Rich (rightly)
complained that it felt like a step backwards. That forced me to
rethink about what filters really want, and ultimately (mostly)
implement one of our TODO items about letting a filter be able to
probe the backend separately from waiting for a connection from the
client. I still have more work to do to get the ext2 filter where I
want (while .after_fork is a great place to start a thread, we also
need a place to end that thread gracefully before .unload, since right
now .unload iterates inner-to-outer but cleanup must be done
outer-to-inner). But this series has taken me all week to get to this
point, so I'll post the progress I've made so far.
Eric Blake (16):
filters: Slightly reduce promise of nxdata lifetime
filters: Temporarily make next_ops->reopen a public function
server: Move default_exportname from handle to connection
server: Rename struct handle to struct context
server: Update signature of backend_open
backend: Inline reset_context
server: Manage contexts by backend, not int
backend: Plumb context through internal callbacks
filters: Use struct context for next_ops
server: Store nbdkit_next_ops in struct context
filters: Use context rather than connection to track c_next
filters: New API for plugin context management
ext2: Simplify use of next_ops
filters: Adjust API for type-safety and merged next_ops/nxdata
multi-conn: New filter
multi-conn: Knob to limit consistency emulation by export name
docs/nbdkit-filter.pod | 349 +++++++-----
filters/cache/nbdkit-cache-filter.pod | 5 +-
filters/fua/nbdkit-fua-filter.pod | 7 +
.../multi-conn/nbdkit-multi-conn-filter.pod | 201 +++++++
filters/nocache/nbdkit-nocache-filter.pod | 1 +
filters/noextents/nbdkit-noextents-filter.pod | 1 +
.../noparallel/nbdkit-noparallel-filter.pod | 1 +
filters/nozero/nbdkit-nozero-filter.pod | 1 +
include/nbdkit-filter.h | 125 +++--
configure.ac | 4 +-
filters/multi-conn/Makefile.am | 68 +++
tests/Makefile.am | 11 +
server/internal.h | 147 ++---
server/backend.c | 458 ++++++++--------
server/connections.c | 25 +-
server/extents.c | 21 +-
server/filters.c | 251 +++++----
server/nbdkit.syms | 12 +-
server/plugins.c | 141 +++--
server/protocol-handshake-newstyle.c | 23 +-
server/protocol-handshake.c | 29 +-
server/protocol.c | 23 +-
filters/cache/blk.h | 16 +-
filters/cow/blk.h | 8 +-
filters/ext2/io.h | 11 +-
filters/partition/partition.h | 4 +-
filters/xz/xzfile.h | 6 +-
filters/blocksize/blocksize.c | 76 ++-
filters/cache/blk.c | 16 +-
filters/cache/cache.c | 94 ++--
filters/cacheextents/cacheextents.c | 16 +-
filters/checkwrite/checkwrite.c | 32 +-
filters/cow/blk.c | 10 +-
filters/cow/cow.c | 80 +--
filters/ddrescue/ddrescue.c | 10 +-
filters/delay/delay.c | 30 +-
filters/error/error.c | 26 +-
filters/exitlast/exitlast.c | 2 +-
filters/exitwhen/exitwhen.c | 11 +-
filters/exportname/exportname.c | 14 +-
filters/ext2/ext2.c | 56 +-
filters/ext2/io.c | 73 ++-
filters/extentlist/extentlist.c | 11 +-
filters/fua/fua.c | 38 +-
filters/gzip/gzip.c | 32 +-
filters/ip/ip.c | 7 +-
filters/limit/limit.c | 2 +-
filters/log/log.c | 63 +--
filters/multi-conn/multi-conn.c | 515 ++++++++++++++++++
filters/nocache/nocache.c | 6 +-
filters/noextents/noextents.c | 2 +-
filters/noparallel/noparallel.c | 2 +-
filters/nozero/nozero.c | 22 +-
filters/offset/offset.c | 33 +-
filters/partition/partition-gpt.c | 7 +-
filters/partition/partition-mbr.c | 5 +-
filters/partition/partition.c | 52 +-
filters/pause/pause.c | 31 +-
filters/rate/rate.c | 15 +-
filters/readahead/readahead.c | 39 +-
filters/retry/retry.c | 130 +++--
filters/stats/stats.c | 36 +-
filters/swab/swab.c | 32 +-
filters/tar/tar.c | 51 +-
filters/tls-fallback/tls-fallback.c | 50 +-
filters/truncate/truncate.c | 50 +-
filters/xz/xz.c | 28 +-
filters/xz/xzfile.c | 45 +-
tests/test-multi-conn-name.sh | 88 +++
tests/test-multi-conn-plugin.sh | 141 +++++
tests/test-multi-conn.sh | 293 ++++++++++
tests/test-truncate4.sh | 2 +-
tests/test-layers-filter.c | 153 +++---
TODO | 43 +-
74 files changed, 3015 insertions(+), 1504 deletions(-)
create mode 100644 filters/multi-conn/nbdkit-multi-conn-filter.pod
create mode 100644 filters/multi-conn/Makefile.am
create mode 100644 filters/multi-conn/multi-conn.c
create mode 100755 tests/test-multi-conn-name.sh
create mode 100755 tests/test-multi-conn-plugin.sh
create mode 100755 tests/test-multi-conn.sh
--
2.30.1