qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH RFC v6 12/20] virtio: disallow late feature chan


From: Stefan Hajnoczi
Subject: Re: [Qemu-devel] [PATCH RFC v6 12/20] virtio: disallow late feature changes for virtio-1
Date: Tue, 20 Jan 2015 11:14:21 +0000
User-agent: Mutt/1.5.23 (2014-03-12)

On Fri, Dec 12, 2014 at 12:25:47PM +0100, Thomas Huth wrote:
> On Fri, 12 Dec 2014 12:18:25 +0100
> Cornelia Huck <address@hidden> wrote:
> 
> > On Fri, 12 Dec 2014 11:55:38 +0100
> > Thomas Huth <address@hidden> wrote:
> > 
> > > On Thu, 11 Dec 2014 14:25:14 +0100
> > > Cornelia Huck <address@hidden> wrote:
> > > 
> > > > For virtio-1 devices, the driver must not attempt to set feature bits
> > > > after it set FEATURES_OK in the device status. Simply reject it in
> > > > that case.
> > > > 
> > > > Signed-off-by: Cornelia Huck <address@hidden>
> > > > ---
> > > >  hw/virtio/virtio.c         |   16 ++++++++++++++--
> > > >  include/hw/virtio/virtio.h |    2 ++
> > > >  2 files changed, 16 insertions(+), 2 deletions(-)
> > > > 
> > > > diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c
> > > > index 57190ba..a3dd67b 100644
> > > > --- a/hw/virtio/virtio.c
> > > > +++ b/hw/virtio/virtio.c
> > > > @@ -978,7 +978,7 @@ void virtio_save(VirtIODevice *vdev, QEMUFile *f)
> > > >      vmstate_save_state(f, &vmstate_virtio, vdev);
> > > >  }
> > > > 
> > > > -int virtio_set_features(VirtIODevice *vdev, uint64_t val)
> > > > +static int __virtio_set_features(VirtIODevice *vdev, uint64_t val)
> > > 
> > > Maybe avoid the double underscores here? But unfortunately, I also fail
> > > to come up with a better suggestion for a name here ...
> > 
> > virtio_set_features_nocheck()?
> 
> Sounds ok to me.
> 
> > This function is only called within virtio.c anyway...
> 
> Right, so the double underscores should be ok here, too. (I still do
> not like them very much, but that's just my personal taste in this case)

C99 "7.1.3 Reserved identifiers" says:

  All identifiers that begin with an underscore and either an uppercase
  letter or another underscore are always reserved for any use

[by the standard library]

You can use a trailing underscore or useless word like "do", e.g.
virtio_do_set_features(), for internal functions.

Attachment: pgpJ65On3pZzH.pgp
Description: PGP signature


reply via email to

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