qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Amit Shah <amit.shah@redhat.com>
To: Markus Armbruster <armbru@redhat.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>,
	qemu list <qemu-devel@nongnu.org>,
	Juan Quintela <quintela@redhat.com>
Subject: Re: [Qemu-devel] [RFC PATCH 1/3] qdev: Add a description field for qdev properties for documentation
Date: Fri, 28 May 2010 18:27:29 +0530	[thread overview]
Message-ID: <20100528125729.GA9122@amit-laptop.redhat.com> (raw)
In-Reply-To: <m3sk5cfaxo.fsf@blackfin.pond.sub.org>

On (Fri) May 28 2010 [14:49:39], Markus Armbruster wrote:
> Amit Shah <amit.shah@redhat.com> writes:
> 
> > Add a 'description' along with each qdev property to document the input
> > each qdev property takes.
> >
> > Signed-off-by: Amit Shah <amit.shah@redhat.com>
> 
> I always wanted this, and never got around to code it up.  Thanks!

Cool, thanks!

> [...]
> > diff --git a/block_int.h b/block_int.h
> > index 1a7240c..767cd29 100644
> > --- a/block_int.h
> > +++ b/block_int.h
> > @@ -231,12 +231,12 @@ static inline unsigned int get_physical_block_exp(BlockConf *conf)
> >  }
> >  
> >  #define DEFINE_BLOCK_PROPERTIES(_state, _conf)                          \
> > -    DEFINE_PROP_DRIVE("drive", _state, _conf.dinfo),                    \
> > +    DEFINE_PROP_DRIVE("drive", _state, _conf.dinfo, ""),                \
> >      DEFINE_PROP_UINT16("logical_block_size", _state,                    \
> > -                       _conf.logical_block_size, 512),                  \
> > +                       _conf.logical_block_size, 512, ""),              \
> >      DEFINE_PROP_UINT16("physical_block_size", _state,                   \
> > -                       _conf.physical_block_size, 512),                 \
> > -    DEFINE_PROP_UINT16("min_io_size", _state, _conf.min_io_size, 512),  \
> > -    DEFINE_PROP_UINT32("opt_io_size", _state, _conf.opt_io_size, 512)
> > +                       _conf.physical_block_size, 512, ""),             \
> > +    DEFINE_PROP_UINT16("min_io_size", _state, _conf.min_io_size, 512, ""), \
> > +    DEFINE_PROP_UINT32("opt_io_size", _state, _conf.opt_io_size, 512, "")
> 
> NULL feels more natural than "" for missing description.

"" is shorter than NULL, which surprisingly saves quite a few line
splits to keep them below 80 chars wide.

Also, the hope is to quickly fill them all out with descriptions in
follow-up patches, so this shouldn't be a big issue.

> [...]
> > diff --git a/hw/qdev.c b/hw/qdev.c
> > index af17486..2cd205b 100644
> > --- a/hw/qdev.c
> > +++ b/hw/qdev.c
> > @@ -187,7 +187,8 @@ int qdev_device_help(QemuOpts *opts)
> >          if (!prop->info->parse) {
> >              continue;           /* no way to set it, don't show */
> >          }
> > -        error_printf("%s.%s=%s\n", info->name, prop->name, prop->info->name);
> > +        error_printf("%s.%s=%s, %s\n", info->name, prop->name,
> > +                     prop->info->name, prop->desc ?: "");
> 
> The ?: operator a gcc extension.  Do we care?

Again, this is shorter and we're already using lots of gcc extensions..

		Amit

      reply	other threads:[~2010-05-28 12:55 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-28  9:57 [Qemu-devel] [RFC PATCH 1/3] qdev: Add a description field for qdev properties for documentation Amit Shah
2010-05-28  9:57 ` [Qemu-devel] [RFC PATCH 2/3] virtio-serial: Add description fields for qdev properties Amit Shah
2010-05-28 12:50   ` Markus Armbruster
2010-05-28 12:58     ` Amit Shah
2010-05-28  9:57 ` [Qemu-devel] [RFC PATCH 3/3] net.h: Add description fields for qdev properites Amit Shah
2010-05-28 12:50   ` Markus Armbruster
2010-05-28 12:59     ` Amit Shah
2010-05-28 13:45       ` Markus Armbruster
2010-05-28 12:49 ` [Qemu-devel] [RFC PATCH 1/3] qdev: Add a description field for qdev properties for documentation Markus Armbruster
2010-05-28 12:57   ` Amit Shah [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20100528125729.GA9122@amit-laptop.redhat.com \
    --to=amit.shah@redhat.com \
    --cc=armbru@redhat.com \
    --cc=kraxel@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=quintela@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).