search for: nbdkit_parse_uint32_t

Displaying 20 results from an estimated 28 matches for "nbdkit_parse_uint32_t".

2019 Sep 23
2
[PATCH nbdkit v2] server: public: Add nbdkit_parse_* functions for safely parsing integers.
...t16_t (const char *what, + const char *str, int16_t *r); + int nbdkit_parse_uint16_t (const char *what, + const char *str, uint16_t *r); + int nbdkit_parse_int32_t (const char *what, + const char *str, int32_t *r); + int nbdkit_parse_uint32_t (const char *what, + const char *str, uint32_t *r); + int nbdkit_parse_int64_t (const char *what, + const char *str, int64_t *r); + int nbdkit_parse_uint64_t (const char *what, + const char *str, uint64_t *r); + +Parse...
2019 Nov 22
1
[nbdkit PATCH] nbd: Add vsock_cid= transport option
...rt = "10809"; } + else if (raw_cid) { +#if !USE_VSOCK + nbdkit_error ("libnbd was compiled without vsock support"); + return -1; +#else + if (uri) { + nbdkit_error ("cannot mix VSOCK with other transport parameters"); + return -1; + } + if (nbdkit_parse_uint32_t ("vsock_cid", raw_cid, &cid) == -1 || + nbdkit_parse_uint32_t ("port", port, &vport) == -1) + return -1; +#endif + } else if (uri) { struct nbd_handle *nbd = nbd_create (); @@ -237,7 +265,8 @@ nbdplug_config_complete (void) } nbd_close (nb...
2019 Sep 23
2
Re: [PATCH nbdkit] server: public: Add nbdkit_parse_* functions for safely parsing integers.
...s later if a need arises? Or should > we do it now? We certainly could. I couldn't see an immediate reason, except maybe for the ’mbr-id’ parameter. > > + int nbdkit_parse_int32_t (const char *what, > > + const char *str, int32_t *r); > > + int nbdkit_parse_uint32_t (const char *what, > > + const char *str, uint32_t *r); > > + int nbdkit_parse_int64_t (const char *what, > > + const char *str, int64_t *r); > > + int nbdkit_parse_uint64_t (const char *what, > > +...
2020 Jul 07
2
[nbdkit PATCH] nbd: Add vsock-cid= transport option
...@ -266,6 +283,18 @@ nbdplug_config_complete (void) if (!port) port = "10809"; } + else if (raw_cid) { +#if !USE_VSOCK + nbdkit_error ("libnbd was compiled without vsock support"); + return -1; +#else + if (!port) + port = "10809"; + if (nbdkit_parse_uint32_t ("vsock_cid", raw_cid, &cid) == -1 || + nbdkit_parse_uint32_t ("port", port, &vport) == -1) + return -1; +#endif + } else if (command.size > 0) { /* Add NULL sentinel to the command. */ if (string_vector_append (&command, NULL) == -1) { @...
2020 Aug 18
0
[PATCH nbdkit 8/9] include: Prefix all exports with NBDKIT_DLLEXPORT.
...*str, - int16_t *r); -extern int nbdkit_parse_uint16_t (const char *what, const char *str, - uint16_t *r); -extern int nbdkit_parse_int32_t (const char *what, const char *str, - int32_t *r); -extern int nbdkit_parse_uint32_t (const char *what, const char *str, - uint32_t *r); -extern int nbdkit_parse_int64_t (const char *what, const char *str, - int64_t *r); -extern int nbdkit_parse_uint64_t (const char *what, const char *str, -...
2019 Oct 18
2
Re: [PATCH nbdkit] Add support for AF_VSOCK.
...int sock; > + int *ret; > + struct sockaddr_vm addr; > + > + if (port == NULL) > + vsock_port = 10809; > + else { > + /* --port parameter must be numeric for vsock, unless > + * /etc/services is extended but that seems unlikely. XXX > + */ > + if (nbdkit_parse_uint32_t ("port", port, &vsock_port) == -1) > + exit (EXIT_FAILURE); > + } > + > +#ifdef SOCK_CLOEXEC > + sock = socket (AF_VSOCK, SOCK_STREAM|SOCK_CLOEXEC, 0); > +#else > + /* Fortunately, this code is only run at startup, so there is no > + * risk of the fd...
2020 Jul 07
0
Re: [nbdkit PATCH] nbd: Add vsock-cid= transport option
...if (!port) > port = "10809"; > } > + else if (raw_cid) { > +#if !USE_VSOCK > + nbdkit_error ("libnbd was compiled without vsock support"); > + return -1; > +#else > + if (!port) > + port = "10809"; > + if (nbdkit_parse_uint32_t ("vsock_cid", raw_cid, &cid) == -1 || > + nbdkit_parse_uint32_t ("port", port, &vport) == -1) > + return -1; > +#endif > + } > else if (command.size > 0) { > /* Add NULL sentinel to the command. */ > if (string_vector_app...
2019 Sep 21
2
[PATCH nbdkit] server: public: Add nbdkit_parse_* functions for safely parsing integers.
...t16_t (const char *what, + const char *str, int16_t *r); + int nbdkit_parse_uint16_t (const char *what, + const char *str, uint16_t *r); + int nbdkit_parse_int32_t (const char *what, + const char *str, int32_t *r); + int nbdkit_parse_uint32_t (const char *what, + const char *str, uint32_t *r); + int nbdkit_parse_int64_t (const char *what, + const char *str, int64_t *r); + int nbdkit_parse_uint64_t (const char *what, + const char *str, uint64_t *r); + int nbd...
2020 Mar 26
0
[PATCH nbdkit 5/9 patch split 2/5] lib: Move code for parsing, passwords and paths into libnbdkit.so.
...t_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_int; - nbdkit_parse_size; - nbdkit_parse_uint8_t; - nbdkit_parse_uint16_t; - nbdkit_parse_uint32_t; - nbdkit_parse_uint64_t; - nbdkit_parse_unsigned; nbdkit_peer_name; - nbdkit_read_password; - nbdkit_realpath; nbdkit_set_error; nbdkit_shutdown; nbdkit_vdebug; nbdkit_verror; - + # -D server.* flags must be visible to nbdkit itself. nbdkit_debug_*;...
2020 Mar 23
0
[PATCH nbdkit 2/3] server: Inject API functions for Windows
...ons->parse_int8_t = nbdkit_parse_int8_t; + functions->parse_uint8_t = nbdkit_parse_uint8_t; + functions->parse_int16_t = nbdkit_parse_int16_t; + functions->parse_uint16_t = nbdkit_parse_uint16_t; + functions->parse_int32_t = nbdkit_parse_int32_t; + functions->parse_uint32_t = nbdkit_parse_uint32_t; + functions->parse_int64_t = nbdkit_parse_int64_t; + functions->parse_uint64_t = nbdkit_parse_uint64_t; + functions->read_password = nbdkit_read_password; + functions->realpath = nbdkit_realpath; + functions->nanosleep = nbdkit_nanosleep; + functions->export_name = nbdkit_e...
2020 Mar 25
0
Re: nbdkit / mingw support
...ar *str, int64_t *rp) server/public.c:nbdkit_parse_unsigned (const char *what, const char *str, unsigned *rp) server/public.c:nbdkit_parse_uint8_t (const char *what, const char *str, uint8_t *rp) server/public.c:nbdkit_parse_uint16_t (const char *what, const char *str, uint16_t *rp) server/public.c:nbdkit_parse_uint32_t (const char *what, const char *str, uint32_t *rp) server/public.c:nbdkit_parse_uint64_t (const char *what, const char *str, uint64_t *rp) server/public.c:nbdkit_parse_size (const char *str) server/public.c:nbdkit_parse_bool (const char *str) server/public.c:nbdkit_read_password (const char *value,...
2019 Oct 18
2
[PATCH nbdkit] Add support for AF_VSOCK.
This is a series of patches to libnbd and nbdkit adding AF_VSOCK support. On the host side it allows you to start an nbdkit instance which listens on a virtio-vsock socket: $ ./nbdkit -fv --vsock memory 1G ... nbdkit: debug: bound to vsock 2:10809 On the guest side you can then use libnbd to connect to the server: $ ./run nbdsh -c 'h.connect_vsock(2, 10809)' -c
2019 Sep 23
0
Re: [PATCH nbdkit v2] server: public: Add nbdkit_parse_* functions for safely parsing integers.
...@@ -151,8 +152,11 @@ ssh_config (const char *key, const char *value) > } > > else if (strcmp (key, "timeout") == 0) { > - if (sscanf (value, "%ld", &timeout) != 1) { > - nbdkit_error ("cannot parse timeout: %s", value); > + if (nbdkit_parse_uint32_t ("timeout", value, &timeout) == -1) > + return -1; > + /* Because we have to cast it to long before calling the libssh API. */ > + if (timeout > LONG_MAX) { > + nbdkit_error ("timeout too large"); C17 5.2.4.2.1 requires 'long' to be at...
2019 Sep 23
0
Re: [PATCH nbdkit] server: public: Add nbdkit_parse_* functions for safely parsing integers.
...t (const char *what, > + const char *str, uint16_t *r); I guess we can add [u]int8_t variants later if a need arises? Or should we do it now? > + int nbdkit_parse_int32_t (const char *what, > + const char *str, int32_t *r); > + int nbdkit_parse_uint32_t (const char *what, > + const char *str, uint32_t *r); > + int nbdkit_parse_int64_t (const char *what, > + const char *str, int64_t *r); > + int nbdkit_parse_uint64_t (const char *what, > + const char *str...
2020 Oct 03
0
[PATCH nbdkit v2 1/3] server: Add new APIs for reading the client’s SO_PEERCRED.
...t, nbdkit_peer_gid, (void)); NBDKIT_EXTERN_DECL (void, nbdkit_shutdown, (void)); NBDKIT_EXTERN_DECL (const char *, nbdkit_strdup_intern, diff --git a/server/nbdkit.syms b/server/nbdkit.syms index 1eb18bb0..3d6b2235 100644 --- a/server/nbdkit.syms +++ b/server/nbdkit.syms @@ -67,7 +67,10 @@ nbdkit_parse_uint32_t; nbdkit_parse_uint64_t; nbdkit_parse_unsigned; + nbdkit_peer_gid; nbdkit_peer_name; + nbdkit_peer_pid; + nbdkit_peer_uid; nbdkit_printf_intern; nbdkit_read_password; nbdkit_realpath; diff --git a/server/public.c b/server/public.c index 7636a16b..8b7ca437 10064...
2020 Mar 26
3
Re: [PATCH nbdkit 5/9 patch split 2/5] lib: Move code for parsing, passwords and paths into libnbdkit.so.
...t_extents_new; > + nbdkit_get_extent; > + nbdkit_parse_bool; > + nbdkit_parse_int16_t; > + nbdkit_parse_int32_t; > + nbdkit_parse_int64_t; > + nbdkit_parse_int8_t; > + nbdkit_parse_int; > + nbdkit_parse_size; > + nbdkit_parse_uint16_t; > + nbdkit_parse_uint32_t; > + nbdkit_parse_uint64_t; > + nbdkit_parse_uint8_t; > + nbdkit_parse_unsigned; > + nbdkit_read_password; > + nbdkit_realpath; Are we brave enough to list nbdkit_*? Or is being explicit on each symbol still a good idea? Are we planning on having any nbdkit_debug_*...
2020 Mar 23
6
[PATCH nbdkit 0/3] msys2 support for review
I pushed a few of the msys2 patches upstream. I changed the way that $(SHARED_LDFLAGS) works so it's more to my liking, and the others were pushed unchanged. Three patches remain which I'm posting on the mailing list for proper review. Rich.
2020 Mar 24
2
Re: nbdkit / mingw support
On 3/24/20 3:12 PM, Eric Blake wrote: >> (For non-mingw platforms) this breaks the source API promises rather >> seriously, so if I understand your proposal correctly I don't think >> this is a good idea.  It's possibly something we can consider for >> internal plugins, or for the V3 API. > > How does it break API to request that someone link against a
2019 Nov 14
1
ANNOUNCE: libnbd 1.2 & nbdkit 1.16 - high performance NBD client and server
...unctions for safely parsing integers: "nbdkit_parse_int", "nbdkit_parse_unsigned", "nbdkit_parse_int8_t", "nbdkit_parse_uint8_t", "nbdkit_parse_int16_t", "nbdkit_parse_uint16_t", "nbdkit_parse_int32_t", "nbdkit_parse_uint32_t", "nbdkit_parse_int64_t", "nbdkit_parse_uint64_t". Bug fixes ".trim" with FUA flag set now works (Eric Blake). Documentation The previous release notes have been turned into man pages. Tests Several tests now optionally use...
2020 Mar 26
9
[PATCH nbdkit 5/9 patch split 1/5] Create libnbdkit.so.
This is the previous 5/9 patch posted earlier today, split into reviewable chunks. This passes bisection with -x 'make && make check', but I didn't work very hard on the commit messages, so I refer you back to the original patch to explain how it works: https://www.redhat.com/archives/libguestfs/2020-March/msg00248.html Rich.