[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH V12 7/8] Move parsing of filedescriptor into common
From: |
Stefan Berger |
Subject: |
[Qemu-devel] [PATCH V12 7/8] Move parsing of filedescriptor into common function |
Date: |
Tue, 11 Oct 2011 13:32:23 -0400 |
User-agent: |
quilt/0.48-1 |
Move the parsing of a filedescriptor into a common function qemu_parse_fd().
Have the code in net.c call this function.
Signed-off-by: Stefan Berger <address@hidden>
---
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;
+}
- [Qemu-devel] [PATCH V12 0/8] Qemu Trusted Platform Module (TPM) integration, Stefan Berger, 2011/10/11
- [Qemu-devel] [PATCH V12 2/8] Add TPM (frontend) hardware interface (TPM TIS) to Qemu, Stefan Berger, 2011/10/11
- [Qemu-devel] [PATCH V12 8/8] Add fd parameter for TPM passthrough driver, Stefan Berger, 2011/10/11
- [Qemu-devel] [PATCH V12 3/8] Add a debug register, Stefan Berger, 2011/10/11
- [Qemu-devel] [PATCH V12 1/8] Support for TPM command line options, Stefan Berger, 2011/10/11
- [Qemu-devel] [PATCH V12 7/8] Move parsing of filedescriptor into common function,
Stefan Berger <=
- [Qemu-devel] [PATCH V12 4/8] Build the TPM frontend code, Stefan Berger, 2011/10/11
- [Qemu-devel] [PATCH V12 6/8] Introduce --enable-tpm-passthrough configure option, Stefan Berger, 2011/10/11
- [Qemu-devel] [PATCH V12 5/8] Add a TPM Passthrough backend driver implementation, Stefan Berger, 2011/10/11