static int ide_qdev_init(DeviceState *qdev, DeviceInfo *base)

{

    IDEDevice *dev = DO_UPCAST(IDEDevice, qdev, qdev);

    IDEDeviceInfo *info = DO_UPCAST(IDEDeviceInfo, qdev, base);

    IDEBus *bus = DO_UPCAST(IDEBus, qbus, qdev->parent_bus);



    if (!dev->conf.bs) {

        fprintf(stderr, "%s: no drive specified\n", qdev->info->name);

        goto err;

    }

    if (dev->unit == -1) {

        dev->unit = bus->master ? 1 : 0;

    }

    switch (dev->unit) {

    case 0:

        if (bus->master) {

            fprintf(stderr, "ide: tried to assign master twice\n");

            goto err;

        }

        bus->master = dev;

        break;

    case 1:

        if (bus->slave) {

            fprintf(stderr, "ide: tried to assign slave twice\n");

            goto err;

        }

        bus->slave = dev;

        break;

    default:

        goto err;

    }

    return info->init(dev);



err:

    return -1;

}

static int ide_qdev_init(DeviceState *qdev, DeviceInfo *base)

{

    IDEDevice *dev = DO_UPCAST(IDEDevice, qdev, qdev);

    IDEDeviceInfo *info = DO_UPCAST(IDEDeviceInfo, qdev, base);

    IDEBus *bus = DO_UPCAST(IDEBus, qbus, qdev->parent_bus);



    if (!dev->conf.bs) {

        fprintf(stderr, "%s: no drive specified\n", qdev->info->name);

        goto err;

    }

    if (dev->unit == -1) {

        dev->unit = bus->master ? 1 : 0;

    }

    switch (dev->unit) {

    case 0:

        if (bus->master) {

            fprintf(stderr, "ide: tried to assign master twice\n");

            goto err;

        }

        bus->master = dev;

        break;

    case 1:

        if (bus->slave) {

            fprintf(stderr, "ide: tried to assign slave twice\n");

            goto err;

        }

        bus->slave = dev;

        break;

    default:

        goto err;

    }

    return info->init(dev);



err:

    return -1;

}

        fprintf(stderr, "%s: no drive specified\n", qdev->info->name);             fprintf(stderr, "ide: tried to assign master twice\n");             fprintf(stderr, "ide: tried to assign slave twice\n");
static int FUNC_0(DeviceState *VAR_0, DeviceInfo *VAR_1)

{

    IDEDevice *dev = DO_UPCAST(IDEDevice, VAR_0, VAR_0);

    IDEDeviceInfo *info = DO_UPCAST(IDEDeviceInfo, VAR_0, VAR_1);

    IDEBus *bus = DO_UPCAST(IDEBus, qbus, VAR_0->parent_bus);



    if (!dev->conf.bs) {

        fprintf(stderr, "%s: no drive specified\n", VAR_0->info->name);

        goto err;

    }

    if (dev->unit == -1) {

        dev->unit = bus->master ? 1 : 0;

    }

    switch (dev->unit) {

    case 0:

        if (bus->master) {

            fprintf(stderr, "ide: tried to assign master twice\n");

            goto err;

        }

        bus->master = dev;

        break;

    case 1:

        if (bus->slave) {

            fprintf(stderr, "ide: tried to assign slave twice\n");

            goto err;

        }

        bus->slave = dev;

        break;

    default:

        goto err;

    }

    return info->init(dev);



err:

    return -1;

}

static int FUNC_0(DeviceState *VAR_0, DeviceInfo *VAR_1)
{ IDEDevice *dev = DO_UPCAST(IDEDevice, VAR_0, VAR_0); IDEDeviceInfo *info = DO_UPCAST(IDEDeviceInfo, VAR_0, VAR_1); IDEBus *bus = DO_UPCAST(IDEBus, qbus, VAR_0->parent_bus); if (!dev->conf.bs) { fprintf(stderr, "%s: no drive specified\n", VAR_0->info->name); goto err; } if (dev->unit == -1) { dev->unit = bus->master ? 1 : 0; } switch (dev->unit) { case 0:
if (bus->master) { fprintf(stderr, "ide: tried to assign master twice\n"); goto err; } bus->master = dev; break; case 1:
if (bus->slave) { fprintf(stderr, "ide: tried to assign slave twice\n"); goto err; } bus->slave = dev; break; default:
goto err; } return info->init(dev); err:
return -1; }