static int qcow_open(struct tcmu_device *dev)
{
	struct bdev *bdev;
	char *config;

	bdev = calloc(1, sizeof(*bdev));
	if (!bdev)
		return -1;

	tcmu_set_dev_private(dev, bdev);

	bdev->block_size = tcmu_get_dev_block_size(dev);
	bdev->size = tcmu_get_device_size(dev);
	if (bdev->size < 0) {
		tcmu_err("Could not get device size\n");
		goto err;
	}

	config = strchr(tcmu_get_dev_cfgstring(dev), '/');
	if (!config) {
		tcmu_err("no configuration found in cfgstring\n");
		goto err;
	}
	config += 1; /* get past '/' */

	tcmu_dbg("%s\n", tcmu_get_dev_cfgstring(dev));
	tcmu_dbg("%s\n", config);

	if (bdev_open(bdev, AT_FDCWD, config, O_RDWR) == -1)
		goto err;
	return 0;
err:
	free(bdev);
	return -1;
}
static int qcow_open(struct tcmu_device *dev)
{
	struct bdev *bdev;
	char *config;

	bdev = calloc(1, sizeof(*bdev));
	if (!bdev)
		return -1;

	tcmu_set_dev_private(dev, bdev);

	bdev->block_size = tcmu_get_dev_block_size(dev);
	bdev->size = tcmu_get_device_size(dev);
	if (bdev->size < 0) {
		tcmu_err("Could not get device size\n");
		goto err;
	}

	config = strchr(tcmu_get_dev_cfgstring(dev), '/');
	if (!config) {
		tcmu_err("no configuration found in cfgstring\n");
		goto err;
	}
	config += 1;  

	tcmu_dbg("%s\n", tcmu_get_dev_cfgstring(dev));
	tcmu_dbg("%s\n", config);

	if (bdev_open(bdev, AT_FDCWD, config, O_RDWR) == -1)
		goto err;
	return 0;
err:
	free(bdev);
	return -1;
}