Displaying 6 results from an estimated 6 matches for "valid_disk_label".
2016 Dec 24
0
[PATCH] lib: Use a common function to validate strings.
..._MAX, true, true, "-_")
/**
* Check the disk label is reasonable. It can't contain certain
* characters, eg. C<'/'>, C<','>. However be stricter here and
* ensure it's just alphabetic and E<le> 20 characters in length.
*/
-static int
-valid_disk_label (const char *str)
-{
- size_t len = strlen (str);
-
- if (len == 0 || len > 20)
- return 0;
-
- while (len > 0) {
- char c = *str++;
- len--;
- if (!c_isalpha (c))
- return 0;
- }
- return 1;
-}
+#define VALID_DISK_LABEL(str) \
+ guestfs_int_string_is_valid ((str), 1, 2...
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.
2014 Mar 12
3
Re: [PATCH v2 03/18] New API parameter: Add discard parameter to guestfs_add_drive_opts.
On Tuesday 11 March 2014 23:13:46 Richard W.M. Jones wrote:
> diff --git a/src/drives.c b/src/drives.c
> index 2c85b52..68e37f7 100644
> --- a/src/drives.c
> +++ b/src/drives.c
> @@ -115,7 +115,8 @@ static struct drive *
> create_drive_file (guestfs_h *g, const char *path,
> bool readonly, const char *format,
> const char *iface,
2012 Oct 08
3
[PATCH v3 0/3] Add support for disk labels and hotplugging.
This is, I guess, version 3 of this patch series which adds disk
labels and hotplugging (only hot-add implemented so far).
The good news is .. it works!
Rich.
2012 Oct 08
5
[PATCH v4 0/5] Finish hotplugging support.
This rounds off hotplugging support by allowing you to add and remove
drives at any stage (before and after launch).
Rich.
2013 Mar 15
0
[PATCH] lib: Add direct support for the NBD (Network Block Device) protocol.
...wait for the new drive to appear. */
+ if (guestfs_internal_hot_add_drive (g, drv->disk_label) == -1)
+ return -1;
+
+ return 0;
+}
+
/* cache=none improves reliability in the event of a host crash.
*
* However this option causes qemu to try to open the file with
@@ -263,46 +389,35 @@ valid_disk_label (const char *str)
return 1;
}
-/* The low-level function that adds a drive. */
+/* Check the server (hostname) is reasonable. */
static int
-add_drive (guestfs_h *g, struct drive *drv)
+valid_server (const char *str)
{
- size_t i, drv_index;
+ size_t len = strlen (str);
- if (g->sta...