static int parse_drive(DeviceState *dev, const char *str, void **ptr) { BlockDriverState *bs; bs = bdrv_find(str); if (bs == NULL) return -ENOENT; if (bdrv_attach_dev(bs, dev) < 0) return -EEXIST; *ptr = bs; return 0; }
static int parse_drive(DeviceState *dev, Property *prop, const char *str) { BlockDriverState **ptr = qdev_get_prop_ptr(dev, prop); BlockDriverState *bs; bs = bdrv_find(str); if (bs == NULL) return -ENOENT; if (bdrv_attach_dev(bs, dev) < 0) return -EEXIST; *ptr = bs; return 0; }