search for: parse_one_server

Displaying 8 results from an estimated 8 matches for "parse_one_server".

2014 Aug 18
3
[PATCH] drives: fix deletion of servers on error
...skip any of the created server, and to always free the "server" array. diff --git a/src/drives.c b/src/drives.c index 4bd8328..85c1495 100644 --- a/src/drives.c +++ b/src/drives.c @@ -743,8 +743,7 @@ parse_servers (guestfs_h *g, char *const *strs, for (i = 0; i < n; ++i) { if (parse_one_server (g, strs[i], &servers[i]) == -1) { - if (i > 0) - free_drive_servers (servers, i-1); + free_drive_servers (servers, i); return -1; } } --- src/drives.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/drives.c b/src/drives.c index 4bd...
2016 Dec 24
0
[PATCH] lib: Use a common function to validate strings.
...&& c != ':' && c != '[' && c != ']') - return 0; - } - return 1; -} +#define VALID_HOSTNAME(str) \ + guestfs_int_string_is_valid ((str), 1, 255, true, true, "-.:[]") /** * Check the port number is reasonable. @@ -700,7 +657,7 @@ parse_one_server (guestfs_h *g, const char *server, struct drive_server *ret) return -1; } free (port_str); - if (!valid_hostname (hostname)) { + if (!VALID_HOSTNAME (hostname)) { error (g, _("invalid hostname '%s'"), hostname); free (hostname); return -...
2016 Dec 24
2
[PATCH] lib: Use a common function to validate strings.
As discussed in the thread on validating $TERM, it would be good to have a common function to do this. This is such a function. The main advantage is it includes unit tests which the previous functions did not. Rich.
2018 Jun 14
1
lib: Convert all drive socket parameters to an absolute path
One interesting omission is that we don't allow sockets in the abstract namespace. The API won't let you pass these sockets because they contain a '\0' character in the middle of the string. Therefore this patch doesn't need to deal with those. However we should in future allow that, probably using the '@' character to stand in for the NUL byte, as is used in a few
2018 Jun 15
1
[PATCH v2] lib: Convert all drive socket parameters to an absolute path (RHBZ#1588451).
...ex 82ef30093..7697f369a 100644 --- a/lib/drives.c +++ b/lib/drives.c @@ -28,6 +28,7 @@ #include <stdbool.h> #include <string.h> #include <unistd.h> +#include <limits.h> #include <netdb.h> #include <arpa/inet.h> #include <assert.h> @@ -645,7 +646,18 @@ parse_one_server (guestfs_h *g, const char *server, struct drive_server *ret) return -1; } ret->transport = drive_transport_unix; - ret->u.socket = safe_strdup (g, server+5); + + /* libvirt requires sockets to be specified as an absolute path + * (see RHBZ#1588451), and it's pro...
2020 Feb 11
2
[PATCH v2] lib: add support for disks with 4096 bytes sector size
.../** @@ -618,6 +628,17 @@ valid_port (int port) return 1; } +/** + * Check the block size is reasonable. It can't be other then 512 or 4096. + */ +static int +valid_blocksize (int blocksize) +{ + if (blocksize == 512 || blocksize == 4096) + return 1; + return 0; +} + static int parse_one_server (guestfs_h *g, const char *server, struct drive_server *ret) { @@ -767,6 +788,10 @@ guestfs_impl_add_drive_opts (guestfs_h *g, const char *filename, optargs->bitmask & GUESTFS_ADD_DRIVE_OPTS_COPYONREAD_BITMASK ? optargs->copyonread : false; + data.blocksize = + optargs-&g...
2020 Feb 10
1
[PATCH] lib: allow to specify physical/logical block size for disks
...8,17 @@ valid_port (int port) return 1; } +/** + * Check the block size is reasonable. It can't be other then 0, 512 or 4096. + */ +static int +valid_blocksize (int blocksize) +{ + if (blocksize == 0 || blocksize == 512 || blocksize == 4096) + return 1; + return 0; +} + static int parse_one_server (guestfs_h *g, const char *server, struct drive_server *ret) { @@ -767,6 +788,10 @@ guestfs_impl_add_drive_opts (guestfs_h *g, const char *filename, optargs->bitmask & GUESTFS_ADD_DRIVE_OPTS_COPYONREAD_BITMASK ? optargs->copyonread : false; + data.blocksize = + optargs-&g...
2017 Apr 04
1
[PATCH] Use Unicode single quotes ‘’ in place of short single quoted strings throughout.
...;format) { if (STRNEQ (data->format, "raw")) { - error (g, _("for device '/dev/null', format must be 'raw'")); + error (g, _("for device ‘/dev/null’, format must be ‘raw’")); return NULL; } } else { @@ -653,14 +653,14 @@ parse_one_server (guestfs_h *g, const char *server, struct drive_server *ret) if (match2 (g, server, re_hostname_port, &hostname, &port_str)) { if (sscanf (port_str, "%d", &port) != 1 || !valid_port (port)) { - error (g, _("invalid port number '%s'"), port_str)...