From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:59214) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RLMg8-0000qX-Kl for qemu-devel@nongnu.org; Tue, 01 Nov 2011 18:19:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RLMg7-00006J-GH for qemu-devel@nongnu.org; Tue, 01 Nov 2011 18:19:32 -0400 Received: from mail-gx0-f173.google.com ([209.85.161.173]:54672) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RLMg7-000067-Cc for qemu-devel@nongnu.org; Tue, 01 Nov 2011 18:19:31 -0400 Received: by ggnr5 with SMTP id r5so9293090ggn.4 for ; Tue, 01 Nov 2011 15:19:30 -0700 (PDT) Message-ID: <4EB0706E.7070107@redhat.com> Date: Tue, 01 Nov 2011 17:19:26 -0500 From: Anthony Liguori MIME-Version: 1.0 References: <1317206492.21121.3.camel@d941e-10> In-Reply-To: <1317206492.21121.3.camel@d941e-10> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v2] Move filedescriptor parsing code from net.c into qemu_parse_fd() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Stefan Berger Cc: stefanha@gmail.com, "qemu-devel@nongnu.org" , mst@redhat.com 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 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; > +} > > >