static void xenstore_update_be(char *watch, char *type, int dom,

                               struct XenDevOps *ops)

{

    struct XenDevice *xendev;

    char path[XEN_BUFSIZE], *dom0, *bepath;

    unsigned int len, dev;



    dom0 = xs_get_domain_path(xenstore, 0);

    len = snprintf(path, sizeof(path), "%s/backend/%s/%d", dom0, type, dom);

    free(dom0);

    if (strncmp(path, watch, len) != 0) {

        return;

    }

    if (sscanf(watch+len, "/%u/%255s", &dev, path) != 2) {

        strcpy(path, "");

        if (sscanf(watch+len, "/%u", &dev) != 1) {

            dev = -1;

        }

    }

    if (dev == -1) {

        return;

    }



    xendev = xen_be_get_xendev(type, dom, dev, ops);

    if (xendev != NULL) {

        bepath = xs_read(xenstore, 0, xendev->be, &len);

        if (bepath == NULL) {

            xen_be_del_xendev(dom, dev);

        } else {

            free(bepath);

            xen_be_backend_changed(xendev, path);

            xen_be_check_state(xendev);

        }

    }

}

static void xenstore_update_be(char *watch, char *type, int dom,

                               struct XenDevOps *ops)

{

    struct XenDevice *xendev;

    char path[XEN_BUFSIZE], *dom0, *bepath;

    unsigned int len, dev;



    dom0 = xs_get_domain_path(xenstore, 0);

    len = snprintf(path, sizeof(path), "%s/backend/%s/%d", dom0, type, dom);

    free(dom0);

    if (strncmp(path, watch, len) != 0) {

        return;

    }

    if (sscanf(watch+len, "/%u/%255s", &dev, path) != 2) {

        strcpy(path, "");

        if (sscanf(watch+len, "/%u", &dev) != 1) {

            dev = -1;

        }

    }

    if (dev == -1) {

        return;

    }



    xendev = xen_be_get_xendev(type, dom, dev, ops);

    if (xendev != NULL) {

        bepath = xs_read(xenstore, 0, xendev->be, &len);

        if (bepath == NULL) {

            xen_be_del_xendev(dom, dev);

        } else {

            free(bepath);

            xen_be_backend_changed(xendev, path);

            xen_be_check_state(xendev);

        }

    }

}

    dom0 = xs_get_domain_path(xenstore, 0);     free(dom0);     dom0 = xs_get_domain_path(xenstore, 0);     free(dom0);     char path[XEN_BUFSIZE], *dom0, *bepath;     dom0 = xs_get_domain_path(xenstore, 0);     len = snprintf(path, sizeof(path), "%s/backend/%s/%d", dom0, type, dom);     free(dom0);
static void FUNC_0(char *VAR_0, char *VAR_1, int VAR_2,

                               struct XenDevOps *VAR_3)

{

    struct XenDevice *VAR_4;

    char VAR_5[XEN_BUFSIZE], *dom0, *bepath;

    unsigned int VAR_6, VAR_7;



    dom0 = xs_get_domain_path(xenstore, 0);

    VAR_6 = snprintf(VAR_5, sizeof(VAR_5), "%s/backend/%s/%d", dom0, VAR_1, VAR_2);

    free(dom0);

    if (strncmp(VAR_5, VAR_0, VAR_6) != 0) {

        return;

    }

    if (sscanf(VAR_0+VAR_6, "/%u/%255s", &VAR_7, VAR_5) != 2) {

        strcpy(VAR_5, "");

        if (sscanf(VAR_0+VAR_6, "/%u", &VAR_7) != 1) {

            VAR_7 = -1;

        }

    }

    if (VAR_7 == -1) {

        return;

    }



    VAR_4 = xen_be_get_xendev(VAR_1, VAR_2, VAR_7, VAR_3);

    if (VAR_4 != NULL) {

        bepath = xs_read(xenstore, 0, VAR_4->be, &VAR_6);

        if (bepath == NULL) {

            xen_be_del_xendev(VAR_2, VAR_7);

        } else {

            free(bepath);

            xen_be_backend_changed(VAR_4, VAR_5);

            xen_be_check_state(VAR_4);

        }

    }

}

static void FUNC_0(char *VAR_0, char *VAR_1, int VAR_2,
struct XenDevOps *VAR_3)
{ struct XenDevice *VAR_4; char VAR_5[XEN_BUFSIZE], *dom0, *bepath; unsigned int VAR_6, VAR_7; dom0 = xs_get_domain_path(xenstore, 0); VAR_6 = snprintf(VAR_5, sizeof(VAR_5), "%s/backend/%s/%d", dom0, VAR_1, VAR_2); free(dom0); if (strncmp(VAR_5, VAR_0, VAR_6) != 0) { return; } if (sscanf(VAR_0+VAR_6, "/%u/%255s", &VAR_7, VAR_5) != 2) { strcpy(VAR_5, ""); if (sscanf(VAR_0+VAR_6, "/%u", &VAR_7) != 1) { VAR_7 = -1; } } if (VAR_7 == -1) { return; } VAR_4 = xen_be_get_xendev(VAR_1, VAR_2, VAR_7, VAR_3); if (VAR_4 != NULL) { bepath = xs_read(xenstore, 0, VAR_4->be, &VAR_6); if (bepath == NULL) { xen_be_del_xendev(VAR_2, VAR_7); } else { free(bepath); xen_be_backend_changed(VAR_4, VAR_5); xen_be_check_state(VAR_4); } } }