file: Add an internal "mode"
commit2620d95a4585204f0db0d55c0d41276d11970436
authorRichard W.M. Jones <rjones@redhat.com>
Wed, 17 Aug 2022 14:51:50 +0000 (17 15:51 +0100)
committerRichard W.M. Jones <rjones@redhat.com>
Wed, 17 Aug 2022 14:56:19 +0000 (17 15:56 +0100)
tree161604351e3db2b6f5b90919f1de2c1b1dbef358
parent5764fa6f4a2b1408e4e62c39b2413e55ef77ab36
file: Add an internal "mode"

Previously we relied on the implicit assumption filename xor directory,
representing two modes.  Make this explicit with an internal mode
variable.

This is just refactoring and should not change the functionality.
However we're now more strict about duplicate file= or dir= parameters
appearing on the command line.  Previously only the last one had an
effect and the others were silently ignored.  Now we give an error in
this case.  eg this worked before but now gives an error:

  $ ./nbdkit file /var/tmp /var/tmp/fedora-36.img
  nbdkit: error: file|dir parameter can only appear once on the command line
plugins/file/file.c