qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH for-2.10 5/9] block: introduce bdrv_try_set_read


From: Stefan Hajnoczi
Subject: Re: [Qemu-devel] [PATCH for-2.10 5/9] block: introduce bdrv_try_set_read_only()
Date: Fri, 7 Apr 2017 10:18:22 +0100
User-agent: Mutt/1.8.0 (2017-02-23)

On Wed, Apr 05, 2017 at 08:23:12PM -0400, Jeff Cody wrote:
> On Wed, Apr 05, 2017 at 04:28:44PM -0400, John Snow wrote:
> > On 04/05/2017 02:28 PM, Jeff Cody wrote:
> > > diff --git a/include/block/block.h b/include/block/block.h
> > > index beb563a..0049b57 100644
> > > --- a/include/block/block.h
> > > +++ b/include/block/block.h
> > > @@ -426,6 +426,7 @@ int bdrv_is_allocated_above(BlockDriverState *top, 
> > > BlockDriverState *base,
> > >                              int64_t sector_num, int nb_sectors, int 
> > > *pnum);
> > >  
> > >  bool bdrv_is_read_only(BlockDriverState *bs);
> > > +int bdrv_try_set_read_only(BlockDriverState *bs, bool read_only, Error 
> > > **errp);
> > >  int bdrv_set_read_only(BlockDriverState *bs, bool read_only, Error 
> > > **errp);
> > >  bool bdrv_is_sg(BlockDriverState *bs);
> > >  bool bdrv_is_inserted(BlockDriverState *bs);
> > > 
> > 
> > Maybe I'm just green, but I find it weird that the function is named
> > try_x when we aren't actually trying to do anything, we're checking to
> > see if we can.
> 
> Yeah, not a good name.  Maybe bdrv_set_read_only_test() or
> bdrv_test_set_read_only()?

This one reads nicely:

  if (bdrv_can_set_read_only(...)) {
      ...
  }

Attachment: signature.asc
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]