if (drv->bdrv_file_open) {
if (file != NULL) {
bdrv_swap(file, bs);
if (bs->file != file) {
g_free(file->opaque);
file->opaque = NULL;
}
ret = 0;
} else {
ret = drv->bdrv_file_open(bs, filename, open_flags);
/* remove from list, if necessary */
bdrv_make_anon(bs);
bdrv_close(bs);
if (bs->opaque)
assert(bs != bs_snapshots);
g_free(bs);