@@ -4191,3 +4191,27 @@ BlockAcctStats *bdrv_get_stats(BlockDriverState *bs)
{
return &bs->stats;
}
+
+void bdrv_connect(BlockDriverState *bs, Error **errp)
+{
+ BlockDriver *drv = bs->drv;
+
+ if (drv && drv->bdrv_connect) {
+ drv->bdrv_connect(bs, errp);
+ } else if (bs->file) {
+ bdrv_connect(bs->file, errp);
+ } else {
+ error_setg(errp, "this feature or command is not currently supported");
+ }
+}
+
+void bdrv_disconnect(BlockDriverState *bs)
+{
+ BlockDriver *drv = bs->drv;
+
+ if (drv && drv->bdrv_disconnect) {
+ drv->bdrv_disconnect(bs);
+ } else if (bs->file) {
+ bdrv_disconnect(bs->file);
+ }
+}
@@ -592,4 +592,7 @@ void bdrv_flush_io_queue(BlockDriverState *bs);
BlockAcctStats *bdrv_get_stats(BlockDriverState *bs);
+void bdrv_connect(BlockDriverState *bs, Error **errp);
+void bdrv_disconnect(BlockDriverState *bs);
+
#endif
@@ -290,6 +290,9 @@ struct BlockDriver {
*/
int (*bdrv_probe_geometry)(BlockDriverState *bs, HDGeometry *geo);
+ void (*bdrv_connect)(BlockDriverState *bs, Error **errp);
+ void (*bdrv_disconnect)(BlockDriverState *bs);
+
QLIST_ENTRY(BlockDriver) list;
};