static char *pcibus_get_dev_path(DeviceState *dev)

{

    PCIDevice *d = container_of(dev, PCIDevice, qdev);

    PCIDevice *t;

    int slot_depth;

    /* Path format: Domain:00:Slot.Function:Slot.Function....:Slot.Function.

     * 00 is added here to make this format compatible with

     * domain:Bus:Slot.Func for systems without nested PCI bridges.

     * Slot.Function list specifies the slot and function numbers for all

     * devices on the path from root to the specific device. */

    int domain_len = strlen("DDDD:00");

    int slot_len = strlen(":SS.F");

    int path_len;

    char *path, *p;



    /* Calculate # of slots on path between device and root. */;

    slot_depth = 0;

    for (t = d; t; t = t->bus->parent_dev) {

        ++slot_depth;

    }



    path_len = domain_len + slot_len * slot_depth;



    /* Allocate memory, fill in the terminating null byte. */

    path = malloc(path_len + 1 /* For '\0' */);

    path[path_len] = '\0';



    /* First field is the domain. */

    snprintf(path, domain_len, "%04x:00", pci_find_domain(d->bus));



    /* Fill in slot numbers. We walk up from device to root, so need to print

     * them in the reverse order, last to first. */

    p = path + path_len;

    for (t = d; t; t = t->bus->parent_dev) {

        p -= slot_len;

        snprintf(p, slot_len, ":%02x.%x", PCI_SLOT(t->devfn), PCI_FUNC(d->devfn));

    }



    return path;

}

static char *pcibus_get_dev_path(DeviceState *dev)

{

    PCIDevice *d = container_of(dev, PCIDevice, qdev);

    PCIDevice *t;

    int slot_depth;

    









    int domain_len = strlen("DDDD:00");

    int slot_len = strlen(":SS.F");

    int path_len;

    char *path, *p;



    ;

    slot_depth = 0;

    for (t = d; t; t = t->bus->parent_dev) {

        ++slot_depth;

    }



    path_len = domain_len + slot_len * slot_depth;



    

    path = malloc(path_len + 1 );

    path[path_len] = '\0';



    

    snprintf(path, domain_len, "%04x:00", pci_find_domain(d->bus));



    



    p = path + path_len;

    for (t = d; t; t = t->bus->parent_dev) {

        p -= slot_len;

        snprintf(p, slot_len, ":%02x.%x", PCI_SLOT(t->devfn), PCI_FUNC(d->devfn));

    }



    return path;

}

static char *FUNC_0(DeviceState *VAR_0)

{

    PCIDevice *d = container_of(VAR_0, PCIDevice, qdev);

    PCIDevice *t;

    int VAR_1;

    









    int VAR_2 = strlen("DDDD:00");

    int VAR_3 = strlen(":SS.F");

    int VAR_4;

    char *VAR_5, *VAR_6;



    ;

    VAR_1 = 0;

    for (t = d; t; t = t->bus->parent_dev) {

        ++VAR_1;

    }



    VAR_4 = VAR_2 + VAR_3 * VAR_1;



    

    VAR_5 = malloc(VAR_4 + 1 );

    VAR_5[VAR_4] = '\0';



    

    snprintf(VAR_5, VAR_2, "%04x:00", pci_find_domain(d->bus));



    



    VAR_6 = VAR_5 + VAR_4;

    for (t = d; t; t = t->bus->parent_dev) {

        VAR_6 -= VAR_3;

        snprintf(VAR_6, VAR_3, ":%02x.%x", PCI_SLOT(t->devfn), PCI_FUNC(d->devfn));

    }



    return VAR_5;

}

static char *FUNC_0(DeviceState *VAR_0)
{ PCIDevice *d = container_of(VAR_0, PCIDevice, qdev); PCIDevice *t; int VAR_1; int VAR_2 = strlen("DDDD:00"); int VAR_3 = strlen(":SS.F"); int VAR_4; char *VAR_5, *VAR_6; ; VAR_1 = 0; for (t = d; t; t = t->bus->parent_dev) { ++VAR_1; } VAR_4 = VAR_2 + VAR_3 * VAR_1; VAR_5 = malloc(VAR_4 + 1 ); VAR_5[VAR_4] = '\0'; snprintf(VAR_5, VAR_2, "%04x:00", pci_find_domain(d->bus)); VAR_6 = VAR_5 + VAR_4; for (t = d; t; t = t->bus->parent_dev) { VAR_6 -= VAR_3; snprintf(VAR_6, VAR_3, ":%02x.%x", PCI_SLOT(t->devfn), PCI_FUNC(d->devfn)); } return VAR_5; }