qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Anthony Liguori <anthony@codemonkey.ws>
To: Stefan Berger <stefanb@linux.vnet.ibm.com>
Cc: stefanha@gmail.com,
	"qemu-devel@nongnu.org" <qemu-devel@nongnu.org>,
	mst@redhat.com
Subject: Re: [Qemu-devel] [PATCH v2] Move filedescriptor parsing code from net.c into qemu_parse_fd()
Date: Tue, 01 Nov 2011 17:19:26 -0500	[thread overview]
Message-ID: <4EB0706E.7070107@redhat.com> (raw)
In-Reply-To: <1317206492.21121.3.camel@d941e-10>

On 09/28/2011 05:41 AM, Stefan Berger wrote:
> Move the parsing of a filedescriptor into a common function
> qemu_parse_fd() so others can use it as well. Have net.c call this
> function.
>
> v2:
>   - moving qemu_parse_fd into cutils.c
>
> Signed-off-by: Stefan Berger<stefanb@linux.vnet.ibm.com>

Applied.  Thanks.

Regards,

Anthony Liguori

>
> ---
>   cutils.c      |   12 ++++++++++++
>   net.c         |    7 +------
>   qemu-common.h |    1 +
>   3 files changed, 14 insertions(+), 6 deletions(-)
>
> Index: qemu-git.pt/net.c
> ===================================================================
> --- qemu-git.pt.orig/net.c
> +++ qemu-git.pt/net.c
> @@ -733,12 +733,7 @@ int net_handle_fd_param(Monitor *mon, co
>               return -1;
>           }
>       } else {
> -        char *endptr = NULL;
> -
> -        fd = strtol(param,&endptr, 10);
> -        if (*endptr || (fd == 0&&  param == endptr)) {
> -            return -1;
> -        }
> +        fd = qemu_parse_fd(param);
>       }
>
>       return fd;
> Index: qemu-git.pt/qemu-common.h
> ===================================================================
> --- qemu-git.pt.orig/qemu-common.h
> +++ qemu-git.pt/qemu-common.h
> @@ -143,6 +143,7 @@ time_t mktimegm(struct tm *tm);
>   int qemu_fls(int i);
>   int qemu_fdatasync(int fd);
>   int fcntl_setfl(int fd, int flag);
> +int qemu_parse_fd(const char *param);
>
>   /*
>    * strtosz() suffixes used to specify the default treatment of an
> Index: qemu-git.pt/cutils.c
> ===================================================================
> --- qemu-git.pt.orig/cutils.c
> +++ qemu-git.pt/cutils.c
> @@ -415,3 +415,15 @@ int64_t strtosz(const char *nptr, char *
>   {
>       return strtosz_suffix(nptr, end, STRTOSZ_DEFSUFFIX_MB);
>   }
> +
> +int qemu_parse_fd(const char *param)
> +{
> +    int fd;
> +    char *endptr = NULL;
> +
> +    fd = strtol(param,&endptr, 10);
> +    if (*endptr || (fd == 0&&  param == endptr)) {
> +        return -1;
> +    }
> +    return fd;
> +}
>
>
>

      reply	other threads:[~2011-11-01 22:19 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-28 10:41 [Qemu-devel] [PATCH v2] Move filedescriptor parsing code from net.c into qemu_parse_fd() Stefan Berger
2011-11-01 22:19 ` Anthony Liguori [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=4EB0706E.7070107@redhat.com \
    --to=anthony@codemonkey.ws \
    --cc=mst@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanb@linux.vnet.ibm.com \
    --cc=stefanha@gmail.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).