search for: nbd_get_siz

Displaying 20 results from an estimated 62 matches for "nbd_get_siz".

Did you mean: nbd_get_size
2019 Aug 14
3
[libnbd PATCH 0/2] Drop generated file from git
Rich recently patched things to generate one man page per function rather than libnbd-api.3 (nice), but in doing so got stumped by a problem with a fresh git clone (automake fails for any 'include' directive that does not already exist). I've figured out how to hack around it, but the hack requires GNU make. We already use GNU make constructs elsewhere (such as $(wildcard)), but
2019 Aug 06
0
[PATCH libnbd 1/3] api: Change nbd_read_only -> nbd_is_read_only.
...VAL, "server does not support write operations"); return -1; } diff --git a/tests/aio-parallel-load.c b/tests/aio-parallel-load.c index ce39140..f4ba635 100644 --- a/tests/aio-parallel-load.c +++ b/tests/aio-parallel-load.c @@ -231,7 +231,7 @@ start_thread (void *arg) assert (nbd_get_size (nbd) == EXPORTSIZE); assert (nbd_can_multi_conn (nbd) > 0); - assert (nbd_read_only (nbd) == 0); + assert (nbd_is_read_only (nbd) == 0); /* Issue commands. */ assert (nbd_aio_in_flight (nbd) == 0); diff --git a/tests/aio-parallel.c b/tests/aio-parallel.c index 166b560..f8d4891 100...
2020 Oct 17
1
[libnbd PATCH] info: Keep request within 4G bound
...requested map? */ if (!nbd_can_meta_context (nbd, map)) { @@ -276,6 +278,8 @@ main (int argc, char *argv[]) progname, map); exit (EXIT_FAILURE); } + align = nbd_get_block_size (nbd, LIBNBD_SIZE_MINIMUM) ?: 512; + max_len = UINT32_MAX - align + 1; size = nbd_get_size (nbd); if (size == -1) { @@ -286,7 +290,7 @@ main (int argc, char *argv[]) if (json_output) fprintf (fp, "[\n"); for (offset = 0; offset < size;) { prev_offset = offset; - if (nbd_block_status (nbd, size - offset, offset, + if (nbd_block_status (nbd, MI...
2019 Sep 17
0
[PATCH libnbd 2/2] api: New API for reading NBD protocol.
...bdkit only supported newstyle-fixed. */ + s = nbd_get_protocol (nbd); + if (strcmp (s, "newstyle-fixed") != 0) { + fprintf (stderr, + "incorrect protocol \"%s\", expected \"newstyle-fixed\"\n", s); + exit (EXIT_FAILURE); + } + if ((r = nbd_get_size (nbd)) == -1) { fprintf (stderr, "%s\n", nbd_get_error ()); exit (EXIT_FAILURE); diff --git a/tests/oldstyle.c b/tests/oldstyle.c index c179c45..b90b775 100644 --- a/tests/oldstyle.c +++ b/tests/oldstyle.c @@ -84,6 +84,7 @@ main (int argc, char *argv[]) char *args[] = { &quo...
2020 Aug 19
3
[libnbd PATCH 0/2] NBD_OPT_INFO support
This replaces 13/13 of my v2 series; and now that it has pretty good testsuite coverage and demonstrable performance improvement to nbdinfo, I'm going ahead and pushing this now. We may still want to add further nbd_opt_* commands for other fine-grained tuning of negotiation, but for now, I think things have stabilized on this end, and I can return to polishing .list_exports on the nbdkit
2019 Aug 06
5
[PATCH libnbd 0/3] One API and small documentation changes.
One API change, some small documentation changes.
2023 Aug 04
2
[libnbd PATCH v4 01/25] block_status: Add some sanity checking of server lengths
...rthogonal support for a server's 32- or 64-bit reply, vs. a > client's 32- or 64-bit API call. Once 64-bit replies are in play, we > will additionally have to worry about a 64-bit reply that overflows a > 32-bit API callback without exceeding the exportsize. Similarly, > since nbd_get_size() already caps export size at 63 bits (based on > off_t limitations), we have guaranteed that a 64-bit API callback will > never see an extent length that could appear negative in a 64-bit > signed type (at least OCaml benefits from that guarantee, since its > only native 64-bit intege...
2020 Jul 24
0
[libnbd PATCH 3/3] nbdinfo: Expose block size constraints
...t_one_export (struct nbd_handle *nbd) int is_rotational, is_read_only; int can_cache, can_df, can_fast_zero, can_flush, can_fua, can_multi_conn, can_trim, can_zero; + int64_t block_minimum, block_preferred, block_maximum; /* Collect the metadata we are going to display. */ size = nbd_get_size (nbd); @@ -288,6 +289,9 @@ list_one_export (struct nbd_handle *nbd) can_multi_conn = nbd_can_multi_conn (nbd); can_trim = nbd_can_trim (nbd); can_zero = nbd_can_zero (nbd); + block_minimum = nbd_get_block_size (nbd, LIBNBD_SIZE_MINIMUM); + block_preferred = nbd_get_block_size (nbd, LIBN...
2019 Sep 17
0
[PATCH libnbd 4/5] interop: Add -DTLS_MODE to the test.
...*argv[]) #endif +#if TLS + if (TLS_MODE == LIBNBD_TLS_REQUIRE && + nbd_get_tls_negotiated (nbd) != 1) { + fprintf (stderr, + "%s: TLS required, but not negotiated on the connection\n", + argv[0]); + goto out; + } +#endif + actual_size = nbd_get_size (nbd); if (actual_size == -1) { fprintf (stderr, "%s\n", nbd_get_error ()); @@ -160,7 +174,7 @@ main (int argc, char *argv[]) /* XXX In future test more operations here. */ -#if !CERTS && !PSK +#if !TLS /* XXX qemu doesn't shut down the connection nicely (us...
2019 Sep 17
1
[libnbd PATCH] api: Add nbd_get_structured_replies_negotiated
...ected \"oldstyle\"\n", s); exit (EXIT_FAILURE); } + if ((r = nbd_get_structured_replies_negotiated (nbd)) != 0) { + fprintf (stderr, + "incorrect structured replies %" PRId64 ", expected 0\n", r); + exit (EXIT_FAILURE); + } if ((r = nbd_get_size (nbd)) == -1) { fprintf (stderr, "%s\n", nbd_get_error ()); -- 2.21.0
2019 Aug 14
0
[libnbd PATCH 2/2] docs: Drop docs/Makefile.inc from git
...d_add_meta_context \ - nbd_connect_uri \ - nbd_connect_unix \ - nbd_connect_tcp \ - nbd_connect_command \ - nbd_is_read_only \ - nbd_can_flush \ - nbd_can_fua \ - nbd_is_rotational \ - nbd_can_trim \ - nbd_can_zero \ - nbd_can_df \ - nbd_can_multi_conn \ - nbd_can_cache \ - nbd_can_meta_context \ - nbd_get_size \ - nbd_pread \ - nbd_pread_structured \ - nbd_pwrite \ - nbd_shutdown \ - nbd_flush \ - nbd_trim \ - nbd_cache \ - nbd_zero \ - nbd_block_status \ - nbd_poll \ - nbd_aio_connect \ - nbd_aio_connect_uri \ - nbd_aio_connect_unix \ - nbd_aio_connect_tcp \ - nbd_aio_connect_command \ - nbd_aio_pread...
2019 Sep 17
3
[PATCH libnbd 1/2] api: Add new API to read whether TLS was negotiated.
When LIBNBD_TLS_ALLOW is used we don't have a way to find out if TLS was really negotiated. This adds a flag and a way to read it back. Unfortunately there is no test yet, because LIBNBD_TLS_ALLOW is not tested -- it really should be but requires quite a complicated set of tests because ideally we'd like to find out whether it falls back correctly for all supported servers. --- TODO
2023 May 07
2
[PATCH libnbd] tests: Add a test of nbd_{set, get}_socket_activation_name
...nbdkit.environ=1 null 1024\n", + NULL + }; + if (nbd_connect_systemd_socket_activation (nbd, cmd) == -1) { + fprintf (stderr, "%s\n", nbd_get_error ()); + exit (EXIT_FAILURE); + } + + /* Check the size is expected so we know we managed to connect to nbdkit. */ + assert (nbd_get_size (nbd) == 1024); + + nbd_close (nbd); + + /* nbdkit doesn't know anything about socket activation names, but + * the LISTEN_FDNAMES environment variable should appear in the + * debug output. + */ + assert (system ("grep 'debug.*LISTEN_FDNAMES=hello' " DEBUG_FILE) ==...
2019 Aug 15
1
[PATCH libnbd] docs: Change docs/Makefile.inc back to a regular include, readd to git.
...d_add_meta_context \ + nbd_connect_uri \ + nbd_connect_unix \ + nbd_connect_tcp \ + nbd_connect_command \ + nbd_is_read_only \ + nbd_can_flush \ + nbd_can_fua \ + nbd_is_rotational \ + nbd_can_trim \ + nbd_can_zero \ + nbd_can_df \ + nbd_can_multi_conn \ + nbd_can_cache \ + nbd_can_meta_context \ + nbd_get_size \ + nbd_pread \ + nbd_pread_structured \ + nbd_pwrite \ + nbd_shutdown \ + nbd_flush \ + nbd_trim \ + nbd_cache \ + nbd_zero \ + nbd_block_status \ + nbd_poll \ + nbd_aio_connect \ + nbd_aio_connect_uri \ + nbd_aio_connect_unix \ + nbd_aio_connect_tcp \ + nbd_aio_connect_command \ + nbd_aio_pread...
2019 May 21
0
[libnbd] tmp patch adding deadlock test
...rgv[1], argv[2]) == -1) { + fprintf (stderr, "%s\n", nbd_get_error ()); + exit (EXIT_FAILURE); + } + } + + if (nbd_read_only (nbd) == 1) { + fprintf (stderr, "%s: error: this NBD export is read-only\n", argv[0]); + exit (EXIT_FAILURE); + } + + exportsize = nbd_get_size (nbd); + if (exportsize == -1) { + fprintf (stderr, "%s\n", nbd_get_error ()); + exit (EXIT_FAILURE); + } + packetsize = exportsize / 2; + if (packetsize > 2 * 1024 * 1024) + packetsize = 2 * 1024 * 1024; + + in = malloc (packetsize); + out = malloc (packetsize); + if...
2019 May 22
0
[libnbd PATCH v3 7/7] examples: Add example to demonstrate just-fixed deadlock scenario
...rgv[1], argv[2]) == -1) { + fprintf (stderr, "%s\n", nbd_get_error ()); + exit (EXIT_FAILURE); + } + } + + if (nbd_read_only (nbd) == 1) { + fprintf (stderr, "%s: error: this NBD export is read-only\n", argv[0]); + exit (EXIT_FAILURE); + } + + exportsize = nbd_get_size (nbd); + if (exportsize == -1) { + fprintf (stderr, "%s\n", nbd_get_error ()); + exit (EXIT_FAILURE); + } + packetsize = exportsize / 2; + if (packetsize > 2 * 1024 * 1024) + packetsize = 2 * 1024 * 1024; + + in = malloc (packetsize); + out = malloc (packetsize); + if...
2019 May 25
0
[nbdkit PATCH 2/2] nbd: Add shared=true parameter
...utdown (h->fd, SHUT_WR); @@ -1109,6 +1135,16 @@ nbd_close (void *handle) free (h); } +/* Free up the per-connection handle. */ +static void +nbd_close (void *handle) +{ + struct handle *h = handle; + + if (!shared) + nbd_close_handle (h); +} + /* Get the file size. */ static int64_t nbd_get_size (void *handle) -- 2.20.1
2020 Nov 05
1
[PATCH libnbd] copy: Allowing copying from NBD server to NBD server.
This patch is a straightforward refactoring of libnbd?s nbdcopy program, and not very interesting. However I have plans for nbdcopy (see full todo below). I would like to use this utility for virt-v2v as a replacement for ?qemu-img convert?. qemu-img has caused us a series of problems: - change in zeroing behaviour caused a big performance regression - qemu-img reads extents up-front which
2017 Nov 14
0
[nbdkit PATCH v2 1/2] nbd: Add new nbd forwarding plugin
...(h->fd); + return NULL; +} + +/* Free up the per-connection handle. */ +static void +nbd_close (void *handle) +{ + struct handle *h = handle; + + if (!h->dead) + nbd_request_raw (h, NBD_CMD_DISC, 0, 0, 0); + close (h->fd); + free (h); +} + +/* Get the file size. */ +static int64_t +nbd_get_size (void *handle) +{ + struct handle *h = handle; + + return h->size; +} + +static int +nbd_can_write (void *handle) +{ + struct handle *h = handle; + + return !(h->flags & NBD_FLAG_READ_ONLY); +} + +static int +nbd_can_flush (void *handle) +{ + struct handle *h = handle; + + return h...
2020 Sep 26
1
[PATCH nbdinfo proposal] info: Add a --map option for displaying allocation metadata
This is a rough-and-ready implementation of nbdinfo --map option, to display the allocation and other metadata of NBD exports. I only tested it lightly against nbdkit. It needs at least some tests. Command like these should work: nbdinfo --map nbd://localhost nbdinfo --map=qemu:dirty-bitmap nbd://localhost Rich.