This is an API/ABI break, but we have not yet declared stable API.
The NBD spec allows clients to send FLAG_FUA on any command, even
though it recommends that FUA only be sent for write-like commands;
however, without strong reason, I don't see the point in letting
libnbd allow clients to send FLAG_FUA on non-write commands. The NBD
spec also adds the DF flag for reads from a server that supports
structured replies (which an upcoming commit will address), and may
add future flags.
Thinking towards the future, we normally want to refuse a flag that we
know the spec does not permit (for example, we already reject
nbd_pwrite(...,LIBNBD_CMD_FLAG_FUA) if the server did not advertise
FUA support), and the NBD spec tends to not allow new flags without
some form of handshaking to agree that both sides understand the new
flag. But we may also want to add a future API
nbd_set_experimental(nbd, true) as a way to allow a client to pass in
any flags for rapid prototyping against a server, without having to
wait for a new libnbd release that understands the new flag.
As such, all of our transmission-phase APIs should have a flags
parameter, even if callers must always set it to 0 for now. Note that
in the case of disconnect, nbd_aio_disconnect gets the flag, but
nbd_shutdown remains a general purpose wrapper that works even when
not in transmission phase (that is, there is a reason why we did not
add a mere nbd_disconnect sync wrapper), so it does not need to get a
flag (if you need fine-grained control over shutdown, aio is
sufficient).
We may also want to consider teaching the generator about optional
parameters, and have flags default to 0 if not present in languages
that support that (python being the obvious candidate); sadly, C
varargs are insufficient for our purposes, as we'd have to have some
way to know whether or not to expect to parse a flags argument from a
va_list argument.
---
docs/libnbd.pod | 6 +--
examples/batched-read-write.c | 4 +-
examples/simple-fetch-first-sector.c | 2 +-
examples/simple-reads-and-writes.c | 2 +-
examples/threaded-reads-and-writes.c | 2 +-
generator/generator | 70 +++++++++++++++++++---------
interop/interop.c | 2 +-
lib/disconnect.c | 10 +++-
lib/rw.c | 33 +++++++++----
python/t/400-pread.py | 2 +-
python/t/410-pwrite.py | 2 +-
python/t/500-aio-pread.py | 2 +-
python/t/510-aio-pwrite.py | 2 +-
tests/aio-parallel-load.c | 2 +-
tests/aio-parallel.c | 2 +-
tests/connect-tls.c | 2 +-
tests/errors.c | 2 +-
tests/oldstyle.c | 2 +-
tests/synch-parallel.c | 2 +-
19 files changed, 99 insertions(+), 52 deletions(-)
diff --git a/docs/libnbd.pod b/docs/libnbd.pod
index b5708f4..1aba966 100644
--- a/docs/libnbd.pod
+++ b/docs/libnbd.pod
@@ -11,7 +11,7 @@ libnbd - network block device (NBD) client library in userspace
if ((nbd = nbd_create ()) == NULL ||
nbd_connect_tcp (nbd, "server.example.com", "nbd") == -1 ||
- nbd_pread (nbd, buf, sizeof buf, 0) == -1)
+ nbd_pread (nbd, buf, sizeof buf, 0, 0) == -1)
fprintf (stderr, "%s\n", nbd_get_error ());
exit (EXIT_FAILURE);
}
@@ -91,7 +91,7 @@ Read the first sector (512 bytes) from the NBD export:
char buf[512];
- if (nbd_pread (nbd, buf, sizeof buf, 0) == -1) {
+ if (nbd_pread (nbd, buf, sizeof buf, 0, 0) == -1) {
fprintf (stderr, "%s\n", nbd_get_error ());
exit (EXIT_FAILURE);
}
@@ -156,7 +156,7 @@ has completed:
int64_t id;
char buf[512];
- id = nbd_aio_pread (nbd, buf, sizeof buf, offset)
+ id = nbd_aio_pread (nbd, buf, sizeof buf, offset, 0)
if (id == -1) {
fprintf (stderr, "%s\n", nbd_get_error ());
exit (EXIT_FAILURE);
diff --git a/examples/batched-read-write.c b/examples/batched-read-write.c
index 300ca02..a59f5a0 100644
--- a/examples/batched-read-write.c
+++ b/examples/batched-read-write.c
@@ -54,7 +54,7 @@ try_deadlock (void *arg)
/* Issue commands. */
in_flight = 0;
- handles[0] = nbd_aio_pread (nbd, in, packetsize, 0);
+ handles[0] = nbd_aio_pread (nbd, in, packetsize, 0, 0);
if (handles[0] == -1) {
fprintf (stderr, "%s\n", nbd_get_error ());
goto error;
@@ -183,7 +183,7 @@ main (int argc, char *argv[])
}
/* Attempt to be non-destructive, by writing what file already contains */
- if (nbd_pread (nbd, out, packetsize, packetsize) == -1) {
+ if (nbd_pread (nbd, out, packetsize, packetsize, 0) == -1) {
fprintf (stderr, "sync read failed: %s\n", nbd_get_error ());
exit (EXIT_FAILURE);
}
diff --git a/examples/simple-fetch-first-sector.c b/examples/simple-fetch-first-sector.c
index 7791d26..1778626 100644
--- a/examples/simple-fetch-first-sector.c
+++ b/examples/simple-fetch-first-sector.c
@@ -38,7 +38,7 @@ main (int argc, char *argv[])
exit (EXIT_FAILURE);
}
- if (nbd_pread (nbd, buf, sizeof buf, 0) == -1) {
+ if (nbd_pread (nbd, buf, sizeof buf, 0, 0) == -1) {
fprintf (stderr, "%s\n", nbd_get_error ());
exit (EXIT_FAILURE);
}
diff --git a/examples/simple-reads-and-writes.c b/examples/simple-reads-and-writes.c
index fa8f48d..5ed5bb7 100644
--- a/examples/simple-reads-and-writes.c
+++ b/examples/simple-reads-and-writes.c
@@ -71,7 +71,7 @@ main (int argc, char *argv[])
/* 1000 reads and writes. */
for (i = 0; i < 1000; ++i) {
offset = rand () % (exportsize - sizeof buf);
- if (nbd_pread (nbd, buf, sizeof buf, offset) == -1) {
+ if (nbd_pread (nbd, buf, sizeof buf, offset, 0) == -1) {
fprintf (stderr, "%s\n", nbd_get_error ());
exit (EXIT_FAILURE);
}
diff --git a/examples/threaded-reads-and-writes.c b/examples/threaded-reads-and-writes.c
index 8e42d3a..b912e3b 100644
--- a/examples/threaded-reads-and-writes.c
+++ b/examples/threaded-reads-and-writes.c
@@ -257,7 +257,7 @@ start_thread (void *arg)
if (cmd == 0)
handle = nbd_aio_pwrite (nbd, buf, sizeof buf, offset, 0);
else
- handle = nbd_aio_pread (nbd, buf, sizeof buf, offset);
+ handle = nbd_aio_pread (nbd, buf, sizeof buf, offset, 0);
if (handle == -1) {
fprintf (stderr, "%s\n", nbd_get_error ());
goto error;
diff --git a/generator/generator b/generator/generator
index 0a3db5e..9af5377 100755
--- a/generator/generator
+++ b/generator/generator
@@ -1219,7 +1219,7 @@ with the server.";
"pread", {
default_call with
- args = [ BytesOut ("buf", "count"); UInt64 "offset" ];
+ args = [ BytesOut ("buf", "count"); UInt64 "offset";
UInt32 "flags" ];
ret = RErr;
shortdesc = "read from the NBD server";
longdesc = "\
@@ -1227,7 +1227,10 @@ Issue a read command to the NBD server for the range starting
at C<offset> and ending at C<offset> + C<count> - 1. NBD
can only read all or nothing using this call. The call
returns when the data has been read fully into C<buf> or there is an
-error.";
+error.
+
+The C<flags> parameter must be C<0> for now (it exists for future NBD
+protocol extensions).";
};
"pwrite", {
@@ -1257,18 +1260,26 @@ C<nbd_can_fua>).";
Issue the disconnect command to the NBD server. This is
a nice way to tell the server we are going away, but from the
client's point of view has no advantage over abruptly closing
-the connection (see C<nbd_close>).";
+the connection (see C<nbd_close>).
+
+This function works whether or not the handle is ready for
+transmission commands, and as such does not take a C<flags>
+parameter. If more fine-grained control is needed, see
+C<nbd_aio_disconnect>.";
};
"flush", {
default_call with
- args = []; ret = RErr;
+ args = [ UInt32 "flags" ]; ret = RErr;
shortdesc = "flushing pending write requests";
longdesc = "\
Issue the flush command to the NBD server. The function should
return when all write commands which have completed have been
committed to permanent storage on the server. Note this will
-return an error if C<nbd_can_flush> is false.";
+return an error if C<nbd_can_flush> is false.
+
+The C<flags> parameter must be C<0> for now (it exists for future NBD
+protocol extensions).";
};
"trim", {
@@ -1292,7 +1303,7 @@ C<nbd_can_fua>).";
"cache", {
default_call with
- args = [ UInt64 "count"; UInt64 "offset" ];
+ args = [ UInt64 "count"; UInt64 "offset"; UInt32
"flags" ];
ret = RErr;
shortdesc = "send cache (prefetch) to the NBD server";
longdesc = "\
@@ -1301,7 +1312,10 @@ if supported by the server causes data to be prefetched
into faster storage by the server, speeding up a subsequent
C<nbd_pread> call. The server can also silently ignore
this command. Note this will return an error if
-C<nbd_can_cache> is false.";
+C<nbd_can_cache> is false.
+
+The C<flags> parameter must be C<0> for now (it exists for future NBD
+protocol extensions).";
};
"zero", {
@@ -1461,7 +1475,8 @@ on the connection.";
"aio_pread", {
default_call with
- args = [ BytesPersistOut ("buf", "count"); UInt64
"offset" ];
+ args = [ BytesPersistOut ("buf", "count"); UInt64
"offset";
+ UInt32 "flags" ];
ret = RInt64;
shortdesc = "read from the NBD server";
longdesc = "\
@@ -1469,7 +1484,8 @@ Issue a read command to the NBD server. This returns the
unique positive 64 bit handle for this command, or C<-1> on
error. To check if the command completed, call
C<nbd_aio_command_completed>. Note that you must ensure
-C<buf> is valid until the command has completed.";
+C<buf> is valid until the command has completed. Other
+parameters behave as documented in C<nbd_pread>.";
};
"aio_pwrite", {
@@ -1482,29 +1498,35 @@ Issue a write command to the NBD server. This returns the
unique positive 64 bit handle for this command, or C<-1> on
error. To check if the command completed, call
C<nbd_aio_command_completed>. Note that you must ensure
-C<buf> is valid until the command has completed.";
+C<buf> is valid until the command has completed. Other
+parameters behave as documented in C<nbd_pwrite>.";
};
"aio_disconnect", {
default_call with
- args = []; ret = RErr;
+ args = [ UInt32 "flags" ]; ret = RErr;
shortdesc = "disconnect from the NBD server";
longdesc = "\
Issue the disconnect command to the NBD server. This is
not a normal command because NBD servers are not obliged
to send a reply. Instead you should wait for
-C<nbd_aio_is_closed> to become true on the connection.";
+C<nbd_aio_is_closed> to become true on the connection.
+
+The C<flags> parameter must be C<0> for now (it exists for future NBD
+protocol extensions). There is no direct synchronous counterpart;
+however, C<nbd_shutdown> will call this function if appropriate.";
};
"aio_flush", {
default_call with
- args = []; ret = RInt64;
+ args = [ UInt32 "flags" ]; ret = RInt64;
shortdesc = "send flush command to the NBD server";
longdesc = "\
Issue the flush command to the NBD server. This returns the
unique positive 64 bit handle for this command, or C<-1> on
error. To check if the command completed, call
-C<nbd_aio_command_completed>.";
+C<nbd_aio_command_completed>. Parameters behave as documented
+in C<nbd_flush>.";
};
"aio_trim", {
@@ -1516,19 +1538,21 @@ C<nbd_aio_command_completed>.";
Issue a trim command to the NBD server. This returns the
unique positive 64 bit handle for this command, or C<-1> on
error. To check if the command completed, call
-C<nbd_aio_command_completed>.";
+C<nbd_aio_command_completed>. Parameters behave as documented
+in C<nbd_trim>.";
};
"aio_cache", {
default_call with
- args = [ UInt64 "count"; UInt64 "offset" ];
+ args = [ UInt64 "count"; UInt64 "offset"; UInt32
"flags" ];
ret = RInt64;
shortdesc = "send cache (prefetch) to the NBD server";
longdesc = "\
Issue the cache (prefetch) command to the NBD server. This
returns the unique positive 64 bit handle for this command, or
C<-1> on error. To check if the command completed, call
-C<nbd_aio_command_completed>.";
+C<nbd_aio_command_completed>. Parameters behave as documented
+in C<nbd_cache>.";
};
"aio_zero", {
@@ -1540,7 +1564,8 @@ C<nbd_aio_command_completed>.";
Issue a write zeroes command to the NBD server. This returns the
unique positive 64 bit handle for this command, or C<-1> on
error. To check if the command completed, call
-C<nbd_aio_command_completed>.";
+C<nbd_aio_command_completed>. Parameters behave as documented
+in C<nbd_zero>.";
};
"aio_block_status", {
@@ -1557,7 +1582,8 @@ C<nbd_aio_command_completed>.";
Send the block status command to the NBD server. This returns the
unique positive 64 bit handle for this command, or C<-1> on
error. To check if the command completed, call
-C<nbd_aio_command_completed>.";
+C<nbd_aio_command_completed>. Parameters behave as documented
+in C<nbd_block_status>.";
};
"aio_get_fd", {
@@ -2697,7 +2723,7 @@ libnbd-api - libnbd C API
if ((nbd = nbd_create ()) == NULL ||
nbd_connect_tcp (nbd, \"server.example.com\", \"nbd\") == -1 ||
- nbd_pread (nbd, buf, sizeof buf, 0) == -1)
+ nbd_pread (nbd, buf, sizeof buf, 0, 0) == -1)
fprintf (stderr, \"%%s\\n\", nbd_get_error ());
exit (EXIT_FAILURE);
}
@@ -3276,7 +3302,7 @@ Python bindings for libnbd
import nbd
h = nbd.NBD ()
h.connect_tcp (\"localhost\", \"nbd\")
-buf = h.pread (512, 0)
+buf = h.pread (512, 0, 0)
Read the libnbd(3) man page to find out how to use the API.
'''
@@ -3377,7 +3403,7 @@ is an open NBD handle called ‘h’.
h.connect_tcp (\"remote\", \"10809\") # Connect to a remote
server.
h.get_size () # Get size of the remote disk.
-buf = h.pread (512, 0) # Read the first sector.
+buf = h.pread (512, 0, 0) # Read the first sector.
exit() or Ctrl-D # Quit the shell
help (nbd) # Display documentation
'''
diff --git a/interop/interop.c b/interop/interop.c
index aed8581..24f79cc 100644
--- a/interop/interop.c
+++ b/interop/interop.c
@@ -138,7 +138,7 @@ main (int argc, char *argv[])
goto out;
}
- if (nbd_pread (nbd, buf, sizeof buf, 0) == -1) {
+ if (nbd_pread (nbd, buf, sizeof buf, 0, 0) == -1) {
fprintf (stderr, "%s\n", nbd_get_error ());
goto out;
}
diff --git a/lib/disconnect.c b/lib/disconnect.c
index 23e95dd..6695e59 100644
--- a/lib/disconnect.c
+++ b/lib/disconnect.c
@@ -22,6 +22,7 @@
#include <stdlib.h>
#include <stdbool.h>
#include <errno.h>
+#include <inttypes.h>
#include "internal.h"
@@ -31,7 +32,7 @@ nbd_unlocked_shutdown (struct nbd_handle *h)
if (nbd_unlocked_aio_is_ready (h) ||
nbd_unlocked_aio_is_processing (h)) {
- if (nbd_unlocked_aio_disconnect (h) == -1)
+ if (nbd_unlocked_aio_disconnect (h, 0) == -1)
return -1;
}
@@ -45,10 +46,15 @@ nbd_unlocked_shutdown (struct nbd_handle *h)
}
int
-nbd_unlocked_aio_disconnect (struct nbd_handle *h)
+nbd_unlocked_aio_disconnect (struct nbd_handle *h, uint32_t flags)
{
int64_t id;
+ if (flags != 0) {
+ set_error (EINVAL, "invalid flag: %" PRIu32, flags);
+ return -1;
+ }
+
id = nbd_internal_command_common (h, 0, NBD_CMD_DISC, 0, 0, NULL, NULL);
if (id == -1)
return -1;
diff --git a/lib/rw.c b/lib/rw.c
index 0183fc1..bd453d1 100644
--- a/lib/rw.c
+++ b/lib/rw.c
@@ -44,11 +44,11 @@ wait_for_command (struct nbd_handle *h, int64_t handle)
/* Issue a read command and wait for the reply. */
int
nbd_unlocked_pread (struct nbd_handle *h, void *buf,
- size_t count, uint64_t offset)
+ size_t count, uint64_t offset, uint32_t flags)
{
int64_t ch;
- ch = nbd_unlocked_aio_pread (h, buf, count, offset);
+ ch = nbd_unlocked_aio_pread (h, buf, count, offset, flags);
if (ch == -1)
return -1;
@@ -71,11 +71,11 @@ nbd_unlocked_pwrite (struct nbd_handle *h, const void *buf,
/* Issue a flush command and wait for the reply. */
int
-nbd_unlocked_flush (struct nbd_handle *h)
+nbd_unlocked_flush (struct nbd_handle *h, uint32_t flags)
{
int64_t ch;
- ch = nbd_unlocked_aio_flush (h);
+ ch = nbd_unlocked_aio_flush (h, flags);
if (ch == -1)
return -1;
@@ -99,11 +99,11 @@ nbd_unlocked_trim (struct nbd_handle *h,
/* Issue a cache command and wait for the reply. */
int
nbd_unlocked_cache (struct nbd_handle *h,
- uint64_t count, uint64_t offset)
+ uint64_t count, uint64_t offset, uint32_t flags)
{
int64_t ch;
- ch = nbd_unlocked_aio_cache (h, count, offset);
+ ch = nbd_unlocked_aio_cache (h, count, offset, flags);
if (ch == -1)
return -1;
@@ -233,8 +233,13 @@ nbd_internal_command_common (struct nbd_handle *h,
int64_t
nbd_unlocked_aio_pread (struct nbd_handle *h, void *buf,
- size_t count, uint64_t offset)
+ size_t count, uint64_t offset, uint32_t flags)
{
+ if (flags != 0) {
+ set_error (EINVAL, "invalid flag: %" PRIu32, flags);
+ return -1;
+ }
+
return nbd_internal_command_common (h, 0, NBD_CMD_READ, offset, count,
buf, NULL);
}
@@ -265,13 +270,18 @@ nbd_unlocked_aio_pwrite (struct nbd_handle *h, const void *buf,
}
int64_t
-nbd_unlocked_aio_flush (struct nbd_handle *h)
+nbd_unlocked_aio_flush (struct nbd_handle *h, uint32_t flags)
{
if (nbd_unlocked_can_flush (h) != 1) {
set_error (EINVAL, "server does not support flush operations");
return -1;
}
+ if (flags != 0) {
+ set_error (EINVAL, "invalid flag: %" PRIu32, flags);
+ return -1;
+ }
+
return nbd_internal_command_common (h, 0, NBD_CMD_FLUSH, 0, 0,
NULL, NULL);
}
@@ -308,7 +318,7 @@ nbd_unlocked_aio_trim (struct nbd_handle *h,
int64_t
nbd_unlocked_aio_cache (struct nbd_handle *h,
- uint64_t count, uint64_t offset)
+ uint64_t count, uint64_t offset, uint32_t flags)
{
/* Actually according to the NBD protocol document, servers do exist
* that support NBD_CMD_CACHE but don't advertise the
@@ -319,6 +329,11 @@ nbd_unlocked_aio_cache (struct nbd_handle *h,
return -1;
}
+ if (flags != 0) {
+ set_error (EINVAL, "invalid flag: %" PRIu32, flags);
+ return -1;
+ }
+
return nbd_internal_command_common (h, 0, NBD_CMD_CACHE, offset, count,
NULL, NULL);
}
diff --git a/python/t/400-pread.py b/python/t/400-pread.py
index 4d64166..da4799b 100644
--- a/python/t/400-pread.py
+++ b/python/t/400-pread.py
@@ -20,7 +20,7 @@ import nbd
h = nbd.NBD ()
h.connect_command (["nbdkit", "-s", "--exit-with-parent",
"-v",
"pattern", "size=512"])
-buf = h.pread (512, 0)
+buf = h.pread (512, 0, 0)
print ("%r" % buf)
diff --git a/python/t/410-pwrite.py b/python/t/410-pwrite.py
index 811f233..9152ba2 100644
--- a/python/t/410-pwrite.py
+++ b/python/t/410-pwrite.py
@@ -33,7 +33,7 @@ h = nbd.NBD ()
h.connect_command (["nbdkit", "-s", "--exit-with-parent",
"-v",
"file", datafile])
h.pwrite (buf1, 0, nbd.CMD_FLAG_FUA)
-buf2 = h.pread (512, 0)
+buf2 = h.pread (512, 0, 0)
assert buf1 == buf2
diff --git a/python/t/500-aio-pread.py b/python/t/500-aio-pread.py
index 85342f5..82199ef 100644
--- a/python/t/500-aio-pread.py
+++ b/python/t/500-aio-pread.py
@@ -21,7 +21,7 @@ h = nbd.NBD ()
h.connect_command (["nbdkit", "-s", "--exit-with-parent",
"-v",
"pattern", "size=512"])
buf = nbd.aio_buffer (512)
-id = h.aio_pread (buf, 0)
+id = h.aio_pread (buf, 0, 0)
while not (h.aio_command_completed (id)):
h.poll (-1)
diff --git a/python/t/510-aio-pwrite.py b/python/t/510-aio-pwrite.py
index 4770b83..b73464b 100644
--- a/python/t/510-aio-pwrite.py
+++ b/python/t/510-aio-pwrite.py
@@ -39,7 +39,7 @@ while not (h.aio_command_completed (id)):
h.poll (-1)
buf2 = nbd.aio_buffer (512)
-id = h.aio_pread (buf2, 0)
+id = h.aio_pread (buf2, 0, 0)
while not (h.aio_command_completed (id)):
h.poll (-1)
diff --git a/tests/aio-parallel-load.c b/tests/aio-parallel-load.c
index d1422f3..20fa358 100644
--- a/tests/aio-parallel-load.c
+++ b/tests/aio-parallel-load.c
@@ -257,7 +257,7 @@ start_thread (void *arg)
status->bytes_sent += sizeof buf;
}
else {
- handle = nbd_aio_pread (nbd, buf, sizeof buf, offset);
+ handle = nbd_aio_pread (nbd, buf, sizeof buf, offset, 0);
status->bytes_received += sizeof buf;
}
if (handle == -1) {
diff --git a/tests/aio-parallel.c b/tests/aio-parallel.c
index 70687f1..7c62ba3 100644
--- a/tests/aio-parallel.c
+++ b/tests/aio-parallel.c
@@ -296,7 +296,7 @@ start_thread (void *arg)
memcpy (&ramdisk[offset], buf, BUFFERSIZE);
}
else {
- handle = nbd_aio_pread (nbd, buf, BUFFERSIZE, offset);
+ handle = nbd_aio_pread (nbd, buf, BUFFERSIZE, offset, 0);
status->bytes_received += BUFFERSIZE;
}
if (handle == -1) {
diff --git a/tests/connect-tls.c b/tests/connect-tls.c
index 0b13231..b49a29f 100644
--- a/tests/connect-tls.c
+++ b/tests/connect-tls.c
@@ -83,7 +83,7 @@ main (int argc, char *argv[])
exit (EXIT_FAILURE);
}
- if (nbd_pread (nbd, buf, sizeof buf, 0) == -1) {
+ if (nbd_pread (nbd, buf, sizeof buf, 0, 0) == -1) {
fprintf (stderr, "%s\n", nbd_get_error ());
exit (EXIT_FAILURE);
}
diff --git a/tests/errors.c b/tests/errors.c
index 25b82bb..99d5820 100644
--- a/tests/errors.c
+++ b/tests/errors.c
@@ -41,7 +41,7 @@ main (int argc, char *argv[])
}
/* Issue a connected command when not connected. */
- if (nbd_pread (nbd, NULL, 0, 0) != -1) {
+ if (nbd_pread (nbd, NULL, 0, 0, 0) != -1) {
fprintf (stderr, "%s: test failed: "
"nbd_pread did not fail on non-connected handle\n",
argv[0]);
diff --git a/tests/oldstyle.c b/tests/oldstyle.c
index 821ab98..a0b594c 100644
--- a/tests/oldstyle.c
+++ b/tests/oldstyle.c
@@ -66,7 +66,7 @@ main (int argc, char *argv[])
exit (EXIT_FAILURE);
}
- if (nbd_pread (nbd, rbuf, sizeof rbuf, 0) == -1) {
+ if (nbd_pread (nbd, rbuf, sizeof rbuf, 0, 0) == -1) {
fprintf (stderr, "%s\n", nbd_get_error ());
exit (EXIT_FAILURE);
}
diff --git a/tests/synch-parallel.c b/tests/synch-parallel.c
index 181e369..387a96f 100644
--- a/tests/synch-parallel.c
+++ b/tests/synch-parallel.c
@@ -224,7 +224,7 @@ start_thread (void *arg)
memcpy (&ramdisk[offset], buf, sizeof buf);
}
else {
- if (nbd_pread (nbd, buf, sizeof buf, offset) == -1) {
+ if (nbd_pread (nbd, buf, sizeof buf, offset, 0) == -1) {
fprintf (stderr, "%s\n", nbd_get_error ());
goto error;
}
--
2.20.1