--- docs/nbdkit-captive.pod | 4 ++-- docs/nbdkit-plugin.pod | 2 +- docs/nbdkit-service.pod | 2 +- docs/nbdkit-tls.pod | 2 +- filters/cow/nbdkit-cow-filter.pod | 4 ++-- filters/delay/nbdkit-delay-filter.pod | 2 +- filters/error/nbdkit-error-filter.pod | 6 +++--- filters/fua/nbdkit-fua-filter.pod | 8 ++++---- filters/log/nbdkit-log-filter.pod | 4 ++-- filters/nozero/nbdkit-nozero-filter.pod | 4 ++-- filters/offset/nbdkit-offset-filter.pod | 4 ++-- filters/partition/nbdkit-partition-filter.pod | 2 +- plugins/file/file.c | 1 + plugins/file/nbdkit-file-plugin.pod | 7 ++++++- tests/test-blocksize.sh | 4 ++-- tests/test-cache.sh | 2 +- tests/test-cow.sh | 2 +- tests/test-file-block.c | 3 +-- tests/test-file.c | 2 +- tests/test-fua.sh | 8 ++++---- tests/test-log.sh | 2 +- tests/test-nbd.c | 2 +- tests/test-newstyle.c | 2 +- tests/test-nozero.sh | 10 +++++----- tests/test-offset.c | 2 +- tests/test-oldstyle.c | 2 +- tests/test-parallel-file.sh | 4 ++-- tests/test-parallel-nbd.sh | 2 +- tests/test-partition.c | 2 +- tests/test-single.sh | 2 +- 30 files changed, 54 insertions(+), 49 deletions(-)
diff --git a/docs/nbdkit-captive.pod b/docs/nbdkit-captive.pod index 6db9520..340374f 100644 --- a/docs/nbdkit-captive.pod +++ b/docs/nbdkit-captive.pod @@ -26,7 +26,7 @@ Some examples should make this clear. To run nbdkit captive under qemu: - nbdkit file file=disk.img --run 'qemu -drive file=$nbd,if=virtio' + nbdkit file disk.img --run 'qemu -drive file=$nbd,if=virtio' On the qemu command line, C<$nbd> is substituted automatically with the right NBD path so it can connect to nbdkit. When qemu exits, @@ -34,7 +34,7 @@ nbdkit is killed and cleaned up automatically. Running nbdkit captive under guestfish: - nbdkit file file=disk.img --run 'guestfish --format=raw -a $nbd -i' + nbdkit file disk.img --run 'guestfish --format=raw -a $nbd -i' When guestfish exits, nbdkit is killed. diff --git a/docs/nbdkit-plugin.pod b/docs/nbdkit-plugin.pod index b37cac1..665f7e2 100644 --- a/docs/nbdkit-plugin.pod +++ b/docs/nbdkit-plugin.pod @@ -267,7 +267,7 @@ an indication of failure. It has the following prototype: The server usually (not always) changes directory to C</> before it starts serving connections. This means that any relative paths passed during configuration will not work when the server is running -(example: S<C<nbdkit plugin.so file=disk.img>>). +(example: S<C<nbdkit plugin.so disk.img>>). To avoid problems, prepend relative paths with the current directory before storing them in the handle. Or open files and store the file diff --git a/docs/nbdkit-service.pod b/docs/nbdkit-service.pod index 956b4ab..c0d275f 100644 --- a/docs/nbdkit-service.pod +++ b/docs/nbdkit-service.pod @@ -45,7 +45,7 @@ Also create a service unit (eg. C</etc/systemd/system/nbdkit.service>) containing: [Service] - ExecStart=/usr/sbin/nbdkit file file=/path/to/serve + ExecStart=/usr/sbin/nbdkit file /path/to/serve For more information on systemd and socket activation, see L<http://0pointer.de/blog/projects/socket-activation.html> diff --git a/docs/nbdkit-tls.pod b/docs/nbdkit-tls.pod index 2e70739..ecca87a 100644 --- a/docs/nbdkit-tls.pod +++ b/docs/nbdkit-tls.pod @@ -194,7 +194,7 @@ client which can read this file will be able to connect to the server. Use the nbdkit I<--tls-psk> option to start the server: - nbdkit --tls=require --tls-psk=/tmp/keys/keys.psk -e / file file=disk.img + nbdkit --tls=require --tls-psk=/tmp/keys/keys.psk -e / file disk.img This option overrides X.509 certificate authentication. diff --git a/filters/cow/nbdkit-cow-filter.pod b/filters/cow/nbdkit-cow-filter.pod index ed48f2b..80100e7 100644 --- a/filters/cow/nbdkit-cow-filter.pod +++ b/filters/cow/nbdkit-cow-filter.pod @@ -59,7 +59,7 @@ normal way. Serve the file F<disk.img>, allowing writes, but do not save any changes into the file: - nbdkit --filter=cow file file=disk.img + nbdkit --filter=cow file disk.img L<nbdkit-xz-plugin(1)> only supports read access, but you can provide temporary write access by doing (although this does B<not> save @@ -76,7 +76,7 @@ otherwise all changes will be lost>. Run nbdkit: - nbdkit --filter=cow file file=disk.img + nbdkit --filter=cow file disk.img and then connect with a client and make whatever changes you need. At the end, disconnect the client. diff --git a/filters/delay/nbdkit-delay-filter.pod b/filters/delay/nbdkit-delay-filter.pod index 3bfb039..62c0093 100644 --- a/filters/delay/nbdkit-delay-filter.pod +++ b/filters/delay/nbdkit-delay-filter.pod @@ -16,7 +16,7 @@ remote server, or to test certain kinds of race conditions in Linux. =head1 EXAMPLE - nbdkit --filter=delay file file=disk.img rdelay=100ms wdelay=100ms + nbdkit --filter=delay file disk.img rdelay=100ms wdelay=100ms =head1 PARAMETERS diff --git a/filters/error/nbdkit-error-filter.pod b/filters/error/nbdkit-error-filter.pod index 0f02282..76003c7 100644 --- a/filters/error/nbdkit-error-filter.pod +++ b/filters/error/nbdkit-error-filter.pod @@ -27,12 +27,12 @@ B<otherwise this filter will do nothing>. Inject a low rate of errors randomly into the connection: - nbdkit --filter=error file file=disk.img error-rate=1% + nbdkit --filter=error file disk.img error-rate=1% Reading and trimming requests will be successful, but all writes and zeroing will return "No space left on device": - nbdkit --filter=error file file=disk.img \ + nbdkit --filter=error file disk.img \ error=ENOSPC \ error-pwrite-rate=100% \ error-zero-rate=100% @@ -41,7 +41,7 @@ To make all connections fail hard 60 seconds after the server is started, use: rm -f /tmp/inject - nbdkit --filter=error file file=disk.img \ + nbdkit --filter=error file disk.img \ error-rate=100% \ error-file=/tmp/inject sleep 60; touch /tmp/inject diff --git a/filters/fua/nbdkit-fua-filter.pod b/filters/fua/nbdkit-fua-filter.pod index 8822a45..e0b3c4d 100644 --- a/filters/fua/nbdkit-fua-filter.pod +++ b/filters/fua/nbdkit-fua-filter.pod @@ -42,23 +42,23 @@ C<NBDKIT_FUA_NONE>). Serve the file F<disk.img>, but force the client to submit explicit flush requests instead of using C<NBD_CMD_FLAG_FUA>: - nbdkit --filter=fua file file=disk.img + nbdkit --filter=fua file disk.img Observe that the blocksize filter optimizes its handling of the FUA flag based on whether it knows nbdkit will be emulating FUA with a flush, by comparing the log filter output on top of different fua filter modes: - nbdkit --filter=blocksize --filter=log --filter=fua file file=disk.img \ + nbdkit --filter=blocksize --filter=log --filter=fua file disk.img \ maxlen=4k logfile=fua_emulated fuamode=emulate - nbdkit --filter=blocksize --filter=log --filter=fua file file=disk.img \ + nbdkit --filter=blocksize --filter=log --filter=fua file disk.img \ maxlen=4k logfile=fua_native fuamode=native Serve the file F<disk.img> in write-through mode, where all writes from the client are immediately flushed to disk as if the client had always requested FUA: - nbdkit --filter=fua file fuamode=force file=disk.img + nbdkit --filter=fua file fuamode=force disk.img =head1 SEE ALSO diff --git a/filters/log/nbdkit-log-filter.pod b/filters/log/nbdkit-log-filter.pod index 89ea551..0903329 100644 --- a/filters/log/nbdkit-log-filter.pod +++ b/filters/log/nbdkit-log-filter.pod @@ -29,12 +29,12 @@ already exists, it will be truncated. Serve the file F<disk.img>, and log each client transaction in the file F<disk.log>: - nbdkit --filter=log file file=disk.img logfile=disk.log + nbdkit --filter=log file disk.img logfile=disk.log Repeat the task, but with the cow (copy-on-write) filter to perform local caching of data served from the original plugin: - nbdkit --filter=cow --filter=log file file=disk.img logfile=disk.log2 + nbdkit --filter=cow --filter=log file disk.img logfile=disk.log2 After running a client that performs the same operations under each of the two servers, you can compare F<disk.log> and F<disk.log2> to see diff --git a/filters/nozero/nbdkit-nozero-filter.pod b/filters/nozero/nbdkit-nozero-filter.pod index 1301432..715605f 100644 --- a/filters/nozero/nbdkit-nozero-filter.pod +++ b/filters/nozero/nbdkit-nozero-filter.pod @@ -34,13 +34,13 @@ way to write zeros. Serve the file F<disk.img>, but force the client to write zeroes explicitly rather than with C<NBD_CMD_WRITE_ZEROES>: - nbdkit --filter=nozero file file=disk.img + nbdkit --filter=nozero file disk.img Serve the file F<disk.img>, allowing the client to take advantage of less network traffic via C<NBD_CMD_WRITE_ZEROES>, but still forcing the data to be written explicitly rather than punching any holes: - nbdkit --filter=nozero file zeromode=emulate file=disk.img + nbdkit --filter=nozero file zeromode=emulate disk.img =head1 SEE ALSO diff --git a/filters/offset/nbdkit-offset-filter.pod b/filters/offset/nbdkit-offset-filter.pod index 61496d2..a232e46 100644 --- a/filters/offset/nbdkit-offset-filter.pod +++ b/filters/offset/nbdkit-offset-filter.pod @@ -44,7 +44,7 @@ Using L<nbdkit-file-plugin(1)>, serve the file C<disk.img> starting at offset C<1M>. The total length served is C<100M> (the underlying file must therefore be at least C<101M> in length): - nbdkit --filter=offset file file=disk.img offset=1M range=100M + nbdkit --filter=offset file disk.img offset=1M range=100M =head2 Serve a single partition @@ -60,7 +60,7 @@ and length of the partition, eg using: You can then serve the partition only using: - nbdkit --filter=offset file file=disk.img offset=65536 range=104727040 + nbdkit --filter=offset file disk.img offset=65536 range=104727040 =head1 SEE ALSO diff --git a/filters/partition/nbdkit-partition-filter.pod b/filters/partition/nbdkit-partition-filter.pod index 0256e52..ae72f3f 100644 --- a/filters/partition/nbdkit-partition-filter.pod +++ b/filters/partition/nbdkit-partition-filter.pod @@ -38,7 +38,7 @@ This parameter is required. F<disk.img> is a partitioned disk image (eg. a virtual machine disk image). To serve the first partition only use: - nbdkit --filter=partition file file=disk.img partition=1 + nbdkit --filter=partition file disk.img partition=1 =head1 SEE ALSO diff --git a/plugins/file/file.c b/plugins/file/file.c index e7cbff6..9d03f18 100644 --- a/plugins/file/file.c +++ b/plugins/file/file.c @@ -476,6 +476,7 @@ static struct nbdkit_plugin plugin = { .config = file_config, .config_complete = file_config_complete, .config_help = file_config_help, + .magic_config_key = "file", .dump_plugin = file_dump_plugin, .open = file_open, .close = file_close, diff --git a/plugins/file/nbdkit-file-plugin.pod b/plugins/file/nbdkit-file-plugin.pod index b2c25d1..f8fe74c 100644 --- a/plugins/file/nbdkit-file-plugin.pod +++ b/plugins/file/nbdkit-file-plugin.pod @@ -4,7 +4,7 @@ nbdkit-file-plugin - nbdkit file plugin =head1 SYNOPSIS - nbdkit file file=FILENAME + nbdkit file FILENAME =head1 DESCRIPTION @@ -26,6 +26,11 @@ be used here. This parameter is required. +In nbdkit E<ge> 1.7, C<file=> may be omitted. To ensure that the +filename does not end up being parsed accidentally as C<key=value>, +prefix relative paths with C<./> (absolute paths do not need +modification). + =item B<rdelay> =item B<wdelay> diff --git a/tests/test-blocksize.sh b/tests/test-blocksize.sh index d239c9b..cb9b09f 100755 --- a/tests/test-blocksize.sh +++ b/tests/test-blocksize.sh @@ -73,9 +73,9 @@ trap cleanup INT QUIT TERM EXIT ERR # Run two parallel nbdkit; to compare the logs and see what changes. nbdkit -P blocksize1.pid -U blocksize1.sock \ - --filter=log file logfile=blocksize1.log file=blocksize1.img + --filter=log file logfile=blocksize1.log blocksize1.img nbdkit -P blocksize2.pid -U blocksize2.sock --filter=blocksize \ - --filter=log file logfile=blocksize2.log file=blocksize2.img \ + --filter=log file logfile=blocksize2.log blocksize2.img \ minblock=1024 maxdata=512k maxlen=1M # We may have to wait a short time for the pid files to appear. diff --git a/tests/test-cache.sh b/tests/test-cache.sh index 6f058b8..215bab1 100755 --- a/tests/test-cache.sh +++ b/tests/test-cache.sh @@ -41,7 +41,7 @@ rm -f $files truncate -s 1G cache.img # Run nbdkit with the caching filter. -nbdkit -P cache.pid -U cache.sock --filter=cache file file=cache.img +nbdkit -P cache.pid -U cache.sock --filter=cache file cache.img # We may have to wait a short time for the pid file to appear. for i in `seq 1 10`; do diff --git a/tests/test-cow.sh b/tests/test-cow.sh index 5bde829..f9b0649 100755 --- a/tests/test-cow.sh +++ b/tests/test-cow.sh @@ -42,7 +42,7 @@ guestfish -N cow-base.img=fs exit lastmod="$(stat -c "%y" cow-base.img)" # Run nbdkit with a COW overlay. -nbdkit -P cow.pid -U cow.sock --filter=cow file file=cow-base.img +nbdkit -P cow.pid -U cow.sock --filter=cow file cow-base.img # We may have to wait a short time for the pid file to appear. for i in `seq 1 10`; do diff --git a/tests/test-file-block.c b/tests/test-file-block.c index f053242..e2ea068 100644 --- a/tests/test-file-block.c +++ b/tests/test-file-block.c @@ -124,9 +124,8 @@ main (int argc, char *argv[]) atexit (detach_loopdev); /* Start nbdkit. */ - snprintf (buf, sizeof buf, "file=%s", loopdev); if (test_start_nbdkit ("-D", "file.zero=1", - "file", buf, NULL) == -1) + "file", loopdev, NULL) == -1) exit (EXIT_FAILURE); g = guestfs_create (); diff --git a/tests/test-file.c b/tests/test-file.c index 65a2568..9382ed2 100644 --- a/tests/test-file.c +++ b/tests/test-file.c @@ -52,7 +52,7 @@ main (int argc, char *argv[]) char *data; size_t i, size; - if (test_start_nbdkit ("file", "file=file-data", NULL) == -1) + if (test_start_nbdkit ("file", "file-data", NULL) == -1) exit (EXIT_FAILURE); g = guestfs_create (); diff --git a/tests/test-fua.sh b/tests/test-fua.sh index 98b1e84..f95aa18 100755 --- a/tests/test-fua.sh +++ b/tests/test-fua.sh @@ -84,13 +84,13 @@ trap cleanup INT QUIT TERM EXIT ERR # 3: fuamode=native: log shows that blocksize preserves fua # 4: fuamode=force: log shows that fua is always enabled nbdkit -P fua1.pid -U fua1.sock --filter=log --filter=fua \ - file logfile=fua1.log file=fua.img + file logfile=fua1.log fua.img nbdkit -P fua2.pid -U fua2.sock --filter=blocksize --filter=log --filter=fua \ - file logfile=fua2.log file=fua.img fuamode=emulate maxdata=4k maxlen=4k + file logfile=fua2.log fua.img fuamode=emulate maxdata=4k maxlen=4k nbdkit -P fua3.pid -U fua3.sock --filter=blocksize --filter=log --filter=fua \ - file logfile=fua3.log file=fua.img fuamode=native maxdata=4k maxlen=4k + file logfile=fua3.log fua.img fuamode=native maxdata=4k maxlen=4k nbdkit -P fua4.pid -U fua4.sock --filter=fua --filter=log \ - file logfile=fua4.log file=fua.img fuamode=force + file logfile=fua4.log fua.img fuamode=force # We may have to wait a short time for the pid files to appear. for i in `seq 1 10`; do diff --git a/tests/test-log.sh b/tests/test-log.sh index 877f9cc..f811de4 100755 --- a/tests/test-log.sh +++ b/tests/test-log.sh @@ -44,7 +44,7 @@ if ! qemu-io -f raw -c 'w 1M 2M' log.img; then fi # Run nbdkit with logging enabled to file. -nbdkit -P log.pid -U log.sock --filter=log file file=log.img logfile=log.log +nbdkit -P log.pid -U log.sock --filter=log file log.img logfile=log.log # We may have to wait a short time for the pid file to appear. for i in `seq 1 10`; do diff --git a/tests/test-nbd.c b/tests/test-nbd.c index 646c0c3..a09a0d5 100644 --- a/tests/test-nbd.c +++ b/tests/test-nbd.c @@ -55,7 +55,7 @@ main (int argc, char *argv[]) /* If wrapping once is good, why not do it twice! Shows that we can * convert between either style of server options. */ - if (test_start_nbdkit ("-o", "file", "file=file-data", NULL) == -1) + if (test_start_nbdkit ("-o", "file", "file-data", NULL) == -1) exit (EXIT_FAILURE); if (asprintf (&sockarg, "socket=%s", sock) < 0) { diff --git a/tests/test-newstyle.c b/tests/test-newstyle.c index cd0ba72..cadccec 100644 --- a/tests/test-newstyle.c +++ b/tests/test-newstyle.c @@ -55,7 +55,7 @@ main (int argc, char *argv[]) size_t i, size; if (test_start_nbdkit ("-e", EXPORTNAME, - "-n", "file", "file=file-data", NULL) == -1) + "-n", "file", "file-data", NULL) == -1) exit (EXIT_FAILURE); g = guestfs_create (); diff --git a/tests/test-nozero.sh b/tests/test-nozero.sh index 781b196..904d822 100755 --- a/tests/test-nozero.sh +++ b/tests/test-nozero.sh @@ -102,15 +102,15 @@ trap cleanup INT QUIT TERM EXIT ERR # 5a/b: both sides of nbd plugin: even though server side does not advertise # ZERO, the client side still exposes it, and just skips calling nbd's .zero nbdkit -P nozero1.pid -U nozero1.sock --filter=log \ - file logfile=nozero1.log file=nozero1.img + file logfile=nozero1.log nozero1.img nbdkit -P nozero2.pid -U nozero2.sock --filter=log --filter=nozero \ - file logfile=nozero2.log file=nozero2.img + file logfile=nozero2.log nozero2.img nbdkit -P nozero3.pid -U nozero3.sock --filter=log --filter=nozero \ - file logfile=nozero3.log file=nozero3.img zeromode=emulate + file logfile=nozero3.log nozero3.img zeromode=emulate nbdkit -P nozero4.pid -U nozero4.sock --filter=nozero --filter=log \ - file logfile=nozero4.log file=nozero4.img zeromode=emulate + file logfile=nozero4.log nozero4.img zeromode=emulate nbdkit -P nozero5a.pid -U nozero5a.sock --filter=log --filter=nozero \ - file logfile=nozero5a.log file=nozero5.img + file logfile=nozero5a.log nozero5.img nbdkit -P nozero5b.pid -U nozero5b.sock --filter=log \ nbd logfile=nozero5b.log socket=nozero5a.sock diff --git a/tests/test-offset.c b/tests/test-offset.c index d47066f..a7f467f 100644 --- a/tests/test-offset.c +++ b/tests/test-offset.c @@ -78,7 +78,7 @@ main (int argc, char *argv[]) * has not been overwritten. */ if (test_start_nbdkit ("--filter", "offset", - "file", "file=offset-data", + "file", "offset-data", "offset=1M", "range=8M", NULL) == -1) exit (EXIT_FAILURE); diff --git a/tests/test-oldstyle.c b/tests/test-oldstyle.c index bcffbe4..b3f3c4e 100644 --- a/tests/test-oldstyle.c +++ b/tests/test-oldstyle.c @@ -52,7 +52,7 @@ main (int argc, char *argv[]) char *data; size_t i, size; - if (test_start_nbdkit ("-o", "file", "file=file-data", NULL) == -1) + if (test_start_nbdkit ("-o", "file", "file-data", NULL) == -1) exit (EXIT_FAILURE); g = guestfs_create (); diff --git a/tests/test-parallel-file.sh b/tests/test-parallel-file.sh index fdc8a1b..fd88faa 100755 --- a/tests/test-parallel-file.sh +++ b/tests/test-parallel-file.sh @@ -56,7 +56,7 @@ qemu-io -f raw -c "aio_write -P 1 0 512" -c "aio_write -P 2 512 512" \ # tuning the delays may help. # With --threads=1, the write should complete first because it was issued first -nbdkit -v -t 1 -U - --filter=delay file file=test-parallel-file.data \ +nbdkit -v -t 1 -U - --filter=delay file test-parallel-file.data \ wdelay=2 rdelay=1 --run 'qemu-io -f raw -c "aio_write -P 2 512 512" \ -c "aio_read -P 1 0 512" -c aio_flush $nbd' | tee test-parallel-file.out @@ -67,7 +67,7 @@ read 512/512 bytes at offset 0"; then fi # With default --threads, the faster read should complete first -nbdkit -v -U - --filter=delay file file=test-parallel-file.data \ +nbdkit -v -U - --filter=delay file test-parallel-file.data \ wdelay=2 rdelay=1 --run 'qemu-io -f raw -c "aio_write -P 2 512 512" \ -c "aio_read -P 1 0 512" -c aio_flush $nbd' | tee test-parallel-file.out diff --git a/tests/test-parallel-nbd.sh b/tests/test-parallel-nbd.sh index e793c11..cb70f46 100755 --- a/tests/test-parallel-nbd.sh +++ b/tests/test-parallel-nbd.sh @@ -64,7 +64,7 @@ qemu-io -f raw -c "aio_write -P 1 0 512" -c "aio_write -P 2 512 512" \ nbdkit --exit-with-parent -v \ -U test-parallel-nbd.sock -P test-parallel-nbd.pid \ --filter=delay \ - file file=test-parallel-nbd.data wdelay=2 rdelay=1 & + file test-parallel-nbd.data wdelay=2 rdelay=1 & # We may have to wait a short time for the pid file to appear. for i in `seq 1 10`; do if test -f test-parallel-nbd.pid; then diff --git a/tests/test-partition.c b/tests/test-partition.c index 0087548..1064293 100644 --- a/tests/test-partition.c +++ b/tests/test-partition.c @@ -53,7 +53,7 @@ main (int argc, char *argv[]) if (test_start_nbdkit ("-r", "--filter", "partition", - "file", "file=disk", + "file", "disk", "partition=1", NULL) == -1) exit (EXIT_FAILURE); diff --git a/tests/test-single.sh b/tests/test-single.sh index dc6ce34..35017c8 100755 --- a/tests/test-single.sh +++ b/tests/test-single.sh @@ -51,7 +51,7 @@ rm -f $files truncate -s 1G single.disk socat unix-listen:single.sock,reuseaddr,fork \ - exec:'nbdkit -r -s file file=single.disk' & + exec:'nbdkit -r -s file single.disk' & pid=$! cleanup () -- 2.18.0 _______________________________________________ Libguestfs mailing list [email protected] https://www.redhat.com/mailman/listinfo/libguestfs
