search for: priu32

Displaying 20 results from an estimated 184 matches for "priu32".

2020 Sep 04
0
[libnbd PATCH 1/2] api: Add nbd_set_strict_mode
...Inc. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -29,9 +29,11 @@ int nbd_unlocked_shutdown (struct nbd_handle *h, uint32_t flags) { - if (flags != 0) { - set_error (EINVAL, "invalid flag: %" PRIu32, flags); - return -1; + if (h->strict & LIBNBD_STRICT_COMMANDS) { + if (flags != 0) { + set_error (EINVAL, "invalid flag: %" PRIu32, flags); + return -1; + } } if (!h->disconnect_request && @@ -55,9 +57,11 @@ nbd_unlocked_aio_disconnect (struct...
2020 Sep 04
4
[RFC libnbd PATCH 0/2] Add knobs for client- vs. server-side validation
We have been inconsistent on how much we reject client-side without even consulting the server, vs. how much we depend on the server to detect failure (even if our request can be deemed undefined per NBD protocol). I'd like to change it so that by default, we reject as much as we can client-side for less traffic, but where the user can also change things on the fly for server-side integration
2019 Aug 30
0
[nbdkit PATCH 9/9] server: Move command validation from protocol.c to backend.c
...dles[b->i]; + + assert (h->exportsize >= 0); + if (!count || offset > h->exportsize || offset + count > h->exportsize) { + nbdkit_error ("invalid request: %s: offset and count are out of range: " + "offset=%" PRIu64 " count=%" PRIu32, cmd, offset, count); + return true; + } + return false; +} + void backend_set_handle (struct backend *b, struct connection *conn, void *handle) { @@ -283,6 +320,10 @@ backend_pread (struct backend *b, struct connection *conn, debug ("%s: pread count=%" PRIu32 " offset=%&q...
2018 Aug 01
0
[PATCH v2 nbdkit 3/6] filters: Print filter name in debugging messages.
...quot;); + debug ("%s: can_fua", f->name); if (f->filter.can_fua) return f->filter.can_fua (&next_ops, &nxdata, handle); @@ -515,8 +515,8 @@ filter_pread (struct backend *b, struct connection *conn, assert (flags == 0); - debug ("pread count=%" PRIu32 " offset=%" PRIu64 " flags=0x%" PRIx32, - count, offset, flags); + debug ("%s: pread count=%" PRIu32 " offset=%" PRIu64 " flags=0x%" PRIx32, + f->name, count, offset, flags); if (f->filter.pread) return f->filter....
2011 Dec 13
1
[hivex] [PATCH 1/2] hivex: Expose hive major and minor version
...hivex_open (const char *filename, int flags) } /* Check major version. */ - uint32_t major_ver = le32toh (h->hdr->major_ver); + int32_t major_ver = hivex_major_version (h); if (major_ver != 1) { fprintf (stderr, "hivex: %s: hive file major version %" PRIu32 " (expected 1)\n", @@ -312,6 +312,16 @@ hivex_open (const char *filename, int flags) goto error; } + /* Check minor version; if unable to decode, terminate. */ + int32_t minor_ver = hivex_minor_version (h); + if (minor_ver < 0) { + fprintf (stderr, + "h...
2020 Sep 11
0
[libnbd PATCH v2 2/5] generator: Refactor filtering of accepted OFlags
...nnect.c b/lib/disconnect.c index b8356b7..9de1e34 100644 --- a/lib/disconnect.c +++ b/lib/disconnect.c @@ -30,11 +30,6 @@ int nbd_unlocked_shutdown (struct nbd_handle *h, uint32_t flags) { - if ((flags & ~LIBNBD_SHUTDOWN_IMMEDIATE) != 0) { - set_error (EINVAL, "invalid flag: %" PRIu32, flags); - return -1; - } - /* If IMMEDIATE, abort any commands that have not yet had any bytes * sent to the server, so that NBD_CMD_DISC will be first in line. */ @@ -69,11 +64,6 @@ nbd_unlocked_aio_disconnect (struct nbd_handle *h, uint32_t flags) { int64_t id; - if (flags !...
2018 Jan 19
2
[nbdkit PATCH] Update filters to support FUA flags.
...nn, count, offset, f); + return b_conn->b->zero (b_conn->b, b_conn->conn, count, offset, flags); } static struct nbdkit_next_ops next_ops = { @@ -448,11 +445,12 @@ filter_pread (struct backend *b, struct connection *conn, assert (flags == 0); - debug ("pread count=%" PRIu32 " offset=%" PRIu64, count, offset); + debug ("pread count=%" PRIu32 " offset=%" PRIu64 " flags=0x%" PRIx32, + count, offset, flags); if (f->filter.pread) return f->filter.pread (&next_ops, &nxdata, handle, -...
2020 Oct 06
2
[PATCH libnbd] info: Write output atomically.
...d on the first part of the export and save @@ -768,27 +802,27 @@ extent_callback (void *user_data, const char *metacontext, const char *descr = extent_description (map, entries[i+1]); if (!json_output) { - printf ("%10" PRIu64 " " - "%10" PRIu32 " " - "%3" PRIu32, - offset, entries[i], entries[i+1]); + fprintf (fp, "%10" PRIu64 " " + "%10" PRIu32 " " + "%3" PRIu32, + offset, entries[i], entries[i...
2019 Dec 12
9
[PATCH nbdkit 0/7] server: Allow datapath debug messages to be suppressed.
The immediate reason for this patch is to reduce the amount of debugging in virt-v2v with using the virt-v2v -v option (because this implies running nbdkit in verbose mode too). Most of the messages are datapath ones about pread/pwrite requests, and in fact as we've added more filters on top of nbdkit these messages have got more and more verbose. However they are not particularly
2019 Jun 27
1
[libnbd PATCH] block-status: Make callback usage consistent with pread_structured
..., + &h->bs_entries[1], (length-4) / 4, &error) == -1) + if (cmd->error == 0) + cmd->error = error ? error : EPROTO; + } + else /* Emit a debug message, but ignore it. */ - debug (h, "ignoring meta context ID %" PRIu32 " after callback failure", - be32toh (h->bs_entries[0])); - else { - /* Need to byte-swap the entries returned, but apart from that we - * don't validate them. - */ - for (i = 0; i < length/4; ++i) - h->bs_entries[i] = be32toh (h-&g...
2019 Nov 02
2
[PATCH nbdkit] server: Use GCC hints to move debug and error handling code out of hot paths.
...protocol.c b/server/protocol.c index 89fbdfa..f6ea35c 100644 --- a/server/protocol.c +++ b/server/protocol.c @@ -508,8 +508,8 @@ extents_to_block_descriptors (struct nbdkit_extents *extents, #if 0 for (i = 0; i < *nr_blocks; ++i) - nbdkit_debug ("block status: sending block %" PRIu32 " type %" PRIu32, - blocks[i].length, blocks[i].status_flags); + debug ("block status: sending block %" PRIu32 " type %" PRIu32, + blocks[i].length, blocks[i].status_flags); #endif /* Convert to big endian for the protocol. */ diff -...
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.
2018 Jan 17
0
[PATCH 5/9] connections: Allow multiple handles to be stored in the connection object.
...read (struct backend *b, struct connection *conn, { struct backend_plugin *p = container_of (b, struct backend_plugin, backend); - assert (connection_get_handle (conn)); + assert (connection_get_handle (conn, 0)); assert (p->plugin.pread != NULL); debug ("pread count=%" PRIu32 " offset=%" PRIu64, count, offset); - return p->plugin.pread (connection_get_handle (conn), buf, count, offset); + return p->plugin.pread (connection_get_handle (conn, 0), buf, count, offset); } static int @@ -359,12 +359,13 @@ plugin_pwrite (struct backend *b, struct connec...
2017 Nov 15
1
[nbdkit PATCH] connections: Improve error responses
...nbdkit_error ("invalid flush request: expecting offset and length == 0"); *error = EINVAL; - return 0; + return false; } break; @@ -710,20 +717,20 @@ validate_request (struct connection *conn, nbdkit_error ("invalid request: unknown command (%" PRIu32 ") ignored", cmd); *error = EINVAL; - return 0; + return false; } /* Validate flags */ if (flags & ~(NBD_CMD_FLAG_FUA | NBD_CMD_FLAG_NO_HOLE)) { nbdkit_error ("invalid request: unknown flag (0x%x)", flags); *error = EINVAL; -...
2018 Jan 19
0
[nbdkit PATCH v2 08/13] connections: Allow multiple handles to be stored in the connection object.
...nd *b, struct connection *conn, { struct backend_plugin *p = container_of (b, struct backend_plugin, backend); - assert (connection_get_handle (conn)); + assert (connection_get_handle (conn, 0)); assert (p->plugin.pread != NULL); assert (!flags); debug ("pread count=%" PRIu32 " offset=%" PRIu64, count, offset); - return p->plugin.pread (connection_get_handle (conn), buf, count, offset); + return p->plugin.pread (connection_get_handle (conn, 0), buf, count, offset); } static int @@ -359,13 +359,13 @@ plugin_flush (struct backend *b, struct connectio...
2011 Aug 13
2
[Hivex] [PATCH v3] Report last-modified time of hive root and nodes
.... */ + h->last_modified = le64toh ((int64_t) h->hdr->last_modified); + if (h->msglvl >= 2) { char *name = windows_utf16_to_utf8 (h->hdr->name, 64); @@ -367,6 +371,8 @@ hivex_open (const char *filename, int flags) " file version %" PRIu32 ".%" PRIu32 "\n" " sequence nos %" PRIu32 " %" PRIu32 "\n" " (sequences nos should match if hive was synched at shutdown)\n" + " last modified \n" +...
2011 Aug 10
1
[PATCH] Report last-modified time of hive root and nodes
..."); + free(h->last_modified); + h->last_modified = NULL; + } + if (h->msglvl >= 2) { char *name = windows_utf16_to_utf8 (h->hdr->name, 64); @@ -367,6 +365,8 @@ hivex_open (const char *filename, int flags) " file version %" PRIu32 ".%" PRIu32 "\n" " sequence nos %" PRIu32 " %" PRIu32 "\n" " (sequences nos should match if hive was synched at shutdown)\n" + " last modified %s\n" +...
2019 Aug 30
15
[nbdkit PATCH 0/9] can_FOO caching, more filter validation
It's easy to use the sh script to demonstrate that nbdkit is inefficiently calling into .get_size, .can_fua, and friends more than necessary. We've also commented on the list in the past that it would be nice to ensure that when filters call into next_ops, they are not violating constraints (as we've have to fix several bugs in the past where we did not have such checking to protect
2020 Mar 19
0
[nbdkit PATCH 1/2] sh, eval: Cache .can_zero and .can_flush
...pt (method); - char *h = handle; + struct sh_handle *h = handle; char cbuf[32], obuf[32], fbuf[32]; - const char *args[] = { script, method, h, cbuf, obuf, fbuf, NULL }; + const char *args[] = { script, method, h->h, cbuf, obuf, fbuf, NULL }; snprintf (cbuf, sizeof cbuf, "%" PRIu32, count); snprintf (obuf, sizeof obuf, "%" PRIu64, offset); @@ -429,8 +445,8 @@ static int boolean_method (const char *script, const char *method, void *handle, int def) { - char *h = handle; - const char *args[] = { script, method, h, NULL }; + struct sh_handle *h...
2019 Sep 28
3
Re: [nbdkit PATCH v2 5/7] server: Allow longer NBD_OPT
...the CLEANUP here ... > struct nbd_export_name_option_reply handshake_finish; > const char *optname; > uint64_t exportsize; > @@ -281,6 +281,11 @@ negotiate_handshake_newstyle_options (struct connection *conn) > nbdkit_error ("client option data too long (%" PRIu32 ")", optlen); > return -1; > } > + data = malloc (optlen + 1); /* Allowing a trailing NUL helps some uses */ > + if (data == NULL) { > + nbdkit_error ("malloc: %m"); > + return -1; > + } ... when I run this patch series under...