tap: Convert tap_set_sndbuf() to Error
Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Message-id: 1431691143-1015-8-git-send-email-armbru@redhat.com Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
This commit is contained in:
parent
a8a21be985
commit
80b832c300
@ -32,9 +32,8 @@ int tap_open(char *ifname, int ifname_size, int *vnet_hdr,
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int tap_set_sndbuf(int fd, const NetdevTapOptions *tap)
|
void tap_set_sndbuf(int fd, const NetdevTapOptions *tap, Error **errp)
|
||||||
{
|
{
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int tap_probe_vnet_hdr(int fd)
|
int tap_probe_vnet_hdr(int fd)
|
||||||
|
@ -176,9 +176,8 @@ error:
|
|||||||
}
|
}
|
||||||
#endif /* __FreeBSD__ */
|
#endif /* __FreeBSD__ */
|
||||||
|
|
||||||
int tap_set_sndbuf(int fd, const NetdevTapOptions *tap)
|
void tap_set_sndbuf(int fd, const NetdevTapOptions *tap, Error **errp)
|
||||||
{
|
{
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int tap_probe_vnet_hdr(int fd)
|
int tap_probe_vnet_hdr(int fd)
|
||||||
|
@ -32,9 +32,8 @@ int tap_open(char *ifname, int ifname_size, int *vnet_hdr,
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int tap_set_sndbuf(int fd, const NetdevTapOptions *tap)
|
void tap_set_sndbuf(int fd, const NetdevTapOptions *tap, Error **errp)
|
||||||
{
|
{
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int tap_probe_vnet_hdr(int fd)
|
int tap_probe_vnet_hdr(int fd)
|
||||||
|
@ -126,7 +126,7 @@ int tap_open(char *ifname, int ifname_size, int *vnet_hdr,
|
|||||||
*/
|
*/
|
||||||
#define TAP_DEFAULT_SNDBUF 0
|
#define TAP_DEFAULT_SNDBUF 0
|
||||||
|
|
||||||
int tap_set_sndbuf(int fd, const NetdevTapOptions *tap)
|
void tap_set_sndbuf(int fd, const NetdevTapOptions *tap, Error **errp)
|
||||||
{
|
{
|
||||||
int sndbuf;
|
int sndbuf;
|
||||||
|
|
||||||
@ -139,10 +139,8 @@ int tap_set_sndbuf(int fd, const NetdevTapOptions *tap)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (ioctl(fd, TUNSETSNDBUF, &sndbuf) == -1 && tap->has_sndbuf) {
|
if (ioctl(fd, TUNSETSNDBUF, &sndbuf) == -1 && tap->has_sndbuf) {
|
||||||
error_report("TUNSETSNDBUF ioctl failed: %s", strerror(errno));
|
error_setg_errno(errp, errno, "TUNSETSNDBUF ioctl failed");
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int tap_probe_vnet_hdr(int fd)
|
int tap_probe_vnet_hdr(int fd)
|
||||||
|
@ -198,9 +198,8 @@ int tap_open(char *ifname, int ifname_size, int *vnet_hdr,
|
|||||||
return fd;
|
return fd;
|
||||||
}
|
}
|
||||||
|
|
||||||
int tap_set_sndbuf(int fd, const NetdevTapOptions *tap)
|
void tap_set_sndbuf(int fd, const NetdevTapOptions *tap, Error **errp)
|
||||||
{
|
{
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int tap_probe_vnet_hdr(int fd)
|
int tap_probe_vnet_hdr(int fd)
|
||||||
|
@ -610,7 +610,9 @@ static int net_init_tap_one(const NetdevTapOptions *tap, NetClientState *peer,
|
|||||||
TAPState *s = net_tap_fd_init(peer, model, name, fd, vnet_hdr);
|
TAPState *s = net_tap_fd_init(peer, model, name, fd, vnet_hdr);
|
||||||
int vhostfd;
|
int vhostfd;
|
||||||
|
|
||||||
if (tap_set_sndbuf(s->fd, tap) < 0) {
|
tap_set_sndbuf(s->fd, tap, &err);
|
||||||
|
if (err) {
|
||||||
|
error_report_err(err);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -34,7 +34,7 @@ int tap_open(char *ifname, int ifname_size, int *vnet_hdr,
|
|||||||
|
|
||||||
ssize_t tap_read_packet(int tapfd, uint8_t *buf, int maxlen);
|
ssize_t tap_read_packet(int tapfd, uint8_t *buf, int maxlen);
|
||||||
|
|
||||||
int tap_set_sndbuf(int fd, const NetdevTapOptions *tap);
|
void tap_set_sndbuf(int fd, const NetdevTapOptions *tap, Error **errp);
|
||||||
int tap_probe_vnet_hdr(int fd);
|
int tap_probe_vnet_hdr(int fd);
|
||||||
int tap_probe_vnet_hdr_len(int fd, int len);
|
int tap_probe_vnet_hdr_len(int fd, int len);
|
||||||
int tap_probe_has_ufo(int fd);
|
int tap_probe_has_ufo(int fd);
|
||||||
|
Loading…
Reference in New Issue
Block a user