From ef496b81f0336f09968a318e7f81151dd4f5a0cc Mon Sep 17 00:00:00 2001 From: Daniel De Graaf Date: Mon, 15 Apr 2013 10:33:25 -0400 Subject: libxl: postpone backend name resolution This adds a backend_domname field in libxl devices that contain a backend_domid field, allowing either a domid or a domain name to be specified in the configuration structures. The domain name is resolved into a domain ID in the _setdefault function when adding the device. This change allows the backend of the block devices to be specified (which previously required passing the libxl_ctx down into the block device parser), and will simplify specification of backend domains in other users of libxl. The check on run_hotplug_scripts in parse_config_data is removed because it is a duplicate of the one in libxl__device_nic_setdefault, and is removed here because it no longer has the resolved domain ID to check. Signed-off-by: Daniel De Graaf Acked-by: Ian Jackson Acked-by: Ian Campbell [ ijc -- reran flex ] --- docs/misc/xl-disk-configuration.txt | 12 + tools/libxl/libxl.c | 32 ++- tools/libxl/libxl.h | 12 + tools/libxl/libxl_types.idl | 5 + tools/libxl/libxl_utils.c | 19 ++ tools/libxl/libxl_utils.h | 1 + tools/libxl/libxlu_disk_l.c | 525 ++++++++++++++++++------------------ tools/libxl/libxlu_disk_l.h | 2 +- tools/libxl/libxlu_disk_l.l | 1 + tools/libxl/xl_cmdimpl.c | 80 +----- 10 files changed, 359 insertions(+), 330 deletions(-) diff --git a/docs/misc/xl-disk-configuration.txt b/docs/misc/xl-disk-configuration.txt index 86c16be03a..5bd456d884 100644 --- a/docs/misc/xl-disk-configuration.txt +++ b/docs/misc/xl-disk-configuration.txt @@ -139,6 +139,18 @@ cdrom Convenience alias for "devtype=cdrom". +backend= +--------------------- + +Description: Designates a backend domain for the device +Supported values: Valid domain names +Mandatory: No + +Specifies the backend domain which this device should attach to. This +defaults to domain 0. Specifying another domain requires setting up a +driver domain which is outside the scope of this document. + + backendtype= -------------------------- diff --git a/tools/libxl/libxl.c b/tools/libxl/libxl.c index 3c6d71b32e..fa6dfed29e 100644 --- a/tools/libxl/libxl.c +++ b/tools/libxl/libxl.c @@ -1731,13 +1731,23 @@ static int libxl__device_nextid(libxl__gc *gc, uint32_t domid, char *device) return nextid; } +static int libxl__resolve_domid(libxl__gc *gc, const char *name, + uint32_t *domid) +{ + if (!name) + return 0; + return libxl_domain_qualifier_to_domid(CTX, name, domid); +} + /******************************************************************************/ int libxl__device_vtpm_setdefault(libxl__gc *gc, libxl_device_vtpm *vtpm) { - if(libxl_uuid_is_nil(&vtpm->uuid)) { - libxl_uuid_generate(&vtpm->uuid); - } - return 0; + int rc; + if (libxl_uuid_is_nil(&vtpm->uuid)) { + libxl_uuid_generate(&vtpm->uuid); + } + rc = libxl__resolve_domid(gc, vtpm->backend_domname, &vtpm->backend_domid); + return rc; } static int libxl__device_from_vtpm(libxl__gc *gc, uint32_t domid, @@ -1969,6 +1979,7 @@ int libxl__device_disk_setdefault(libxl__gc *gc, libxl_device_disk *disk) rc = libxl__device_disk_set_backend(gc, disk); if (rc) return rc; + rc = libxl__resolve_domid(gc, disk->backend_domname, &disk->backend_domid); return rc; } @@ -2740,6 +2751,7 @@ int libxl__device_nic_setdefault(libxl__gc *gc, libxl_device_nic *nic, uint32_t domid) { int run_hotplug_scripts; + int rc; if (!nic->mtu) nic->mtu = 1492; @@ -2800,7 +2812,8 @@ int libxl__device_nic_setdefault(libxl__gc *gc, libxl_device_nic *nic, abort(); } - return 0; + rc = libxl__resolve_domid(gc, nic->backend_domname, &nic->backend_domid); + return rc; } static int libxl__device_from_nic(libxl__gc *gc, uint32_t domid, @@ -3157,7 +3170,9 @@ out: int libxl__device_vkb_setdefault(libxl__gc *gc, libxl_device_vkb *vkb) { - return 0; + int rc; + rc = libxl__resolve_domid(gc, vkb->backend_domname, &vkb->backend_domid); + return rc; } static int libxl__device_from_vkb(libxl__gc *gc, uint32_t domid, @@ -3241,6 +3256,8 @@ out: int libxl__device_vfb_setdefault(libxl__gc *gc, libxl_device_vfb *vfb) { + int rc; + libxl_defbool_setdefault(&vfb->vnc.enable, true); if (libxl_defbool_val(vfb->vnc.enable)) { if (!vfb->vnc.listen) { @@ -3256,7 +3273,8 @@ int libxl__device_vfb_setdefault(libxl__gc *gc, libxl_device_vfb *vfb) libxl_defbool_setdefault(&vfb->sdl.enable, false); libxl_defbool_setdefault(&vfb->sdl.opengl, false); - return 0; + rc = libxl__resolve_domid(gc, vfb->backend_domname, &vfb->backend_domid); + return rc; } static int libxl__device_from_vfb(libxl__gc *gc, uint32_t domid, diff --git a/tools/libxl/libxl.h b/tools/libxl/libxl.h index 92f3f8ee0b..25efa76a04 100644 --- a/tools/libxl/libxl.h +++ b/tools/libxl/libxl.h @@ -296,6 +296,18 @@ */ #define LIBXL_HAVE_BUILDINFO_USBDEVICE_LIST 1 +/* + * LIBXL_HAVE_DEVICE_BACKEND_DOMNAME + * + * If this is defined, libxl_device_* structures containing a backend_domid + * field also contain a backend_domname field. If backend_domname is set, it is + * resolved to a domain ID when the device is used and takes precedence over the + * backend_domid field. + * + * If this is not defined, the backend_domname field does not exist. + */ +#define LIBXL_HAVE_DEVICE_BACKEND_DOMNAME 1 + /* Functions annotated with LIBXL_EXTERNAL_CALLERS_ONLY may not be * called from within libxl itself. Callers outside libxl, who * do not #include libxl_internal.h, are fine. */ diff --git a/tools/libxl/libxl_types.idl b/tools/libxl/libxl_types.idl index 2c10772c33..ecf1f0bc4f 100644 --- a/tools/libxl/libxl_types.idl +++ b/tools/libxl/libxl_types.idl @@ -351,6 +351,7 @@ libxl_domain_build_info = Struct("domain_build_info",[ libxl_device_vfb = Struct("device_vfb", [ ("backend_domid", libxl_domid), + ("backend_domname",string), ("devid", libxl_devid), ("vnc", libxl_vnc_info), ("sdl", libxl_sdl_info), @@ -360,11 +361,13 @@ libxl_device_vfb = Struct("device_vfb", [ libxl_device_vkb = Struct("device_vkb", [ ("backend_domid", libxl_domid), + ("backend_domname", string), ("devid", libxl_devid), ]) libxl_device_disk = Struct("device_disk", [ ("backend_domid", libxl_domid), + ("backend_domname", string), ("pdev_path", string), ("vdev", string), ("backend", libxl_disk_backend), @@ -377,6 +380,7 @@ libxl_device_disk = Struct("device_disk", [ libxl_device_nic = Struct("device_nic", [ ("backend_domid", libxl_domid), + ("backend_domname", string), ("devid", libxl_devid), ("mtu", integer), ("model", string), @@ -405,6 +409,7 @@ libxl_device_pci = Struct("device_pci", [ libxl_device_vtpm = Struct("device_vtpm", [ ("backend_domid", libxl_domid), + ("backend_domname", string), ("devid", libxl_devid), ("uuid", libxl_uuid), ]) diff --git a/tools/libxl/libxl_utils.c b/tools/libxl/libxl_utils.c index 8f7879060f..35da71c482 100644 --- a/tools/libxl/libxl_utils.c +++ b/tools/libxl/libxl_utils.c @@ -90,6 +90,25 @@ int libxl_name_to_domid(libxl_ctx *ctx, const char *name, return ret; } +int libxl_domain_qualifier_to_domid(libxl_ctx *ctx, const char *name, + uint32_t *domid) +{ + int i, rv; + for (i=0; name[i]; i++) { + if (!isdigit(name[i])) { + goto nondigit_found; + } + } + *domid = strtoul(name, NULL, 10); + return 0; + + nondigit_found: + /* this could also check for uuids */ + rv = libxl_name_to_domid(ctx, name, domid); + return rv; +} + + char *libxl_cpupoolid_to_name(libxl_ctx *ctx, uint32_t poolid) { unsigned int len; diff --git a/tools/libxl/libxl_utils.h b/tools/libxl/libxl_utils.h index 40f3f3027c..a430362fe5 100644 --- a/tools/libxl/libxl_utils.h +++ b/tools/libxl/libxl_utils.h @@ -21,6 +21,7 @@ const char *libxl_basename(const char *name); /* returns string from strdup */ unsigned long libxl_get_required_shadow_memory(unsigned long maxmem_kb, unsigned int smp_cpus); int libxl_name_to_domid(libxl_ctx *ctx, const char *name, uint32_t *domid); +int libxl_domain_qualifier_to_domid(libxl_ctx *ctx, const char *name, uint32_t *domid); char *libxl_domid_to_name(libxl_ctx *ctx, uint32_t domid); int libxl_name_to_cpupoolid(libxl_ctx *ctx, const char *name, uint32_t *poolid); char *libxl_cpupoolid_to_name(libxl_ctx *ctx, uint32_t poolid); diff --git a/tools/libxl/libxlu_disk_l.c b/tools/libxl/libxlu_disk_l.c index 4c68034d95..03adfef554 100644 --- a/tools/libxl/libxlu_disk_l.c +++ b/tools/libxl/libxlu_disk_l.c @@ -361,8 +361,8 @@ static void yy_fatal_error (yyconst char msg[] ,yyscan_t yyscanner ); *yy_cp = '\0'; \ yyg->yy_c_buf_p = yy_cp; -#define YY_NUM_RULES 25 -#define YY_END_OF_BUFFER 26 +#define YY_NUM_RULES 26 +#define YY_END_OF_BUFFER 27 /* This struct is not used in this scanner, but its presence is necessary. */ struct yy_trans_info @@ -370,60 +370,61 @@ struct yy_trans_info flex_int32_t yy_verify; flex_int32_t yy_nxt; }; -static yyconst flex_int16_t yy_acclist[447] = +static yyconst flex_int16_t yy_acclist[454] = { 0, - 24, 24, 26, 22, 23, 25, 8193, 22, 23, 25, - 16385, 8193, 22, 25,16385, 22, 23, 25, 23, 25, - 22, 23, 25, 22, 23, 25, 22, 23, 25, 22, - 23, 25, 22, 23, 25, 22, 23, 25, 22, 23, - 25, 22, 23, 25, 22, 23, 25, 22, 23, 25, - 22, 23, 25, 22, 23, 25, 22, 23, 25, 22, - 23, 25, 22, 23, 25, 24, 25, 25, 22, 22, - 8193, 22, 8193, 22,16385, 8193, 22, 8193, 22, 22, - 8213, 22,16405, 22, 22, 22, 22, 22, 22, 22, - 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, - - 22, 22, 24, 8193, 22, 8193, 22, 8193, 8213, 22, - 8213, 22, 8213, 12, 22, 22, 22, 22, 22, 22, - 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, - 22, 22, 8213, 22, 8213, 22, 8213, 12, 22, 17, - 8213, 22,16405, 22, 22, 22, 22, 22, 22, 22, - 8206, 8213, 22,16398,16405, 20, 8213, 22,16405, 22, - 8205, 8213, 22,16397,16405, 22, 22, 8208, 8213, 22, - 16400,16405, 22, 22, 22, 22, 17, 8213, 22, 17, - 8213, 22, 17, 22, 17, 8213, 22, 3, 22, 22, - 19, 8213, 22,16405, 22, 22, 8206, 8213, 22, 8206, - - 8213, 22, 8206, 22, 8206, 8213, 20, 8213, 22, 20, - 8213, 22, 20, 22, 20, 8213, 8205, 8213, 22, 8205, - 8213, 22, 8205, 22, 8205, 8213, 22, 8208, 8213, 22, - 8208, 8213, 22, 8208, 22, 8208, 8213, 22, 22, 9, - 22, 17, 8213, 22, 17, 8213, 22, 17, 8213, 17, - 22, 17, 22, 3, 22, 22, 19, 8213, 22, 19, - 8213, 22, 19, 22, 19, 8213, 22, 18, 8213, 22, - 16405, 8206, 8213, 22, 8206, 8213, 22, 8206, 8213, 8206, - 22, 8206, 20, 8213, 22, 20, 8213, 22, 20, 8213, - 20, 22, 20, 8205, 8213, 22, 8205, 8213, 22, 8205, - - 8213, 8205, 22, 8205, 22, 8208, 8213, 22, 8208, 8213, - 22, 8208, 8213, 8208, 22, 8208, 22, 22, 9, 12, - 9, 7, 22, 22, 19, 8213, 22, 19, 8213, 22, - 19, 8213, 19, 22, 19, 2, 18, 8213, 22, 18, - 8213, 22, 18, 22, 18, 8213, 10, 22, 11, 9, - 9, 12, 7, 12, 7, 22, 6, 2, 12, 2, - 18, 8213, 22, 18, 8213, 22, 18, 8213, 18, 22, - 18, 10, 12, 10, 15, 8213, 22,16405, 11, 12, - 11, 7, 7, 12, 22, 6, 12, 6, 6, 12, - 6, 12, 2, 2, 12, 10, 10, 12, 15, 8213, - - 22, 15, 8213, 22, 15, 22, 15, 8213, 11, 12, - 22, 6, 6, 12, 6, 6, 15, 8213, 22, 15, - 8213, 22, 15, 8213, 15, 22, 15, 22, 6, 6, - 8, 6, 5, 6, 8, 12, 8, 4, 6, 5, - 6, 8, 8, 12, 4, 6 + 25, 25, 27, 23, 24, 26, 8193, 23, 24, 26, + 16385, 8193, 23, 26,16385, 23, 24, 26, 24, 26, + 23, 24, 26, 23, 24, 26, 23, 24, 26, 23, + 24, 26, 23, 24, 26, 23, 24, 26, 23, 24, + 26, 23, 24, 26, 23, 24, 26, 23, 24, 26, + 23, 24, 26, 23, 24, 26, 23, 24, 26, 23, + 24, 26, 23, 24, 26, 25, 26, 26, 23, 23, + 8193, 23, 8193, 23,16385, 8193, 23, 8193, 23, 23, + 8214, 23,16406, 23, 23, 23, 23, 23, 23, 23, + 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, + + 23, 23, 25, 8193, 23, 8193, 23, 8193, 8214, 23, + 8214, 23, 8214, 13, 23, 23, 23, 23, 23, 23, + 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, + 23, 23, 8214, 23, 8214, 23, 8214, 13, 23, 18, + 8214, 23,16406, 23, 23, 23, 23, 23, 23, 23, + 8207, 8214, 23,16399,16406, 21, 8214, 23,16406, 23, + 8206, 8214, 23,16398,16406, 23, 23, 8209, 8214, 23, + 16401,16406, 23, 23, 23, 23, 18, 8214, 23, 18, + 8214, 23, 18, 23, 18, 8214, 23, 3, 23, 23, + 20, 8214, 23,16406, 23, 23, 8207, 8214, 23, 8207, + + 8214, 23, 8207, 23, 8207, 8214, 21, 8214, 23, 21, + 8214, 23, 21, 23, 21, 8214, 8206, 8214, 23, 8206, + 8214, 23, 8206, 23, 8206, 8214, 23, 8209, 8214, 23, + 8209, 8214, 23, 8209, 23, 8209, 8214, 23, 23, 10, + 23, 18, 8214, 23, 18, 8214, 23, 18, 8214, 18, + 23, 18, 23, 3, 23, 23, 20, 8214, 23, 20, + 8214, 23, 20, 23, 20, 8214, 23, 19, 8214, 23, + 16406, 8207, 8214, 23, 8207, 8214, 23, 8207, 8214, 8207, + 23, 8207, 21, 8214, 23, 21, 8214, 23, 21, 8214, + 21, 23, 21, 8206, 8214, 23, 8206, 8214, 23, 8206, + + 8214, 8206, 23, 8206, 23, 8209, 8214, 23, 8209, 8214, + 23, 8209, 8214, 8209, 23, 8209, 23, 23, 10, 13, + 10, 7, 23, 23, 20, 8214, 23, 20, 8214, 23, + 20, 8214, 20, 23, 20, 2, 19, 8214, 23, 19, + 8214, 23, 19, 23, 19, 8214, 11, 23, 12, 10, + 10, 13, 7, 13, 7, 8, 23, 6, 2, 13, + 2, 19, 8214, 23, 19, 8214, 23, 19, 8214, 19, + 23, 19, 11, 13, 11, 16, 8214, 23,16406, 12, + 13, 12, 7, 7, 13, 8, 13, 8, 23, 6, + 13, 6, 6, 13, 6, 13, 2, 2, 13, 11, + + 11, 13, 16, 8214, 23, 16, 8214, 23, 16, 23, + 16, 8214, 12, 13, 8, 8, 13, 23, 6, 6, + 13, 6, 6, 16, 8214, 23, 16, 8214, 23, 16, + 8214, 16, 23, 16, 23, 6, 6, 9, 6, 5, + 6, 9, 13, 9, 4, 6, 5, 6, 9, 9, + 13, 4, 6 } ; -static yyconst flex_int16_t yy_accept[252] = +static yyconst flex_int16_t yy_accept[257] = { 0, 1, 1, 1, 2, 3, 4, 7, 12, 16, 19, 21, 24, 27, 30, 33, 36, 39, 42, 45, 48, @@ -445,14 +446,14 @@ static yyconst flex_int16_t yy_accept[252] = 293, 294, 297, 300, 302, 304, 305, 306, 309, 312, 314, 316, 317, 318, 319, 321, 322, 323, 324, 325, 328, 331, 333, 335, 336, 337, 340, 343, 345, 347, - 348, 349, 350, 351, 353, 355, 356, 357, 358, 360, - - 361, 364, 367, 369, 371, 372, 374, 375, 379, 381, - 382, 383, 385, 386, 388, 389, 391, 393, 394, 396, - 397, 399, 402, 405, 407, 409, 411, 412, 413, 415, - 416, 417, 420, 423, 425, 427, 428, 429, 430, 431, - 432, 433, 435, 437, 438, 440, 442, 443, 445, 447, - 447 + 348, 349, 350, 351, 353, 355, 356, 357, 358, 359, + + 361, 362, 365, 368, 370, 372, 373, 375, 376, 380, + 382, 383, 384, 386, 388, 389, 390, 392, 393, 395, + 397, 398, 400, 401, 403, 406, 409, 411, 413, 415, + 416, 418, 419, 420, 422, 423, 424, 427, 430, 432, + 434, 435, 436, 437, 438, 439, 440, 442, 444, 445, + 447, 449, 450, 452, 454, 454 } ; static yyconst flex_int32_t yy_ec[256] = @@ -495,83 +496,85 @@ static yyconst flex_int32_t yy_meta[34] = 1, 1, 1 } ; -static yyconst flex_int16_t yy_base[308] = +static yyconst flex_int16_t yy_base[315] = { 0, - 0, 0, 546, 538, 533, 521, 32, 35, 656, 656, - 44, 62, 30, 41, 50, 51, 507, 64, 47, 66, - 67, 499, 68, 487, 72, 0, 656, 465, 656, 87, - 91, 0, 0, 100, 452, 109, 0, 74, 95, 87, + 0, 0, 563, 559, 558, 546, 32, 35, 665, 665, + 44, 62, 30, 41, 50, 51, 532, 64, 47, 66, + 67, 524, 68, 516, 72, 0, 665, 514, 665, 87, + 91, 0, 0, 100, 500, 109, 0, 74, 95, 87, 32, 96, 105, 110, 77, 97, 40, 113, 116, 112, 118, 120, 121, 122, 123, 125, 0, 137, 0, 0, - 147, 0, 0, 449, 129, 126, 134, 143, 145, 147, + 147, 0, 0, 494, 129, 126, 134, 143, 145, 147, 148, 149, 151, 153, 156, 160, 155, 167, 162, 175, - 168, 159, 188, 0, 0, 656, 166, 197, 179, 185, - 176, 200, 435, 186, 193, 216, 225, 205, 234, 221, + 168, 159, 188, 0, 0, 665, 166, 197, 179, 185, + 176, 200, 460, 186, 193, 216, 225, 205, 234, 221, 237, 247, 204, 230, 244, 213, 254, 0, 256, 0, 251, 258, 254, 279, 256, 259, 267, 0, 269, 0, 286, 0, 288, 0, 290, 0, 297, 0, 267, 299, - 0, 301, 0, 288, 297, 421, 302, 310, 0, 0, - 0, 0, 305, 656, 307, 319, 0, 321, 0, 322, + 0, 301, 0, 288, 297, 459, 302, 310, 0, 0, + 0, 0, 305, 665, 307, 319, 0, 321, 0, 322, 332, 335, 0, 0, 0, 0, 339, 0, 0, 0, 0, 342, 0, 0, 0, 0, 340, 349, 0, 0, - 0, 0, 337, 345, 420, 656, 419, 346, 350, 358, - 0, 0, 0, 0, 418, 360, 0, 362, 0, 417, - 319, 369, 416, 656, 415, 656, 276, 364, 414, 656, - - 375, 0, 0, 0, 0, 413, 656, 384, 412, 0, - 410, 656, 370, 409, 656, 370, 378, 408, 656, 366, - 656, 394, 0, 396, 0, 0, 380, 316, 656, 377, - 387, 398, 0, 0, 0, 0, 399, 402, 407, 271, - 406, 228, 200, 656, 175, 656, 77, 656, 656, 656, - 428, 432, 435, 439, 443, 447, 451, 455, 459, 463, - 467, 471, 475, 479, 483, 487, 491, 495, 499, 503, - 507, 511, 515, 519, 523, 527, 531, 535, 539, 543, - 547, 551, 555, 559, 563, 567, 571, 575, 579, 583, - 587, 591, 595, 599, 603, 607, 611, 615, 619, 623, - - 627, 631, 635, 639, 643, 647, 651 + 0, 0, 337, 345, 450, 665, 442, 350, 352, 360, + 0, 0, 0, 0, 424, 362, 0, 364, 0, 420, + 319, 371, 419, 665, 418, 665, 417, 276, 368, 416, + + 665, 373, 0, 0, 0, 0, 415, 665, 382, 414, + 0, 413, 665, 412, 665, 368, 411, 665, 384, 352, + 410, 665, 409, 665, 391, 0, 395, 0, 0, 405, + 665, 382, 316, 665, 385, 397, 399, 0, 0, 0, + 0, 396, 403, 406, 271, 407, 228, 200, 665, 175, + 665, 77, 665, 665, 665, 429, 433, 436, 440, 444, + 448, 452, 456, 460, 464, 468, 472, 476, 480, 484, + 488, 492, 496, 500, 504, 508, 512, 516, 520, 524, + 528, 532, 536, 540, 544, 548, 552, 556, 560, 564, + 568, 572, 576, 580, 584, 588, 592, 596, 600, 604, + + 608, 612, 616, 620, 624, 628, 632, 636, 640, 644, + 648, 652, 656, 660 } ; -static yyconst flex_int16_t yy_def[308] = +static yyconst flex_int16_t yy_def[315] = { 0, - 250, 1, 251, 251, 250, 252, 253, 253, 250, 250, - 254, 254, 12, 12, 12, 12, 12, 12, 12, 12, - 12, 12, 12, 12, 12, 255, 250, 252, 250, 256, - 253, 257, 257, 258, 12, 252, 259, 12, 12, 12, + 255, 1, 256, 256, 255, 257, 258, 258, 255, 255, + 259, 259, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 260, 255, 257, 255, 261, + 258, 262, 262, 263, 12, 257, 264, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, - 12, 12, 12, 12, 12, 12, 255, 256, 257, 257, - 260, 261, 261, 250, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 260, 261, 262, 262, + 265, 266, 266, 255, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, - 12, 12, 260, 261, 261, 250, 12, 262, 12, 12, - 12, 12, 12, 12, 12, 263, 264, 12, 265, 12, - - 12, 266, 12, 12, 12, 12, 267, 268, 262, 268, - 12, 12, 12, 269, 12, 12, 270, 271, 263, 271, - 272, 273, 264, 273, 274, 275, 265, 275, 12, 276, - 277, 266, 277, 12, 12, 278, 12, 267, 268, 268, - 279, 279, 12, 250, 12, 280, 281, 269, 281, 12, - 282, 270, 271, 271, 283, 283, 272, 273, 273, 284, - 284, 274, 275, 275, 285, 285, 12, 276, 277, 277, - 286, 286, 12, 12, 287, 250, 288, 12, 12, 280, - 281, 281, 289, 289, 290, 291, 292, 282, 292, 293, - 12, 294, 287, 250, 295, 250, 12, 296, 297, 250, - - 291, 292, 292, 298, 298, 299, 250, 300, 301, 301, - 295, 250, 12, 302, 250, 302, 302, 297, 250, 299, - 250, 303, 304, 300, 304, 301, 12, 302, 250, 302, - 302, 303, 304, 304, 305, 305, 12, 302, 302, 306, - 302, 302, 307, 250, 302, 250, 307, 250, 250, 0, - 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, - 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, - 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, - 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, - 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, - - 250, 250, 250, 250, 250, 250, 250 + 12, 12, 265, 266, 266, 255, 12, 267, 12, 12, + 12, 12, 12, 12, 12, 268, 269, 12, 270, 12, + + 12, 271, 12, 12, 12, 12, 272, 273, 267, 273, + 12, 12, 12, 274, 12, 12, 275, 276, 268, 276, + 277, 278, 269, 278, 279, 280, 270, 280, 12, 281, + 282, 271, 282, 12, 12, 283, 12, 272, 273, 273, + 284, 284, 12, 255, 12, 285, 286, 274, 286, 12, + 287, 275, 276, 276, 288, 288, 277, 278, 278, 289, + 289, 279, 280, 280, 290, 290, 12, 281, 282, 282, + 291, 291, 12, 12, 292, 255, 293, 12, 12, 285, + 286, 286, 294, 294, 295, 296, 297, 287, 297, 298, + 12, 299, 292, 255, 300, 255, 301, 12, 302, 303, + + 255, 296, 297, 297, 304, 304, 305, 255, 306, 307, + 307, 300, 255, 308, 255, 12, 309, 255, 309, 309, + 303, 255, 305, 255, 310, 311, 306, 311, 307, 308, + 255, 12, 309, 255, 309, 309, 310, 311, 311, 312, + 312, 12, 309, 309, 313, 309, 309, 314, 255, 309, + 255, 314, 255, 255, 0, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 255 } ; -static yyconst flex_int16_t yy_nxt[690] = +static yyconst flex_int16_t yy_nxt[699] = { 0, 6, 7, 8, 9, 6, 6, 6, 6, 10, 11, 12, 13, 14, 15, 16, 17, 17, 18, 17, 17, @@ -581,7 +584,7 @@ static yyconst flex_int16_t yy_nxt[690] = 35, 36, 37, 73, 42, 38, 35, 49, 68, 35, 35, 39, 28, 28, 28, 29, 34, 43, 45, 36, 37, 40, 44, 35, 46, 35, 35, 35, 51, 53, - 244, 35, 50, 35, 55, 65, 35, 47, 56, 28, + 249, 35, 50, 35, 55, 65, 35, 47, 56, 28, 59, 48, 31, 31, 32, 60, 35, 71, 67, 33, 28, 28, 28, 29, 35, 35, 35, 28, 37, 61, @@ -591,66 +594,68 @@ static yyconst flex_int16_t yy_nxt[690] = 59, 77, 87, 35, 76, 60, 80, 79, 81, 28, 84, 78, 35, 89, 35, 85, 35, 35, 35, 75, 35, 92, 35, 96, 35, 35, 90, 97, 35, 35, - 93, 35, 94, 91, 99, 35, 35, 35, 249, 100, + 93, 35, 94, 91, 99, 35, 35, 35, 254, 100, 95, 101, 102, 104, 35, 35, 98, 103, 35, 105, 28, 84, 111, 106, 35, 35, 85, 107, 107, 61, - 108, 107, 35, 248, 107, 110, 112, 114, 113, 35, + 108, 107, 35, 253, 107, 110, 112, 114, 113, 35, 75, 78, 99, 35, 35, 116, 117, 117, 61, 118, 117, 134, 35, 117, 120, 121, 121, 61, 122, 121, - 35, 246, 121, 124, 125, 125, 61, 126, 125, 35, + 35, 251, 121, 124, 125, 125, 61, 126, 125, 35, 137, 125, 128, 135, 102, 129, 35, 130, 130, 61, 131, 130, 136, 35, 130, 133, 28, 139, 28, 141, 35, 144, 140, 35, 142, 35, 151, 35, 35, 28, - 153, 28, 155, 143, 244, 154, 35, 156, 145, 146, + 153, 28, 155, 143, 249, 154, 35, 156, 145, 146, 146, 61, 147, 146, 150, 35, 146, 149, 28, 158, 28, 160, 28, 163, 159, 167, 161, 35, 164, 28, - 165, 28, 169, 28, 171, 166, 35, 170, 213, 172, - 177, 35, 28, 139, 35, 173, 35, 178, 140, 215, - 179, 28, 181, 28, 183, 174, 208, 182, 35, 184, + 165, 28, 169, 28, 171, 166, 35, 170, 216, 172, + 177, 35, 28, 139, 35, 173, 35, 178, 140, 218, + 179, 28, 181, 28, 183, 174, 209, 182, 35, 184, 185, 35, 186, 186, 61, 187, 186, 28, 153, 186, 189, 28, 158, 154, 28, 163, 35, 159, 190, 35, - 164, 28, 169, 192, 35, 35, 191, 170, 198, 35, - 28, 181, 28, 202, 28, 204, 182, 215, 203, 207, - 205, 64, 210, 229, 197, 216, 217, 28, 202, 35, - 215, 229, 230, 203, 222, 222, 61, 223, 222, 35, - 215, 222, 225, 237, 227, 231, 28, 233, 28, 235, - - 28, 233, 234, 238, 236, 215, 234, 240, 35, 215, - 215, 200, 229, 196, 239, 226, 221, 219, 212, 176, - 207, 200, 196, 194, 176, 241, 242, 245, 26, 26, - 26, 26, 28, 28, 28, 30, 30, 30, 30, 35, - 35, 35, 35, 57, 115, 57, 57, 58, 58, 58, - 58, 60, 86, 60, 60, 34, 34, 34, 34, 64, - 64, 35, 64, 83, 83, 83, 83, 85, 29, 85, - 85, 109, 109, 109, 109, 119, 119, 119, 119, 123, - 123, 123, 123, 127, 127, 127, 127, 132, 132, 132, - 132, 138, 138, 138, 138, 140, 54, 140, 140, 148, - - 148, 148, 148, 152, 152, 152, 152, 154, 52, 154, - 154, 157, 157, 157, 157, 159, 35, 159, 159, 162, - 162, 162, 162, 164, 29, 164, 164, 168, 168, 168, - 168, 170, 250, 170, 170, 175, 175, 175, 175, 142, - 27, 142, 142, 180, 180, 180, 180, 182, 27, 182, - 182, 188, 188, 188, 188, 156, 250, 156, 156, 161, - 250, 161, 161, 166, 250, 166, 166, 172, 250, 172, - 172, 193, 193, 193, 193, 195, 195, 195, 195, 184, - 250, 184, 184, 199, 199, 199, 199, 201, 201, 201, - 201, 203, 250, 203, 203, 206, 206, 206, 206, 209, - - 209, 209, 209, 211, 211, 211, 211, 214, 214, 214, - 214, 218, 218, 218, 218, 205, 250, 205, 205, 220, - 220, 220, 220, 224, 224, 224, 224, 210, 250, 210, - 210, 228, 228, 228, 228, 232, 232, 232, 232, 234, - 250, 234, 234, 236, 250, 236, 236, 243, 243, 243, - 243, 247, 247, 247, 247, 5, 250, 250, 250, 250, - 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, - 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, - 250, 250, 250, 250, 250, 250, 250, 250, 250 + 164, 28, 169, 192, 35, 234, 191, 170, 197, 35, + 199, 35, 28, 181, 28, 203, 28, 205, 182, 236, + 204, 218, 206, 64, 211, 28, 203, 35, 198, 219, + 220, 204, 225, 225, 61, 226, 225, 234, 218, 225, + 228, 35, 232, 28, 238, 242, 235, 28, 240, 239, + + 218, 28, 238, 241, 245, 35, 218, 239, 215, 218, + 218, 243, 208, 201, 234, 231, 196, 229, 224, 222, + 215, 213, 176, 208, 244, 247, 246, 201, 250, 26, + 26, 26, 26, 28, 28, 28, 30, 30, 30, 30, + 35, 35, 35, 35, 57, 196, 57, 57, 58, 58, + 58, 58, 60, 194, 60, 60, 34, 34, 34, 34, + 64, 64, 176, 64, 83, 83, 83, 83, 85, 115, + 85, 85, 109, 109, 109, 109, 119, 119, 119, 119, + 123, 123, 123, 123, 127, 127, 127, 127, 132, 132, + 132, 132, 138, 138, 138, 138, 140, 86, 140, 140, + + 148, 148, 148, 148, 152, 152, 152, 152, 154, 35, + 154, 154, 157, 157, 157, 157, 159, 29, 159, 159, + 162, 162, 162, 162, 164, 54, 164, 164, 168, 168, + 168, 168, 170, 52, 170, 170, 175, 175, 175, 175, + 142, 35, 142, 142, 180, 180, 180, 180, 182, 29, + 182, 182, 188, 188, 188, 188, 156, 255, 156, 156, + 161, 27, 161, 161, 166, 27, 166, 166, 172, 255, + 172, 172, 193, 193, 193, 193, 195, 195, 195, 195, + 184, 255, 184, 184, 200, 200, 200, 200, 202, 202, + 202, 202, 204, 255, 204, 204, 207, 207, 207, 207, + + 210, 210, 210, 210, 212, 212, 212, 212, 214, 214, + 214, 214, 217, 217, 217, 217, 221, 221, 221, 221, + 206, 255, 206, 206, 223, 223, 223, 223, 227, 227, + 227, 227, 211, 255, 211, 211, 230, 230, 230, 230, + 233, 233, 233, 233, 237, 237, 237, 237, 239, 255, + 239, 239, 241, 255, 241, 241, 248, 248, 248, 248, + 252, 252, 252, 252, 5, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 255, 255, 255 + } ; -static yyconst flex_int16_t yy_chk[690] = +static yyconst flex_int16_t yy_chk[699] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, @@ -660,7 +665,7 @@ static yyconst flex_int16_t yy_chk[690] = 14, 11, 11, 47, 14, 11, 19, 19, 41, 15, 16, 11, 12, 12, 12, 12, 12, 14, 16, 12, 12, 12, 15, 18, 16, 20, 21, 23, 21, 23, - 247, 25, 20, 38, 25, 38, 45, 18, 25, 30, + 252, 25, 20, 38, 25, 38, 45, 18, 25, 30, 30, 18, 31, 31, 31, 30, 40, 45, 40, 31, 34, 34, 34, 34, 39, 42, 46, 34, 34, 36, @@ -670,63 +675,65 @@ static yyconst flex_int16_t yy_chk[690] = 58, 51, 65, 67, 50, 58, 54, 53, 54, 61, 61, 52, 68, 67, 69, 61, 70, 71, 72, 70, 73, 71, 74, 75, 77, 75, 68, 76, 82, 76, - 72, 79, 73, 69, 78, 87, 78, 81, 245, 79, + 72, 79, 73, 69, 78, 87, 78, 81, 250, 79, 74, 80, 80, 81, 80, 91, 77, 80, 89, 82, 83, 83, 89, 87, 90, 94, 83, 88, 88, 88, - 88, 88, 95, 243, 88, 88, 90, 92, 91, 92, + 88, 88, 95, 248, 88, 88, 90, 92, 91, 92, 95, 98, 98, 103, 98, 94, 96, 96, 96, 96, 96, 103, 106, 96, 96, 97, 97, 97, 97, 97, - 100, 242, 97, 97, 99, 99, 99, 99, 99, 104, + 100, 247, 97, 97, 99, 99, 99, 99, 99, 104, 106, 99, 99, 104, 101, 100, 101, 102, 102, 102, 102, 102, 105, 105, 102, 102, 107, 107, 109, 109, 111, 112, 107, 113, 109, 115, 116, 112, 116, 117, - 117, 119, 119, 111, 240, 117, 129, 119, 113, 114, - 114, 114, 114, 114, 115, 197, 114, 114, 121, 121, + 117, 119, 119, 111, 245, 117, 129, 119, 113, 114, + 114, 114, 114, 114, 115, 198, 114, 114, 121, 121, 123, 123, 125, 125, 121, 129, 123, 134, 125, 127, - 127, 130, 130, 132, 132, 127, 135, 130, 197, 132, - 137, 137, 138, 138, 143, 134, 145, 143, 138, 228, + 127, 130, 130, 132, 132, 127, 135, 130, 198, 132, + 137, 137, 138, 138, 143, 134, 145, 143, 138, 233, 145, 146, 146, 148, 148, 135, 191, 146, 191, 148, 150, 150, 151, 151, 151, 151, 151, 152, 152, 151, 151, 157, 157, 152, 162, 162, 173, 157, 167, 167, - 162, 168, 168, 174, 174, 178, 173, 168, 179, 179, - 180, 180, 186, 186, 188, 188, 180, 198, 186, 220, - 188, 192, 192, 216, 178, 198, 198, 201, 201, 213, - 230, 217, 216, 201, 208, 208, 208, 208, 208, 227, - 231, 208, 208, 227, 213, 217, 222, 222, 224, 224, - - 232, 232, 222, 230, 224, 238, 232, 237, 237, 241, - 239, 218, 214, 211, 231, 209, 206, 199, 195, 193, - 190, 185, 177, 175, 136, 238, 239, 241, 251, 251, - 251, 251, 252, 252, 252, 253, 253, 253, 253, 254, - 254, 254, 254, 255, 93, 255, 255, 256, 256, 256, - 256, 257, 64, 257, 257, 258, 258, 258, 258, 259, - 259, 35, 259, 260, 260, 260, 260, 261, 28, 261, - 261, 262, 262, 262, 262, 263, 263, 263, 263, 264, - 264, 264, 264, 265, 265, 265, 265, 266, 266, 266, - 266, 267, 267, 267, 267, 268, 24, 268, 268, 269, - - 269, 269, 269, 270, 270, 270, 270, 271, 22, 271, - 271, 272, 272, 272, 272, 273, 17, 273, 273, 274, - 274, 274, 274, 275, 6, 275, 275, 276, 276, 276, - 276, 277, 5, 277, 277, 278, 278, 278, 278, 279, - 4, 279, 279, 280, 280, 280, 280, 281, 3, 281, - 281, 282, 282, 282, 282, 283, 0, 283, 283, 284, - 0, 284, 284, 285, 0, 285, 285, 286, 0, 286, - 286, 287, 287, 287, 287, 288, 288, 288, 288, 289, - 0, 289, 289, 290, 290, 290, 290, 291, 291, 291, - 291, 292, 0, 292, 292, 293, 293, 293, 293, 294, - - 294, 294, 294, 295, 295, 295, 295, 296, 296, 296, - 296, 297, 297, 297, 297, 298, 0, 298, 298, 299, - 299, 299, 299, 300, 300, 300, 300, 301, 0, 301, - 301, 302, 302, 302, 302, 303, 303, 303, 303, 304, - 0, 304, 304, 305, 0, 305, 305, 306, 306, 306, - 306, 307, 307, 307, 307, 250, 250, 250, 250, 250, - 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, - 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, - 250, 250, 250, 250, 250, 250, 250, 250, 250 + 162, 168, 168, 174, 174, 220, 173, 168, 178, 178, + 179, 179, 180, 180, 186, 186, 188, 188, 180, 220, + 186, 199, 188, 192, 192, 202, 202, 216, 178, 199, + 199, 202, 209, 209, 209, 209, 209, 219, 235, 209, + 209, 232, 216, 225, 225, 232, 219, 227, 227, 225, + + 236, 237, 237, 227, 242, 242, 243, 237, 230, 244, + 246, 235, 223, 221, 217, 214, 212, 210, 207, 200, + 197, 195, 193, 190, 236, 244, 243, 185, 246, 256, + 256, 256, 256, 257, 257, 257, 258, 258, 258, 258, + 259, 259, 259, 259, 260, 177, 260, 260, 261, 261, + 261, 261, 262, 175, 262, 262, 263, 263, 263, 263, + 264, 264, 136, 264, 265, 265, 265, 265, 266, 93, + 266, 266, 267, 267, 267, 267, 268, 268, 268, 268, + 269, 269, 269, 269, 270, 270, 270, 270, 271, 271, + 271, 271, 272, 272, 272, 272, 273, 64, 273, 273, + + 274, 274, 274, 274, 275, 275, 275, 275, 276, 35, + 276, 276, 277, 277, 277, 277, 278, 28, 278, 278, + 279, 279, 279, 279, 280, 24, 280, 280, 281, 281, + 281, 281, 282, 22, 282, 282, 283, 283, 283, 283, + 284, 17, 284, 284, 285, 285, 285, 285, 286, 6, + 286, 286, 287, 287, 287, 287, 288, 5, 288, 288, + 289, 4, 289, 289, 290, 3, 290, 290, 291, 0, + 291, 291, 292, 292, 292, 292, 293, 293, 293, 293, + 294, 0, 294, 294, 295, 295, 295, 295, 296, 296, + 296, 296, 297, 0, 297, 297, 298, 298, 298, 298, + + 299, 299, 299, 299, 300, 300, 300, 300, 301, 301, + 301, 301, 302, 302, 302, 302, 303, 303, 303, 303, + 304, 0, 304, 304, 305, 305, 305, 305, 306, 306, + 306, 306, 307, 0, 307, 307, 308, 308, 308, 308, + 309, 309, 309, 309, 310, 310, 310, 310, 311, 0, + 311, 311, 312, 0, 312, 312, 313, 313, 313, 313, + 314, 314, 314, 314, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 255, 255, 255 + } ; #define YY_TRAILING_MASK 0x2000 @@ -883,7 +890,7 @@ static int vdev_and_devtype(DiskParseContext *dpc, char *str) { #define DPC ((DiskParseContext*)yyextra) -#line 887 "libxlu_disk_l.c" +#line 894 "libxlu_disk_l.c" #define INITIAL 0 #define LEXERR 1 @@ -1124,7 +1131,7 @@ YY_DECL /*----- the scanner rules which do the parsing -----*/ -#line 1128 "libxlu_disk_l.c" +#line 1135 "libxlu_disk_l.c" if ( !yyg->yy_init ) { @@ -1188,14 +1195,14 @@ yy_match: while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 251 ) + if ( yy_current_state >= 256 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; *yyg->yy_state_ptr++ = yy_current_state; ++yy_cp; } - while ( yy_current_state != 250 ); + while ( yy_current_state != 255 ); yy_find_action: yy_current_state = *--yyg->yy_state_ptr; @@ -1286,48 +1293,54 @@ case 8: /* rule 8 can match eol */ YY_RULE_SETUP #line 171 "libxlu_disk_l.l" -{ STRIP(','); setbackendtype(DPC,FROMEQUALS); } +{ STRIP(','); SAVESTRING("backend", backend_domname, FROMEQUALS); } YY_BREAK case 9: /* rule 9 can match eol */ YY_RULE_SETUP -#line 173 "libxlu_disk_l.l" -{ STRIP(','); SAVESTRING("vdev", vdev, FROMEQUALS); } +#line 172 "libxlu_disk_l.l" +{ STRIP(','); setbackendtype(DPC,FROMEQUALS); } YY_BREAK case 10: /* rule 10 can match eol */ YY_RULE_SETUP #line 174 "libxlu_disk_l.l" +{ STRIP(','); SAVESTRING("vdev", vdev, FROMEQUALS); } + YY_BREAK +case 11: +/* rule 11 can match eol */ +YY_RULE_SETUP +#line 175 "libxlu_disk_l.l" { STRIP(','); SAVESTRING("script", script, FROMEQUALS); } YY_BREAK /* the target magic parameter, eats the rest of the string */ -case 11: +case 12: YY_RULE_SETUP -#line 178 "libxlu_disk_l.l" +#line 179 "libxlu_disk_l.l" { STRIP(','); SAVESTRING("target", pdev_path, FROMEQUALS); } YY_BREAK /* unknown parameters */ -case 12: -/* rule 12 can match eol */ +case 13: +/* rule 13 can match eol */ YY_RULE_SETUP -#line 182 "libxlu_disk_l.l" +#line 183 "libxlu_disk_l.l" { xlu__disk_err(DPC,yytext,"unknown parameter"); } YY_BREAK /* deprecated prefixes */ /* the "/.*" in these patterns ensures that they count as if they * matched the whole string, so these patterns take precedence */ -case 13: +case 14: YY_RULE_SETUP -#line 189 "libxlu_disk_l.l" +#line 190 "libxlu_disk_l.l" { STRIP(':'); DPC->had_depr_prefix=1; DEPRECATE("use `[format=]...,'"); setformat(DPC, yytext); } YY_BREAK -case 14: +case 15: YY_RULE_SETUP -#line 195 "libxlu_disk_l.l" +#line 196 "libxlu_disk_l.l" { char *newscript; STRIP(':'); @@ -1341,30 +1354,22 @@ YY_RULE_SETUP free(newscript); } YY_BREAK -case 15: +case 16: *yy_cp = yyg->yy_hold_char; /* undo effects of setting up yytext */ yyg->yy_c_buf_p = yy_cp = yy_bp + 8; YY_DO_BEFORE_ACTION; /* set up yytext again */ YY_RULE_SETUP -#line 208 "libxlu_disk_l.l" -{ DPC->had_depr_prefix=1; DEPRECATE(0); } - YY_BREAK -case 16: -YY_RULE_SETUP #line 209 "libxlu_disk_l.l" { DPC->had_depr_prefix=1; DEPRECATE(0); } YY_BREAK case 17: -*yy_cp = yyg->yy_hold_char; /* undo effects of setting up yytext */ -yyg->yy_c_buf_p = yy_cp = yy_bp + 4; -YY_DO_BEFORE_ACTION; /* set up yytext again */ YY_RULE_SETUP #line 210 "libxlu_disk_l.l" { DPC->had_depr_prefix=1; DEPRECATE(0); } YY_BREAK case 18: *yy_cp = yyg->yy_hold_char; /* undo effects of setting up yytext */ -yyg->yy_c_buf_p = yy_cp = yy_bp + 6; +yyg->yy_c_buf_p = yy_cp = yy_bp + 4; YY_DO_BEFORE_ACTION; /* set up yytext again */ YY_RULE_SETUP #line 211 "libxlu_disk_l.l" @@ -1372,7 +1377,7 @@ YY_RULE_SETUP YY_BREAK case 19: *yy_cp = yyg->yy_hold_char; /* undo effects of setting up yytext */ -yyg->yy_c_buf_p = yy_cp = yy_bp + 5; +yyg->yy_c_buf_p = yy_cp = yy_bp + 6; YY_DO_BEFORE_ACTION; /* set up yytext again */ YY_RULE_SETUP #line 212 "libxlu_disk_l.l" @@ -1380,26 +1385,34 @@ YY_RULE_SETUP YY_BREAK case 20: *yy_cp = yyg->yy_hold_char; /* undo effects of setting up yytext */ -yyg->yy_c_buf_p = yy_cp = yy_bp + 4; +yyg->yy_c_buf_p = yy_cp = yy_bp + 5; YY_DO_BEFORE_ACTION; /* set up yytext again */ YY_RULE_SETUP #line 213 "libxlu_disk_l.l" { DPC->had_depr_prefix=1; DEPRECATE(0); } YY_BREAK case 21: -/* rule 21 can match eol */ +*yy_cp = yyg->yy_hold_char; /* undo effects of setting up yytext */ +yyg->yy_c_buf_p = yy_cp = yy_bp + 4; +YY_DO_BEFORE_ACTION; /* set up yytext again */ +YY_RULE_SETUP +#line 214 "libxlu_disk_l.l" +{ DPC->had_depr_prefix=1; DEPRECATE(0); } + YY_BREAK +case 22: +/* rule 22 can match eol */ YY_RULE_SETUP -#line 215 "libxlu_disk_l.l" +#line 216 "libxlu_disk_l.l" { xlu__disk_err(DPC,yytext,"unknown deprecated disk prefix"); return 0; } YY_BREAK /* positional parameters */ -case 22: -/* rule 22 can match eol */ +case 23: +/* rule 23 can match eol */ YY_RULE_SETUP -#line 222 "libxlu_disk_l.l" +#line 223 "libxlu_disk_l.l" { STRIP(','); @@ -1426,27 +1439,27 @@ YY_RULE_SETUP } } YY_BREAK -case 23: +case 24: YY_RULE_SETUP -#line 248 "libxlu_disk_l.l" +#line 249 "libxlu_disk_l.l" { BEGIN(LEXERR); yymore(); } YY_BREAK -case 24: +case 25: YY_RULE_SETUP -#line 252 "libxlu_disk_l.l" +#line 253 "libxlu_disk_l.l" { xlu__disk_err(DPC,yytext,"bad disk syntax"); return 0; } YY_BREAK -case 25: +case 26: YY_RULE_SETUP -#line 255 "libxlu_disk_l.l" +#line 256 "libxlu_disk_l.l" YY_FATAL_ERROR( "flex scanner jammed" ); YY_BREAK -#line 1450 "libxlu_disk_l.c" +#line 1463 "libxlu_disk_l.c" case YY_STATE_EOF(INITIAL): case YY_STATE_EOF(LEXERR): yyterminate(); @@ -1710,7 +1723,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner) while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 251 ) + if ( yy_current_state >= 256 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; @@ -1734,11 +1747,11 @@ static int yy_get_next_buffer (yyscan_t yyscanner) while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 251 ) + if ( yy_current_state >= 256 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; - yy_is_jam = (yy_current_state == 250); + yy_is_jam = (yy_current_state == 255); if ( ! yy_is_jam ) *yyg->yy_state_ptr++ = yy_current_state; @@ -2538,4 +2551,4 @@ void xlu__disk_yyfree (void * ptr , yyscan_t yyscanner) #define YYTABLES_NAME "yytables" -#line 255 "libxlu_disk_l.l" +#line 256 "libxlu_disk_l.l" diff --git a/tools/libxl/libxlu_disk_l.h b/tools/libxl/libxlu_disk_l.h index de039081b0..0176249fa4 100644 --- a/tools/libxl/libxlu_disk_l.h +++ b/tools/libxl/libxlu_disk_l.h @@ -344,7 +344,7 @@ extern int xlu__disk_yylex (yyscan_t yyscanner); #undef YY_DECL #endif -#line 255 "libxlu_disk_l.l" +#line 256 "libxlu_disk_l.l" #line 350 "libxlu_disk_l.h" #undef xlu__disk_yyIN_HEADER diff --git a/tools/libxl/libxlu_disk_l.l b/tools/libxl/libxlu_disk_l.l index bee16a10d0..7c4e7f1b65 100644 --- a/tools/libxl/libxlu_disk_l.l +++ b/tools/libxl/libxlu_disk_l.l @@ -168,6 +168,7 @@ devtype=disk,? { DPC->disk->is_cdrom = 0; } devtype=[^,]*,? { xlu__disk_err(DPC,yytext,"unknown value for type"); } access=[^,]*,? { STRIP(','); setaccess(DPC, FROMEQUALS); } +backend=[^,]*,? { STRIP(','); SAVESTRING("backend", backend_domname, FROMEQUALS); } backendtype=[^,]*,? { STRIP(','); setbackendtype(DPC,FROMEQUALS); } vdev=[^,]*,? { STRIP(','); SAVESTRING("vdev", vdev, FROMEQUALS); } diff --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c index 87d189d8bf..c1a969b80c 100644 --- a/tools/libxl/xl_cmdimpl.c +++ b/tools/libxl/xl_cmdimpl.c @@ -162,29 +162,6 @@ static int qualifier_to_id(const char *p, uint32_t *id_r) return 1; } -static int domain_qualifier_to_domid(const char *p, uint32_t *domid_r, - int *was_name_r) -{ - int was_name, rc; - - was_name = qualifier_to_id(p, domid_r); - if (was_name_r) - *was_name_r = was_name; - - if (was_name) { - rc = libxl_name_to_domid(ctx, p, domid_r); - if (rc) - return rc; - } else { - rc = libxl_domain_info(ctx, NULL, *domid_r); - /* error only if domain does not exist */ - if (rc == ERROR_INVAL) - return rc; - } - - return 0; -} - static int cpupool_qualifier_to_cpupoolid(const char *p, uint32_t *poolid_r, int *was_name_r) { @@ -199,14 +176,14 @@ static uint32_t find_domain(const char *p) __attribute__((warn_unused_result)); static uint32_t find_domain(const char *p) { uint32_t domid; - int rc, was_name; + int rc; - rc = domain_qualifier_to_domid(p, &domid, &was_name); + rc = libxl_domain_qualifier_to_domid(ctx, p, &domid); if (rc) { fprintf(stderr, "%s is an invalid domain identifier (rc=%d)\n", p, rc); exit(2); } - common_domname = was_name ? p : libxl_domid_to_name(ctx, domid); + common_domname = libxl_domid_to_name(ctx, domid); return domid; } @@ -1097,12 +1074,7 @@ static void parse_config_data(const char *config_source, break; *p2 = '\0'; if (!strcmp(p, "backend")) { - if(domain_qualifier_to_domid(p2 + 1, &(vtpm->backend_domid), 0)) - { - fprintf(stderr, - "Specified vtpm backend domain `%s' does not exist!\n", p2 + 1); - exit(1); - } + vtpm->backend_domname = strdup(p2 + 1); got_backend = true; } else if(!strcmp(p, "uuid")) { if( libxl_uuid_from_string(&vtpm->uuid, p2 + 1) ) { @@ -1202,17 +1174,7 @@ static void parse_config_data(const char *config_source, free(nic->ifname); nic->ifname = strdup(p2 + 1); } else if (!strcmp(p, "backend")) { - if(libxl_name_to_domid(ctx, (p2 + 1), &(nic->backend_domid))) { - fprintf(stderr, "Specified backend domain does not exist, defaulting to Dom0\n"); - nic->backend_domid = 0; - } - if (nic->backend_domid != 0 && run_hotplug_scripts) { - fprintf(stderr, "ERROR: the vif 'backend=' option " - "cannot be used in conjunction with " - "run_hotplug_scripts, please set " - "run_hotplug_scripts to 0 in xl.conf\n"); - exit(EXIT_FAILURE); - } + nic->backend_domname = strdup(p2 + 1); } else if (!strcmp(p, "rate")) { parse_vif_rate(&config, (p2 + 1), nic); } else if (!strcmp(p, "accel")) { @@ -2558,8 +2520,6 @@ static void cd_insert(uint32_t domid, const char *virtdev, char *phys) parse_disk_config(&config, buf, &disk); - disk.backend_domid = 0; - libxl_cdrom_insert(ctx, domid, &disk, NULL); libxl_device_disk_dispose(&disk); @@ -5596,11 +5556,7 @@ int main_networkattach(int argc, char **argv) } else if (MATCH_OPTION("script", *argv, oparg)) { replace_string(&nic.script, oparg); } else if (MATCH_OPTION("backend", *argv, oparg)) { - if(libxl_name_to_domid(ctx, oparg, &val)) { - fprintf(stderr, "Specified backend domain does not exist, defaulting to Dom0\n"); - val = 0; - } - nic.backend_domid = val; + replace_string(&nic.backend_domname, oparg); } else if (MATCH_OPTION("vifname", *argv, oparg)) { replace_string(&nic.ifname, oparg); } else if (MATCH_OPTION("model", *argv, oparg)) { @@ -5705,15 +5661,15 @@ int main_networkdetach(int argc, char **argv) int main_blockattach(int argc, char **argv) { int opt; - uint32_t fe_domid, be_domid = 0; - libxl_device_disk disk = { 0 }; + uint32_t fe_domid; + libxl_device_disk disk; XLU_Config *config = 0; SWITCH_FOREACH_OPT(opt, "", NULL, "block-attach", 2) { /* No options */ } - if (domain_qualifier_to_domid(argv[optind], &fe_domid, 0) < 0) { + if (libxl_domain_qualifier_to_domid(ctx, argv[optind], &fe_domid) < 0) { fprintf(stderr, "%s is an invalid domain identifier\n", argv[optind]); return 1; } @@ -5722,8 +5678,6 @@ int main_blockattach(int argc, char **argv) parse_disk_config_multistring (&config, argc-optind, (const char* const*)argv + optind, &disk); - disk.backend_domid = be_domid; - if (dryrun_only) { char *json = libxl_device_disk_to_json(ctx, &disk); printf("disk: %s\n", json); @@ -5753,7 +5707,7 @@ int main_blocklist(int argc, char **argv) "Vdev", "BE", "handle", "state", "evt-ch", "ring-ref", "BE-path"); for (argv += optind, argc -= optind; argc > 0; --argc, ++argv) { uint32_t domid; - if (domain_qualifier_to_domid(*argv, &domid, 0) < 0) { + if (libxl_domain_qualifier_to_domid(ctx, *argv, &domid) < 0) { fprintf(stderr, "%s is an invalid domain identifier\n", *argv); continue; } @@ -5805,14 +5759,13 @@ int main_vtpmattach(int argc, char **argv) int opt; libxl_device_vtpm vtpm; char *oparg; - unsigned int val; uint32_t domid; SWITCH_FOREACH_OPT(opt, "", NULL, "vtpm-attach", 1) { /* No options */ } - if (domain_qualifier_to_domid(argv[optind], &domid, 0) < 0) { + if (libxl_domain_qualifier_to_domid(ctx, argv[optind], &domid) < 0) { fprintf(stderr, "%s is an invalid domain identifier\n", argv[optind]); return 1; } @@ -5826,12 +5779,7 @@ int main_vtpmattach(int argc, char **argv) return 1; } } else if (MATCH_OPTION("backend", *argv, oparg)) { - if(domain_qualifier_to_domid(oparg, &val, 0)) { - fprintf(stderr, - "Specified backend domain does not exist, defaulting to Dom0\n"); - val = 0; - } - vtpm.backend_domid = val; + replace_string(&vtpm.backend_domname, oparg); } else { fprintf(stderr, "unrecognized argument `%s'\n", *argv); return 1; @@ -5871,7 +5819,7 @@ int main_vtpmlist(int argc, char **argv) "Idx", "BE", "Uuid", "handle", "state", "evt-ch", "ring-ref", "BE-path"); for (argv += optind, argc -= optind; argc > 0; --argc, ++argv) { uint32_t domid; - if (domain_qualifier_to_domid(*argv, &domid, 0) < 0) { + if (libxl_domain_qualifier_to_domid(ctx, *argv, &domid) < 0) { fprintf(stderr, "%s is an invalid domain identifier\n", *argv); continue; } @@ -6779,7 +6727,7 @@ int main_cpupoolmigrate(int argc, char **argv) dom = argv[optind++]; pool = argv[optind]; - if (domain_qualifier_to_domid(dom, &domid, NULL) || + if (libxl_domain_qualifier_to_domid(ctx, dom, &domid) || !libxl_domid_to_name(ctx, domid)) { fprintf(stderr, "unknown domain \'%s\'\n", dom); return -ERROR_FAIL; -- cgit v1.2.3