diff options
author | Laszlo Ersek <lersek@redhat.com> | 2012-07-17 16:17:19 +0200 |
---|---|---|
committer | Stefan Hajnoczi <stefanha@linux.vnet.ibm.com> | 2012-07-23 11:55:18 +0100 |
commit | 08c573a8d14893518df412c68541aae5b7091982 (patch) | |
tree | eaf5cf5a59f740f9929781c7bf2a2dcf79aaf06f /net/tap-linux.c | |
parent | 4a917c39aed9ad7f648c435204a6586c4ca3f2f2 (diff) | |
download | qemu-08c573a8d14893518df412c68541aae5b7091982.zip qemu-08c573a8d14893518df412c68541aae5b7091982.tar.gz qemu-08c573a8d14893518df412c68541aae5b7091982.tar.bz2 |
convert net_init_tap() to NetClientOptions
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Diffstat (limited to 'net/tap-linux.c')
-rw-r--r-- | net/tap-linux.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/net/tap-linux.c b/net/tap-linux.c index 41d581b..c6521be 100644 --- a/net/tap-linux.c +++ b/net/tap-linux.c @@ -98,16 +98,19 @@ int tap_open(char *ifname, int ifname_size, int *vnet_hdr, int vnet_hdr_required */ #define TAP_DEFAULT_SNDBUF 0 -int tap_set_sndbuf(int fd, QemuOpts *opts) +int tap_set_sndbuf(int fd, const NetdevTapOptions *tap) { int sndbuf; - sndbuf = qemu_opt_get_size(opts, "sndbuf", TAP_DEFAULT_SNDBUF); + sndbuf = !tap->has_sndbuf ? TAP_DEFAULT_SNDBUF : + tap->sndbuf > INT_MAX ? INT_MAX : + tap->sndbuf; + if (!sndbuf) { sndbuf = INT_MAX; } - if (ioctl(fd, TUNSETSNDBUF, &sndbuf) == -1 && qemu_opt_get(opts, "sndbuf")) { + if (ioctl(fd, TUNSETSNDBUF, &sndbuf) == -1 && tap->has_sndbuf) { error_report("TUNSETSNDBUF ioctl failed: %s", strerror(errno)); return -1; } |