* pc-bios/optionrom/Makefile fix for -O0
* revert socket_connect change -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.22 (GNU/Linux) iQEcBAABAgAGBQJXxZoLAAoJEL/70l94x66DM9IH/Ag/UarGm6QqutzIcjSVA0rg 6UepD/QFDXY6vsHeEkQdljW3j8uoYQ6ni2p8KNX1VRhe4n/y6awHL/kFhowC1vQZ Y1KK0tPiLF4eetpksbb3kXFAU/sthSCr+qc3dTNH6B3SoEeC5Y61eVL0KH1uHJOv 4MiHZ4tb2sPhIIdI1feX3RwDR5YdBJFzRzElmxKR8ea4bmHtRnJfZXa/D831ctt8 FbVN1OeVVEQiLumn1g7nRW5ivqkJmXEK4gMTfO4T5k/lnFQI9Fg/vP7HevtPHX1w y9QCYIFP+XVowB+OM6fThD5t7L+BGV6/7N078SdjQxNfUclkaiTABIqDJS0sGu4= =rFtH -----END PGP SIGNATURE----- Merge remote-tracking branch 'remotes/bonzini/tags/for-upstream' into staging * pc-bios/optionrom/Makefile fix for -O0 * revert socket_connect change # gpg: Signature made Tue 30 Aug 2016 15:36:59 BST # gpg: using RSA key 0xBFFBD25F78C7AE83 # gpg: Good signature from "Paolo Bonzini <bonzini@gnu.org>" # gpg: aka "Paolo Bonzini <pbonzini@redhat.com>" # Primary key fingerprint: 46F5 9FBD 57D6 12E7 BFD4 E2F7 7E15 100C CD36 69B1 # Subkey fingerprint: F133 3857 4B66 2389 866C 7682 BFFB D25F 78C7 AE83 * remotes/bonzini/tags/for-upstream: optionrom: cope with multiple -O options Revert "Change net/socket.c to use socket_*() functions" Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
commit
2b294f6b65
55
net/socket.c
55
net/socket.c
@ -489,30 +489,41 @@ static int net_socket_listen_init(NetClientState *peer,
|
|||||||
{
|
{
|
||||||
NetClientState *nc;
|
NetClientState *nc;
|
||||||
NetSocketState *s;
|
NetSocketState *s;
|
||||||
SocketAddress *saddr;
|
struct sockaddr_in saddr;
|
||||||
int ret;
|
int fd, ret;
|
||||||
Error *local_error = NULL;
|
|
||||||
|
|
||||||
saddr = socket_parse(host_str, &local_error);
|
if (parse_host_port(&saddr, host_str) < 0)
|
||||||
if (saddr == NULL) {
|
return -1;
|
||||||
error_report_err(local_error);
|
|
||||||
|
fd = qemu_socket(PF_INET, SOCK_STREAM, 0);
|
||||||
|
if (fd < 0) {
|
||||||
|
perror("socket");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
qemu_set_nonblock(fd);
|
||||||
|
|
||||||
ret = socket_listen(saddr, &local_error);
|
socket_set_fast_reuse(fd);
|
||||||
|
|
||||||
|
ret = bind(fd, (struct sockaddr *)&saddr, sizeof(saddr));
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
error_report_err(local_error);
|
perror("bind");
|
||||||
|
closesocket(fd);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
ret = listen(fd, 0);
|
||||||
|
if (ret < 0) {
|
||||||
|
perror("listen");
|
||||||
|
closesocket(fd);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
nc = qemu_new_net_client(&net_socket_info, peer, model, name);
|
nc = qemu_new_net_client(&net_socket_info, peer, model, name);
|
||||||
s = DO_UPCAST(NetSocketState, nc, nc);
|
s = DO_UPCAST(NetSocketState, nc, nc);
|
||||||
s->fd = -1;
|
s->fd = -1;
|
||||||
s->listen_fd = ret;
|
s->listen_fd = fd;
|
||||||
s->nc.link_down = true;
|
s->nc.link_down = true;
|
||||||
|
|
||||||
qemu_set_fd_handler(s->listen_fd, net_socket_accept, NULL, s);
|
qemu_set_fd_handler(s->listen_fd, net_socket_accept, NULL, s);
|
||||||
qapi_free_SocketAddress(saddr);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -523,15 +534,10 @@ static int net_socket_connect_init(NetClientState *peer,
|
|||||||
{
|
{
|
||||||
NetSocketState *s;
|
NetSocketState *s;
|
||||||
int fd, connected, ret;
|
int fd, connected, ret;
|
||||||
char *addr_str;
|
struct sockaddr_in saddr;
|
||||||
SocketAddress *saddr;
|
|
||||||
Error *local_error = NULL;
|
|
||||||
|
|
||||||
saddr = socket_parse(host_str, &local_error);
|
if (parse_host_port(&saddr, host_str) < 0)
|
||||||
if (saddr == NULL) {
|
|
||||||
error_report_err(local_error);
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
|
||||||
|
|
||||||
fd = qemu_socket(PF_INET, SOCK_STREAM, 0);
|
fd = qemu_socket(PF_INET, SOCK_STREAM, 0);
|
||||||
if (fd < 0) {
|
if (fd < 0) {
|
||||||
@ -539,9 +545,10 @@ static int net_socket_connect_init(NetClientState *peer,
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
qemu_set_nonblock(fd);
|
qemu_set_nonblock(fd);
|
||||||
|
|
||||||
connected = 0;
|
connected = 0;
|
||||||
for(;;) {
|
for(;;) {
|
||||||
ret = socket_connect(saddr, &local_error, NULL, NULL);
|
ret = connect(fd, (struct sockaddr *)&saddr, sizeof(saddr));
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
if (errno == EINTR || errno == EWOULDBLOCK) {
|
if (errno == EINTR || errno == EWOULDBLOCK) {
|
||||||
/* continue */
|
/* continue */
|
||||||
@ -550,7 +557,7 @@ static int net_socket_connect_init(NetClientState *peer,
|
|||||||
errno == EINVAL) {
|
errno == EINVAL) {
|
||||||
break;
|
break;
|
||||||
} else {
|
} else {
|
||||||
error_report_err(local_error);
|
perror("connect");
|
||||||
closesocket(fd);
|
closesocket(fd);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -562,15 +569,9 @@ static int net_socket_connect_init(NetClientState *peer,
|
|||||||
s = net_socket_fd_init(peer, model, name, fd, connected);
|
s = net_socket_fd_init(peer, model, name, fd, connected);
|
||||||
if (!s)
|
if (!s)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
addr_str = socket_address_to_string(saddr, &local_error);
|
|
||||||
if (addr_str == NULL)
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
snprintf(s->nc.info_str, sizeof(s->nc.info_str),
|
snprintf(s->nc.info_str, sizeof(s->nc.info_str),
|
||||||
"socket: connect to %s", addr_str);
|
"socket: connect to %s:%d",
|
||||||
qapi_free_SocketAddress(saddr);
|
inet_ntoa(saddr.sin_addr), ntohs(saddr.sin_port));
|
||||||
g_free(addr_str);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -10,10 +10,7 @@ $(call set-vpath, $(SRC_PATH)/pc-bios/optionrom)
|
|||||||
.PHONY : all clean build-all
|
.PHONY : all clean build-all
|
||||||
|
|
||||||
# Compiling with no optimization creates ROMs that are too large
|
# Compiling with no optimization creates ROMs that are too large
|
||||||
ifeq ($(filter -O%, $(CFLAGS)),)
|
ifeq ($(lastword $(filter -O%, -O0 $(CFLAGS))),-O0)
|
||||||
override CFLAGS += -O2
|
|
||||||
endif
|
|
||||||
ifeq ($(filter -O%, $(CFLAGS)),-O0)
|
|
||||||
override CFLAGS += -O2
|
override CFLAGS += -O2
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user