Loading block/block-backend.c +19 −0 Original line number Diff line number Diff line Loading @@ -559,6 +559,25 @@ void *blk_get_attached_dev(BlockBackend *blk) return blk->dev; } /* * Return the BlockBackend which has the device model @dev attached if it * exists, else null. * * @dev must not be null. */ BlockBackend *blk_by_dev(void *dev) { BlockBackend *blk = NULL; assert(dev != NULL); while ((blk = blk_all_next(blk)) != NULL) { if (blk->dev == dev) { return blk; } } return NULL; } /* * Set @blk's device model callbacks to @ops. * @opaque is the opaque argument to pass to the callbacks. Loading include/sysemu/block-backend.h +1 −0 Original line number Diff line number Diff line Loading @@ -111,6 +111,7 @@ int blk_attach_dev(BlockBackend *blk, void *dev); void blk_attach_dev_nofail(BlockBackend *blk, void *dev); void blk_detach_dev(BlockBackend *blk, void *dev); void *blk_get_attached_dev(BlockBackend *blk); BlockBackend *blk_by_dev(void *dev); void blk_set_dev_ops(BlockBackend *blk, const BlockDevOps *ops, void *opaque); int blk_pread_unthrottled(BlockBackend *blk, int64_t offset, uint8_t *buf, int count); Loading Loading
block/block-backend.c +19 −0 Original line number Diff line number Diff line Loading @@ -559,6 +559,25 @@ void *blk_get_attached_dev(BlockBackend *blk) return blk->dev; } /* * Return the BlockBackend which has the device model @dev attached if it * exists, else null. * * @dev must not be null. */ BlockBackend *blk_by_dev(void *dev) { BlockBackend *blk = NULL; assert(dev != NULL); while ((blk = blk_all_next(blk)) != NULL) { if (blk->dev == dev) { return blk; } } return NULL; } /* * Set @blk's device model callbacks to @ops. * @opaque is the opaque argument to pass to the callbacks. Loading
include/sysemu/block-backend.h +1 −0 Original line number Diff line number Diff line Loading @@ -111,6 +111,7 @@ int blk_attach_dev(BlockBackend *blk, void *dev); void blk_attach_dev_nofail(BlockBackend *blk, void *dev); void blk_detach_dev(BlockBackend *blk, void *dev); void *blk_get_attached_dev(BlockBackend *blk); BlockBackend *blk_by_dev(void *dev); void blk_set_dev_ops(BlockBackend *blk, const BlockDevOps *ops, void *opaque); int blk_pread_unthrottled(BlockBackend *blk, int64_t offset, uint8_t *buf, int count); Loading