qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Eric Blake <eblake@redhat.com>
To: Greg Kurz <groug@kaod.org>, qemu-devel@nongnu.org
Cc: "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>
Subject: Re: [Qemu-devel] [PATCH 3/8] 9pfs: fix P9_NOTAG and P9_NOFID macros
Date: Fri, 9 Dec 2016 15:25:55 -0600	[thread overview]
Message-ID: <85cb0570-87e5-8396-dd04-eb6400226278@redhat.com> (raw)
In-Reply-To: <148127568042.2633.5084932697061472826.stgit@bahia>

[-- Attachment #1: Type: text/plain, Size: 1294 bytes --]

On 12/09/2016 03:28 AM, Greg Kurz wrote:
> The u16 and u32 types don't exist in QEMU common headers. It never broke
> build because these two macros aren't use by the current code, but this
> is about to change with the future addition of functional tests for 9P.
> 
> This patch convert the types to uintXX_t.
> 
> Signed-off-by: Greg Kurz <groug@kaod.org>
> ---
>  hw/9pfs/9p.h |    4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/hw/9pfs/9p.h b/hw/9pfs/9p.h
> index 3976b7fe3dcd..89c904bdb7e7 100644
> --- a/hw/9pfs/9p.h
> +++ b/hw/9pfs/9p.h
> @@ -99,8 +99,8 @@ enum p9_proto_version {
>      V9FS_PROTO_2000L = 0x02,
>  };
>  
> -#define P9_NOTAG    (u16)(~0)
> -#define P9_NOFID    (u32)(~0)
> +#define P9_NOTAG    (uint16_t)(~0)
> +#define P9_NOFID    (uint32_t)(~0)

Don't you want to write ((uint16_t)(~0)), to ensure that this expression
can be used as a drop-in in any other syntactical situation?

Or even write it as UINT16_C(~0) (using <stdint.h>), or as UINT16_MAX.
(Be aware: the type of (uint16_t)(~0) is uint16_t, while the type of
UINT16_MAX is int, due to the rules of integer promotion, if that matters)

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]

  reply	other threads:[~2016-12-09 21:26 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-09  9:27 [Qemu-devel] [PATCH 0/8] tests: add 9P functional tests Greg Kurz
2016-12-09  9:27 ` [Qemu-devel] [PATCH 1/8] tests: virtio-9p: rename PCI configuration test Greg Kurz
2016-12-09  9:27 ` [Qemu-devel] [PATCH 2/8] tests: virtio-9p: code refactoring Greg Kurz
2016-12-09  9:28 ` [Qemu-devel] [PATCH 3/8] 9pfs: fix P9_NOTAG and P9_NOFID macros Greg Kurz
2016-12-09 21:25   ` Eric Blake [this message]
2016-12-10 13:57     ` Greg Kurz
2016-12-10 16:24       ` Eric Blake
2016-12-10 23:03         ` Greg Kurz
2016-12-09  9:28 ` [Qemu-devel] [PATCH 4/8] tests: virtio-9p: add version operation test Greg Kurz
2016-12-09  9:28 ` [Qemu-devel] [PATCH 5/8] tests: virtio-9p: add attach " Greg Kurz
2016-12-09  9:28 ` [Qemu-devel] [PATCH 6/8] tests: virtio-9p: add walk " Greg Kurz
2016-12-09  9:28 ` [Qemu-devel] [PATCH 7/8] tests: virtio-9p: no slash in path elements during walk Greg Kurz
2016-12-09  9:28 ` [Qemu-devel] [PATCH 8/8] tests: virtio-9p: ".." cannot be used to walk out of the shared directory Greg Kurz

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=85cb0570-87e5-8396-dd04-eb6400226278@redhat.com \
    --to=eblake@redhat.com \
    --cc=aneesh.kumar@linux.vnet.ibm.com \
    --cc=groug@kaod.org \
    --cc=qemu-devel@nongnu.org \
    /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).