On Wed, Apr 19, 2017 at 05:43:42PM +0800, Fam Zheng wrote: > This function tries to request, if not granted yet, for the given > permissions. > > Signed-off-by: Fam Zheng <f...@redhat.com> > --- > block/block-backend.c | 12 ++++++++++++ > include/sysemu/block-backend.h | 1 + > 2 files changed, 13 insertions(+) > > diff --git a/block/block-backend.c b/block/block-backend.c > index 7405024..6bdd9ce 100644 > --- a/block/block-backend.c > +++ b/block/block-backend.c > @@ -629,6 +629,18 @@ void blk_resume_after_migration(Error **errp) > } > } > > +int blk_request_perm(BlockBackend *blk, uint64_t perm, Error **errp) > +{ > + uint64_t blk_perm, shared_perm; > + > + blk_get_perm(blk, &blk_perm, &shared_perm); > + if ((blk_perm & perm) == perm) { > + return 0; > + } > + blk_perm |= perm; > + return blk_set_perm(blk, blk_perm, shared_perm, errp); > +}
I'm slightly confused about why this function is needed. blk_set_perm() doesn't do quite the right thing?
signature.asc
Description: PGP signature