search for: nbdkit_error

Displaying 20 results from an estimated 690 matches for "nbdkit_error".

2019 Jun 12
0
[nbdkit PATCH v3 3/5] nbd: Use libnbd 0.1.3+
...for each key=value passed on the command line. This plugin @@ -170,8 +158,6 @@ nbdplug_config (const char *key, const char *value) static int nbdplug_config_complete (void) { - int r; - if (sockname) { struct sockaddr_un sock; @@ -183,7 +169,6 @@ nbdplug_config_complete (void) nbdkit_error ("socket file name too large"); return -1; } - servname = strdup (sockname); } else { if (!hostname) { @@ -192,14 +177,6 @@ nbdplug_config_complete (void) } if (!port) port = "10809"; - if (strchr (hostname, ':')) - r =...
2019 May 30
0
[nbdkit PATCH 3/4] nbd: Use libnbd 0.1
...6_t flags, uint16_t type, - uint64_t offset, uint32_t count, const void *req_buf, - void *rep_buf, struct nbdkit_extents *extents) -{ - int err; - struct transaction *trans; - uint64_t cookie; - - trans = calloc (1, sizeof *trans); - if (!trans) { - nbdkit_error ("unable to track transaction: %m"); - /* Still in sync with server, so don't mark connection dead */ - return NULL; - } - if (sem_init (&trans->sem, 0, 0)) { - nbdkit_error ("unable to create semaphore: %m"); - /* Still in sync with server, so don't...
2019 Apr 23
0
[nbdkit PATCH 6/7] nbd: Implement NBD_OPT_GO client request
...ewstyle_recv_option_reply (struct handle *h, uint32_t option, + struct fixed_new_option_reply *reply, + char **payload) +{ + char *buffer; + + if (payload) + *payload = NULL; + if (read_full (h->fd, reply, sizeof *reply)) { + nbdkit_error ("unable to read option reply: %m"); + return -1; + } + reply->magic = be64toh (reply->magic); + reply->option = be32toh (reply->option); + reply->reply = be32toh (reply->reply); + reply->replylen = be32toh (reply->replylen); + if (reply->magic != NBD_R...
2019 May 30
5
[nbdkit PATCH 0/4] Play with libnbd for nbdkit-add
Patch 1 played with an early draft of Rich's Fedora 30 libnbd package: https://bugzilla.redhat.com/show_bug.cgi?id=1713767#c17 Note that comment 21 provides a newer package 0.1.1-1 with a different API; and that libnbd has more unreleased API changes in the pipeline (whether that will be called 0.2 or 0.1.2); so we'll have to tweak things based on what is actually available in distros.
2019 Jun 02
5
[nbdkit PATCH v2 0/5] Play with libnbd for nbdkit-nbd
libnbd-0.1.2-1 is now available in Fedora 29/30 updates-testing, although it was not compiled against libxml2 so it lacks uri support (I ended up testing patch 4 with a self-built libnbd). Diffs since v1 - rebase to master, bump from libnbd 0.1 to 0.1.2, add URI support, better timing results Still not done - patch 5 needs associated tests Eric Blake (5): nbd: Check for libnbd nbd:
2020 Mar 19
1
[nbdkit PATCH] nbd: Drop nbd-standalone fallback
...rcmp (key, "retry") == 0) { - if (nbdkit_parse_unsigned ("retry", value, &retry) == -1) - return -1; - } - else if (strcmp (key, "shared") == 0) { - r = nbdkit_parse_bool (value); - if (r == -1) - return -1; - shared = r; - } - else { - nbdkit_error ("unknown parameter '%s'", key); - return -1; - } - - return 0; -} - -/* Check the user passed exactly one socket description. */ -static int -nbd_config_complete (void) -{ - int r; - - if (sockname) { - struct sockaddr_un sock; - - if (hostname || port) { - nbdk...
2017 Nov 15
1
[nbdkit PATCH] connections: Improve error responses
..., uint32_t cmd, uint32_t flags, uint64_t offset, uint32_t count, uint32_t *error) { int r; + /* Readonly connection? */ + if (conn->readonly && + (cmd == NBD_CMD_WRITE || + cmd == NBD_CMD_TRIM || cmd == NBD_CMD_WRITE_ZEROES)) { + nbdkit_error ("invalid request: write request on readonly connection"); + *error = EROFS; + return false; + } + /* Validate cmd, offset, count. */ switch (cmd) { case NBD_CMD_READ: case NBD_CMD_WRITE: case NBD_CMD_TRIM: case NBD_CMD_WRITE_ZEROES: - r = valid_range (conn, of...
2020 Mar 26
0
[PATCH nbdkit 5/9 patch split 2/5] lib: Move code for parsing, passwords and paths into libnbdkit.so.
...'t want plugins to be able to call arbitrary -# functions from nbdkit, so this script lists only the symbols we want -# to export. +# nbdkit binary. { - # The functions we want plugins and filters to call. global: - nbdkit_absolute_path; - nbdkit_add_extent; nbdkit_debug; nbdkit_error; nbdkit_export_name; - nbdkit_extents_count; - nbdkit_extents_free; - nbdkit_extents_new; - nbdkit_get_extent; nbdkit_nanosleep; - nbdkit_parse_bool; - nbdkit_parse_int8_t; - nbdkit_parse_int16_t; - nbdkit_parse_int32_t; - nbdkit_parse_int64_t; - nbdkit_parse...
2019 Jun 12
8
[nbdkit PATCH v3 0/5] Play with libnbd for nbdkit-nbd
libnbd-0.1.4-1 is now available in Fedora 29/30 updates testing. Diffs since v2 - rebase to master, bump from libnbd 0.1.2 to 0.1.3+, add tests to TLS usage which flushed out the need to turn relative pathnames into absolute, doc tweaks Now that the testsuite covers TLS and libnbd has been fixed to provide the things I found lacking when developing v2, I'm leaning towards pushing this on
2019 Aug 30
0
[nbdkit PATCH 9/9] server: Move command validation from protocol.c to backend.c
...d) (void)) free (b->name); } +static bool +writes_blocked (struct backend *b, struct connection *conn, const char *cmd, + uint32_t flags) +{ + struct b_conn_handle *h = &conn->handles[b->i]; + + assert (h->can_write >= 0); + if (h->can_write == 0) { + nbdkit_error ("invalid request: %s: write request on readonly connection", + cmd); + return true; + } + if (flags & NBDKIT_FLAG_FUA) { + assert (h->can_fua >= 0); + if (h->can_fua == 0) { + nbdkit_error ("invalid request: %s: FUA flag not supported&qu...
2019 Apr 25
6
[nbdkit PATCH v2 0/5] structured replies/.extents for nbd plugin
Updated based on other changes that have happened in the meantime: - rely more on cleanup.h (throughout) - split structured read for easier review (patch 2 and 3 were combined in v1) - rely on nbdkit not leaking a server's partial answer (patch 3) - add tests (patch 5) - other bug fixes I found while testing it - drop EOVERFLOW patch for now; it will be separate once upstream NBD protocol
2018 Dec 06
10
[PATCH nbdkit 0/5] protocol: Generate map functions from NBD protocol flags to printable strings.
With some crufty sed scripts we can generate functions that map from NBD protocol flags (eg. NBD_CMD_READ) to strings ("NBD_CMD_READ"). This works on GNU sed and with FreeBSD, also with GNU sed's --posix option, so I guess the sed code is POSIX-compatible. Rich.
2019 Mar 18
0
[PATCH nbdkit 2/2] server: Split out NBD protocol code from connections code.
...ate_handshake_oldstyle (struct connection *conn) -{ - struct old_handshake handshake; - int64_t r; - uint64_t exportsize; - uint16_t gflags, eflags; - - /* In --tls=require / FORCEDTLS mode, old style handshakes are - * rejected because they cannot support TLS. - */ - if (tls == 2) { - nbdkit_error ("non-TLS client tried to connect in --tls=require mode"); - return -1; - } - - r = backend->get_size (backend, conn); - if (r == -1) - return -1; - if (r < 0) { - nbdkit_error (".get_size function returned invalid value " - "(%" PRI...
2019 Jun 18
0
[nbdkit PATCH] Experiment: nbd: Use ppoll() instead of pipe-to-self
...figuration. */ static int nbdplug_config_complete (void) { + struct sigaction act = { + .sa_handler = nbdplug_sigusr1, + .sa_flags = SA_RESTART, + }; + + /* Register a no-op SIGUSR1 handler for use with ppoll */ + if ((errno = pthread_sigmask (SIG_SETMASK, NULL, &origmask))) { + nbdkit_error ("pthread_sigmask: %m"); + return -1; + } + if (sigismember (&origmask, SIGUSR1)) { + nbdkit_error ("SIGUSR1 should not be blocked"); + return -1; + } + if (sigaction (SIGUSR1, &act, NULL) == -1) { + nbdkit_error ("sigaction: %m"); + return -...
2020 Feb 12
4
[nbdkit PATCH 0/3] Make ext2 a filter
...unload (void) { - free (disk); free (file); } static int -ext2_config (const char *key, const char *value) +ext2_config (nbdkit_next_config *next, void *nxdata, + const char *key, const char *value) { - if (strcmp (key, "disk") == 0) { - if (disk != NULL) { - nbdkit_error ("disk parameter specified more than once"); - return -1; - } - disk = nbdkit_absolute_path (value); - if (disk == NULL) - return -1; - } - else if (strcmp (key, "file") == 0) { + if (strcmp (key, "ext2file") == 0) { if (file != NULL) { -...
2019 Apr 23
0
[nbdkit PATCH 7/7] nbd: Implement structured replies
...ved simple reply for cookie %#" PRIx64 ", status %s", + rep.simple.handle, + name_of_nbd_error(be32toh (rep.simple.error))); + error = be32toh (rep.simple.error); + break; + case NBD_STRUCTURED_REPLY_MAGIC: + if (!h->structured) { + nbdkit_error ("structured response without negotiation"); + return nbd_mark_dead (h); + } + if (read_full (h->fd, sizeof rep.simple + (char *) &rep, + sizeof rep - sizeof rep.simple)) + return nbd_mark_dead (h); + rep.structured.flags = be16toh (rep.structur...
2019 Apr 23
12
[nbdkit PATCH 0/7] Implement structured replies in nbd plugin
I'm hoping to implement .extents for the nbd plugin; this is a prerequisite. I'm not sure about patch 3 - if we like it, I'll squash it to 2, if we don't, I think we are okay just dropping it. I'm also wondering if we have to worry about malicious plugins that don't populate the entire .pread buffer in an effort to get nbdkit to expose portions of the heap; my patch 7 loses
2019 Mar 18
3
[PATCH nbdkit 0/2] server: Split out NBD protocol code from connections code.
These are a couple of patches in preparation for the Block Status implementation. While the patches (especially the second one) are very large they are really just elementary code motion. Rich.
2019 Jun 07
4
[nbdkit PATCH v2 0/2] Reduce network overhead with MSG_MORE/corking
This time around, the numbers are indeed looking better than in v1; and I like the interface better. Eric Blake (2): server: Prefer send() over write() server: Group related transmission send()s server/internal.h | 7 +++- server/connections.c | 51 +++++++++++++++++++++++++--- server/crypto.c | 11 ++++--
2020 Feb 12
0
[nbdkit PATCH 3/3] ext2: Add mode for letting client exportname choose file from image
...le; static void @@ -94,7 +94,11 @@ ext2_config_complete (nbdkit_next_config_complete *next, void *nxdata) return -1; } - if (file[0] != '/') { + if (strcmp (file, "exportname") == 0) { + free (file); + file = NULL; + } + else if (file[0] != '/') { nbdkit_error ("the file parameter must refer to an absolute path"); return -1; } @@ -103,7 +107,8 @@ ext2_config_complete (nbdkit_next_config_complete *next, void *nxdata) } #define ext2_config_help \ - "ext2file=<FILENAME> (required) File to serve inside the disk image."...