diff options
Diffstat (limited to 'tools/libxl/libxl_utils.c')
-rw-r--r-- | tools/libxl/libxl_utils.c | 69 |
1 files changed, 0 insertions, 69 deletions
diff --git a/tools/libxl/libxl_utils.c b/tools/libxl/libxl_utils.c index 37c50f2500..678c9eebd2 100644 --- a/tools/libxl/libxl_utils.c +++ b/tools/libxl/libxl_utils.c @@ -570,75 +570,6 @@ out: return rc; } -int libxl_devid_to_device_net2(libxl_ctx *ctx, uint32_t domid, - const char *devid, libxl_device_net2 *net2) -{ - libxl__gc gc = LIBXL_INIT_GC(ctx); - char *tok, *endptr, *val; - char *dompath, *net2path, *be_path; - unsigned int devid_n, i; - int rc = ERROR_INVAL; - - devid_n = strtoul(devid, &endptr, 10); - if (devid == endptr) { - goto out; - } - rc = ERROR_FAIL; - dompath = libxl__xs_get_dompath(&gc, domid); - net2path = libxl__sprintf(&gc, "%s/device/vif2/%s", dompath, devid); - if (!net2path) { - goto out; - } - memset(net2, 0, sizeof (libxl_device_net2)); - be_path = libxl__xs_read(&gc, XBT_NULL, libxl__sprintf(&gc, "%s/backend", net2path)); - - net2->devid = devid_n; - val = libxl__xs_read(&gc, XBT_NULL, libxl__sprintf(&gc, "%s/mac", net2path)); - for (i = 0, tok = strtok(val, ":"); tok && (i < 6); - ++i, tok = strtok(NULL, ":")) { - net2->front_mac[i] = strtoul(tok, NULL, 16); - } - val = libxl__xs_read(&gc, XBT_NULL, libxl__sprintf(&gc, "%s/remote-mac", net2path)); - for (i = 0, tok = strtok(val, ":"); tok && (i < 6); - ++i, tok = strtok(NULL, ":")) { - net2->back_mac[i] = strtoul(tok, NULL, 16); - } - val = libxl__xs_read(&gc, XBT_NULL, libxl__sprintf(&gc, "%s/backend-id", net2path)); - net2->backend_domid = strtoul(val, NULL, 10); - - net2->domid = domid; - val = libxl__xs_read(&gc, XBT_NULL, libxl__sprintf(&gc, "%s/remote-trusted", be_path)); - net2->trusted = strtoul(val, NULL, 10); - val = libxl__xs_read(&gc, XBT_NULL, libxl__sprintf(&gc, "%s/local-trusted", be_path)); - net2->back_trusted = strtoul(val, NULL, 10); - val = libxl__xs_read(&gc, XBT_NULL, libxl__sprintf(&gc, "%s/filter-mac", be_path)); - net2->filter_mac = strtoul(val, NULL, 10); - val = libxl__xs_read(&gc, XBT_NULL, libxl__sprintf(&gc, "%s/filter-mac", net2path)); - net2->front_filter_mac = strtoul(val, NULL, 10); - val = libxl__xs_read(&gc, XBT_NULL, libxl__sprintf(&gc, "%s/max-bypasses", be_path)); - net2->max_bypasses = strtoul(val, NULL, 10); - rc = 0; - -out: - libxl__free_all(&gc); - return rc; -} - -int libxl_strtomac(const char *mac_s, uint8_t *mac) -{ - const char *end = mac_s + 17; - char val, *endptr; - - for (; mac_s < end; mac_s += 3, ++mac) { - val = strtoul(mac_s, &endptr, 16); - if (endptr != (mac_s + 2)) { - return ERROR_INVAL; - } - *mac = val; - } - return 0; -} - #define QEMU_VERSION_STR "QEMU emulator version " |