From nobody Fri May 17 07:07:53 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1608645457; cv=none; d=zohomail.com; s=zohoarc; b=EkBoQpNVhqcQc4vslRv5ppnbZksjofxD1iU2hIgjhGJwaKwjFlNYmWMuV6lht1ZVY+y8YmeQFzVSidv7XL/cJdRx/id0zX05DknfYdfp4ZpFB6Uj+gAp1rzyP1Wh7eJSRrbptMowz5F1ibHYrilALdj71jqkH5kD4HTF9E3M8z0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1608645457; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=diGZjLLoRW05St9ao/P2IssVbX9mrleXdr25eCIbxSQ=; b=AmrrSSlxII0XCz3ofGJWGWDTT8XhNoDmZwsKyuDWhkDEKDQ4AvA3qghlRaXbvjKKUPUa1bcu990lh4lL8Yf4kZdecIPDgL5ZX65DwowDkYk4I4VL1/qqh15E91eXX15HfSGm4OJ8AU2GrAyhsRrMD6jFYPAT/yLegfpiiSmP33Q= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1608645457880367.738093177108; Tue, 22 Dec 2020 05:57:37 -0800 (PST) Received: from localhost ([::1]:59550 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kriAS-0002aS-10 for importer@patchew.org; Tue, 22 Dec 2020 08:57:36 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:41624) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1krdBZ-0001mC-F9; Tue, 22 Dec 2020 03:38:25 -0500 Received: from szxga07-in.huawei.com ([45.249.212.35]:2623) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1krdBW-0002j7-Dq; Tue, 22 Dec 2020 03:38:25 -0500 Received: from DGGEMS414-HUB.china.huawei.com (unknown [172.30.72.59]) by szxga07-in.huawei.com (SkyGuard) with ESMTP id 4D0V7y5gtwz7JcZ; Tue, 22 Dec 2020 16:37:18 +0800 (CST) Received: from huawei.com (10.175.124.27) by DGGEMS414-HUB.china.huawei.com (10.3.19.214) with Microsoft SMTP Server id 14.3.498.0; Tue, 22 Dec 2020 16:37:51 +0800 From: Zhang Han To: Subject: [PATCH 1/9] net: Add spaces around operator/delete redundant spaces Date: Tue, 22 Dec 2020 16:23:32 +0800 Message-ID: <20201222082340.67405-2-zhanghan64@huawei.com> X-Mailer: git-send-email 2.29.1.59.gf9b6481aed In-Reply-To: <20201222082340.67405-1-zhanghan64@huawei.com> References: <20201222082340.67405-1-zhanghan64@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.175.124.27] X-CFilter-Loop: Reflected Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=45.249.212.35; envelope-from=zhanghan64@huawei.com; helo=szxga07-in.huawei.com X-Spam_score_int: -41 X-Spam_score: -4.2 X-Spam_bar: ---- X-Spam_report: (-4.2 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Tue, 22 Dec 2020 08:55:42 -0500 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: alex.chen@huawei.com, hunongda@huawei.com, qemu-trivial@nongnu.org, hang.zhanghailiang@huawei.com, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" Fix problems about spaces: -operator needs spaces around it, add them.=20 -somespaces are redundant, remove them. Signed-off-by: Zhang Han --- net/checksum.c | 4 +-- net/eth.c | 2 +- net/net.c | 2 +- net/queue.c | 2 +- net/socket.c | 12 +++---- net/tap-solaris.c | 42 +++++++++++----------- net/tap-win32.c | 90 +++++++++++++++++++++++------------------------ net/vde.c | 2 +- net/vhost-user.c | 2 +- 9 files changed, 79 insertions(+), 79 deletions(-) diff --git a/net/checksum.c b/net/checksum.c index aaa4000238..f65ac3ea9f 100644 --- a/net/checksum.c +++ b/net/checksum.c @@ -41,8 +41,8 @@ uint32_t net_checksum_add_cont(int len, uint8_t *buf, int= seq) =20 uint16_t net_checksum_finish(uint32_t sum) { - while (sum>>16) - sum =3D (sum & 0xFFFF)+(sum >> 16); + while (sum >> 16) + sum =3D (sum & 0xFFFF) + (sum >> 16); return ~sum; } =20 diff --git a/net/eth.c b/net/eth.c index 1e0821c5f8..725de18272 100644 --- a/net/eth.c +++ b/net/eth.c @@ -334,7 +334,7 @@ eth_setup_ip4_fragmentation(const void *l2hdr, size_t l= 2hdr_len, assert(frag_offset % IP_FRAG_UNIT_SIZE =3D=3D 0); assert((frag_off_units & ~IP_OFFMASK) =3D=3D 0); =20 - orig_flags =3D be16_to_cpu(iphdr->ip_off) & ~(IP_OFFMASK|IP_MF); + orig_flags =3D be16_to_cpu(iphdr->ip_off) & ~(IP_OFFMASK | IP_MF); new_ip_off =3D frag_off_units | orig_flags | (more_frags ? IP_MF = : 0); iphdr->ip_off =3D cpu_to_be16(new_ip_off); iphdr->ip_len =3D cpu_to_be16(l3payload_len + l3hdr_len); diff --git a/net/net.c b/net/net.c index e1035f21d1..a835759266 100644 --- a/net/net.c +++ b/net/net.c @@ -179,7 +179,7 @@ static int qemu_macaddr_get_free(void) =20 void qemu_macaddr_default_if_unset(MACAddr *macaddr) { - static const MACAddr zero =3D { .a =3D { 0,0,0,0,0,0 } }; + static const MACAddr zero =3D { .a =3D { 0, 0, 0, 0, 0, 0 } }; static const MACAddr base =3D { .a =3D { 0x52, 0x54, 0x00, 0x12, 0x34,= 0 } }; =20 if (memcmp(macaddr, &zero, sizeof(zero)) !=3D 0) { diff --git a/net/queue.c b/net/queue.c index 19e32c80fd..fd0e4e66e1 100644 --- a/net/queue.c +++ b/net/queue.c @@ -57,7 +57,7 @@ struct NetQueue { =20 QTAILQ_HEAD(, NetPacket) packets; =20 - unsigned delivering : 1; + unsigned delivering:1; }; =20 NetQueue *qemu_new_net_queue(NetQueueDeliverFunc *deliver, void *opaque) diff --git a/net/socket.c b/net/socket.c index 15b410e8d8..282264bbcb 100644 --- a/net/socket.c +++ b/net/socket.c @@ -455,15 +455,15 @@ static NetSocketState *net_socket_fd_init(NetClientSt= ate *peer, int fd, int is_connected, const char *mc, Error **errp) { - int so_type =3D -1, optlen=3Dsizeof(so_type); + int so_type =3D -1, optlen =3D sizeof(so_type); =20 - if(getsockopt(fd, SOL_SOCKET, SO_TYPE, (char *)&so_type, - (socklen_t *)&optlen)< 0) { + if (getsockopt(fd, SOL_SOCKET, SO_TYPE, (char *)&so_type, + (socklen_t *)&optlen) < 0) { error_setg(errp, "can't get socket option SO_TYPE"); closesocket(fd); return NULL; } - switch(so_type) { + switch (so_type) { case SOCK_DGRAM: return net_socket_fd_init_dgram(peer, model, name, fd, is_connecte= d, mc, errp); @@ -484,7 +484,7 @@ static void net_socket_accept(void *opaque) socklen_t len; int fd; =20 - for(;;) { + for (;;) { len =3D sizeof(saddr); fd =3D qemu_accept(s->listen_fd, (struct sockaddr *)&saddr, &len); if (fd < 0 && errno !=3D EINTR) { @@ -574,7 +574,7 @@ static int net_socket_connect_init(NetClientState *peer, qemu_set_nonblock(fd); =20 connected =3D 0; - for(;;) { + for (;;) { ret =3D connect(fd, (struct sockaddr *)&saddr, sizeof(saddr)); if (ret < 0) { if (errno =3D=3D EINTR || errno =3D=3D EWOULDBLOCK) { diff --git a/net/tap-solaris.c b/net/tap-solaris.c index 0475a58207..dcfe92bf17 100644 --- a/net/tap-solaris.c +++ b/net/tap-solaris.c @@ -53,7 +53,7 @@ ssize_t tap_read_packet(int tapfd, uint8_t *buf, int maxl= en) return getmsg(tapfd, NULL, &sbuf, &f) >=3D 0 ? sbuf.len : -1; } =20 -#define TUNNEWPPA (('T'<<16) | 0x0001) +#define TUNNEWPPA (('T' << 16) | 0x0001) /* * Allocate TAP device, returns opened fd. * Stores dev name in the first arg(must be large enough). @@ -75,14 +75,14 @@ static int tap_alloc(char *dev, size_t dev_size, Error = **errp) =20 memset(&ifr, 0x0, sizeof(ifr)); =20 - if( *dev ){ + if (*dev) { ptr =3D dev; - while( *ptr && !qemu_isdigit((int)*ptr) ) ptr++; + while (*ptr && !qemu_isdigit((int)*ptr)) ptr++; ppa =3D atoi(ptr); } =20 /* Check if IP device was opened */ - if( ip_fd ) + if (ip_fd) close(ip_fd); =20 TFR(ip_fd =3D open("/dev/udp", O_RDWR, 0)); @@ -102,7 +102,7 @@ static int tap_alloc(char *dev, size_t dev_size, Error = **errp) strioc_ppa.ic_timout =3D 0; strioc_ppa.ic_len =3D sizeof(ppa); strioc_ppa.ic_dp =3D (char *)&ppa; - if ((ppa =3D ioctl (tap_fd, I_STR, &strioc_ppa)) < 0) + if ((ppa =3D ioctl(tap_fd, I_STR, &strioc_ppa)) < 0) error_report("Can't assign new interface"); =20 TFR(if_fd =3D open("/dev/tap", O_RDWR, 0)); @@ -110,7 +110,7 @@ static int tap_alloc(char *dev, size_t dev_size, Error = **errp) error_setg(errp, "Can't open /dev/tap (2)"); return -1; } - if(ioctl(if_fd, I_PUSH, "ip") < 0){ + if (ioctl(if_fd, I_PUSH, "ip") < 0) { error_setg(errp, "Can't push IP module"); return -1; } @@ -118,27 +118,27 @@ static int tap_alloc(char *dev, size_t dev_size, Erro= r **errp) if (ioctl(if_fd, SIOCGLIFFLAGS, &ifr) < 0) error_report("Can't get flags"); =20 - snprintf (actual_name, 32, "tap%d", ppa); + snprintf(actual_name, 32, "tap%d", ppa); pstrcpy(ifr.lifr_name, sizeof(ifr.lifr_name), actual_name); =20 ifr.lifr_ppa =3D ppa; /* Assign ppa according to the unit number returned by tun device */ =20 - if (ioctl (if_fd, SIOCSLIFNAME, &ifr) < 0) + if (ioctl(if_fd, SIOCSLIFNAME, &ifr) < 0) error_report("Can't set PPA %d", ppa); - if (ioctl(if_fd, SIOCGLIFFLAGS, &ifr) <0) + if (ioctl(if_fd, SIOCGLIFFLAGS, &ifr) < 0) error_report("Can't get flags"); /* Push arp module to if_fd */ - if (ioctl (if_fd, I_PUSH, "arp") < 0) + if (ioctl(if_fd, I_PUSH, "arp") < 0) error_report("Can't push ARP module (2)"); =20 /* Push arp module to ip_fd */ - if (ioctl (ip_fd, I_POP, NULL) < 0) + if (ioctl(ip_fd, I_POP, NULL) < 0) error_report("I_POP failed"); - if (ioctl (ip_fd, I_PUSH, "arp") < 0) + if (ioctl(ip_fd, I_PUSH, "arp") < 0) error_report("Can't push ARP module (3)"); /* Open arp_fd */ - TFR(arp_fd =3D open ("/dev/tap", O_RDWR, 0)); + TFR(arp_fd =3D open("/dev/tap", O_RDWR, 0)); if (arp_fd < 0) error_report("Can't open %s", "/dev/tap"); =20 @@ -147,29 +147,29 @@ static int tap_alloc(char *dev, size_t dev_size, Erro= r **errp) strioc_if.ic_timout =3D 0; strioc_if.ic_len =3D sizeof(ifr); strioc_if.ic_dp =3D (char *)𝔦 - if (ioctl(arp_fd, I_STR, &strioc_if) < 0){ + if (ioctl(arp_fd, I_STR, &strioc_if) < 0) { error_report("Can't set ifname to arp"); } =20 - if((ip_muxid =3D ioctl(ip_fd, I_LINK, if_fd)) < 0){ + if ((ip_muxid =3D ioctl(ip_fd, I_LINK, if_fd)) < 0) { error_setg(errp, "Can't link TAP device to IP"); return -1; } =20 - if ((arp_muxid =3D ioctl (ip_fd, link_type, arp_fd)) < 0) + if ((arp_muxid =3D ioctl(ip_fd, link_type, arp_fd)) < 0) error_report("Can't link TAP device to ARP"); =20 - close (if_fd); + close(if_fd); =20 memset(&ifr, 0x0, sizeof(ifr)); pstrcpy(ifr.lifr_name, sizeof(ifr.lifr_name), actual_name); ifr.lifr_ip_muxid =3D ip_muxid; ifr.lifr_arp_muxid =3D arp_muxid; =20 - if (ioctl (ip_fd, SIOCSLIFMUXID, &ifr) < 0) + if (ioctl(ip_fd, SIOCSLIFMUXID, &ifr) < 0) { - ioctl (ip_fd, I_PUNLINK , arp_muxid); - ioctl (ip_fd, I_PUNLINK, ip_muxid); + ioctl(ip_fd, I_PUNLINK , arp_muxid); + ioctl(ip_fd, I_PUNLINK, ip_muxid); error_report("Can't set multiplexor id"); } =20 @@ -180,7 +180,7 @@ static int tap_alloc(char *dev, size_t dev_size, Error = **errp) int tap_open(char *ifname, int ifname_size, int *vnet_hdr, int vnet_hdr_required, int mq_required, Error **errp) { - char dev[10]=3D""; + char dev[10] =3D ""; int fd; =20 fd =3D tap_alloc(dev, sizeof(dev), errp); diff --git a/net/tap-win32.c b/net/tap-win32.c index 2b5dcda36e..2c8fc9c36b 100644 --- a/net/tap-win32.c +++ b/net/tap-win32.c @@ -42,18 +42,18 @@ // TAP IOCTLs //=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =20 -#define TAP_CONTROL_CODE(request,method) \ - CTL_CODE (FILE_DEVICE_UNKNOWN, request, method, FILE_ANY_ACCESS) - -#define TAP_IOCTL_GET_MAC TAP_CONTROL_CODE (1, METHOD_BUFFER= ED) -#define TAP_IOCTL_GET_VERSION TAP_CONTROL_CODE (2, METHOD_BUFFER= ED) -#define TAP_IOCTL_GET_MTU TAP_CONTROL_CODE (3, METHOD_BUFFER= ED) -#define TAP_IOCTL_GET_INFO TAP_CONTROL_CODE (4, METHOD_BUFFER= ED) -#define TAP_IOCTL_CONFIG_POINT_TO_POINT TAP_CONTROL_CODE (5, METHOD_BUFFER= ED) -#define TAP_IOCTL_SET_MEDIA_STATUS TAP_CONTROL_CODE (6, METHOD_BUFFER= ED) -#define TAP_IOCTL_CONFIG_DHCP_MASQ TAP_CONTROL_CODE (7, METHOD_BUFFER= ED) -#define TAP_IOCTL_GET_LOG_LINE TAP_CONTROL_CODE (8, METHOD_BUFFER= ED) -#define TAP_IOCTL_CONFIG_DHCP_SET_OPT TAP_CONTROL_CODE (9, METHOD_BUFFER= ED) +#define TAP_CONTROL_CODE(request, method) \ + CTL_CODE(FILE_DEVICE_UNKNOWN, request, method, FILE_ANY_ACCESS) + +#define TAP_IOCTL_GET_MAC TAP_CONTROL_CODE(1, METHOD_BUFFERE= D) +#define TAP_IOCTL_GET_VERSION TAP_CONTROL_CODE(2, METHOD_BUFFERE= D) +#define TAP_IOCTL_GET_MTU TAP_CONTROL_CODE(3, METHOD_BUFFERE= D) +#define TAP_IOCTL_GET_INFO TAP_CONTROL_CODE(4, METHOD_BUFFERE= D) +#define TAP_IOCTL_CONFIG_POINT_TO_POINT TAP_CONTROL_CODE(5, METHOD_BUFFERE= D) +#define TAP_IOCTL_SET_MEDIA_STATUS TAP_CONTROL_CODE(6, METHOD_BUFFERE= D) +#define TAP_IOCTL_CONFIG_DHCP_MASQ TAP_CONTROL_CODE(7, METHOD_BUFFERE= D) +#define TAP_IOCTL_GET_LOG_LINE TAP_CONTROL_CODE(8, METHOD_BUFFERE= D) +#define TAP_IOCTL_CONFIG_DHCP_SET_OPT TAP_CONTROL_CODE(9, METHOD_BUFFERE= D) =20 //=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D // Registry keys @@ -92,7 +92,7 @@ * structure. See the function, tap_win32_free_buffer. */ typedef struct tun_buffer_s { - unsigned char buffer [TUN_BUFFER_SIZE]; + unsigned char buffer[TUN_BUFFER_SIZE]; unsigned long read_size; struct tun_buffer_s* next; } tun_buffer_t; @@ -155,7 +155,7 @@ static tun_buffer_t* get_buffer_from_output_queue(tap_w= in32_overlapped_t* const buffer =3D overlapped->output_queue_front; overlapped->output_queue_front =3D buffer->next; =20 - if(overlapped->output_queue_front =3D=3D NULL) { + if (overlapped->output_queue_front =3D=3D NULL) { overlapped->output_queue_back =3D NULL; } =20 @@ -171,7 +171,7 @@ static tun_buffer_t* get_buffer_from_output_queue(tap_w= in32_overlapped_t* const return buffer; } =20 -static tun_buffer_t* get_buffer_from_output_queue_immediate (tap_win32_ove= rlapped_t* const overlapped) +static tun_buffer_t* get_buffer_from_output_queue_immediate(tap_win32_over= lapped_t* const overlapped) { return get_buffer_from_output_queue(overlapped, 0); } @@ -180,7 +180,7 @@ static void put_buffer_on_output_queue(tap_win32_overla= pped_t* const overlapped, { EnterCriticalSection(&overlapped->output_queue_cs); =20 - if(overlapped->output_queue_front =3D=3D NULL && overlapped->output_qu= eue_back =3D=3D NULL) { + if (overlapped->output_queue_front =3D=3D NULL && overlapped->output_q= ueue_back =3D=3D NULL) { overlapped->output_queue_front =3D overlapped->output_queue_back = =3D buffer; } else { buffer->next =3D NULL; @@ -222,7 +222,7 @@ static int is_tap_win32_dev(const char *guid) char net_cfg_instance_id[256]; DWORD data_type; =20 - len =3D sizeof (enum_name); + len =3D sizeof(enum_name); status =3D RegEnumKeyEx( netcard_key, i, @@ -239,7 +239,7 @@ static int is_tap_win32_dev(const char *guid) return FALSE; } =20 - snprintf (unit_string, sizeof(unit_string), "%s\\%s", + snprintf(unit_string, sizeof(unit_string), "%s\\%s", ADAPTER_KEY, enum_name); =20 status =3D RegOpenKeyEx( @@ -252,7 +252,7 @@ static int is_tap_win32_dev(const char *guid) if (status !=3D ERROR_SUCCESS) { return FALSE; } else { - len =3D sizeof (component_id); + len =3D sizeof(component_id); status =3D RegQueryValueEx( unit_key, component_id_string, @@ -262,7 +262,7 @@ static int is_tap_win32_dev(const char *guid) &len); =20 if (!(status !=3D ERROR_SUCCESS || data_type !=3D REG_SZ)) { - len =3D sizeof (net_cfg_instance_id); + len =3D sizeof(net_cfg_instance_id); status =3D RegQueryValueEx( unit_key, net_cfg_instance_id_string, @@ -273,7 +273,7 @@ static int is_tap_win32_dev(const char *guid) =20 if (status =3D=3D ERROR_SUCCESS && data_type =3D=3D REG_SZ= ) { if (/* !strcmp (component_id, TAP_COMPONENT_ID) &&*/ - !strcmp (net_cfg_instance_id, guid)) { + !strcmp(net_cfg_instance_id, guid)) { RegCloseKey (unit_key); RegCloseKey (netcard_key); return TRUE; @@ -321,7 +321,7 @@ static int get_device_guid( DWORD name_type; const char name_string[] =3D "Name"; =20 - len =3D sizeof (enum_name); + len =3D sizeof(enum_name); status =3D RegEnumKeyEx( control_net_key, i, @@ -351,7 +351,7 @@ static int get_device_guid( &connection_key); =20 if (status =3D=3D ERROR_SUCCESS) { - len =3D sizeof (name_data); + len =3D sizeof(name_data); status =3D RegQueryValueEx( connection_key, name_string, @@ -401,8 +401,8 @@ static int tap_win32_set_status(HANDLE handle, int stat= us) unsigned long len =3D 0; =20 return DeviceIoControl(handle, TAP_IOCTL_SET_MEDIA_STATUS, - &status, sizeof (status), - &status, sizeof (status), &len, NULL); + &status, sizeof(status), + &status, sizeof(status), &len, NULL); } =20 static void tap_win32_overlapped_init(tap_win32_overlapped_t* const overla= pped, const HANDLE handle) @@ -429,7 +429,7 @@ static void tap_win32_overlapped_init(tap_win32_overlap= ped_t* const overlapped, TUN_MAX_BUFFER_COUNT, // maximum count NULL); // unnamed semaphore =20 - if(!overlapped->output_queue_semaphore) { + if (!overlapped->output_queue_semaphore) { fprintf(stderr, "error creating output queue semaphore!\n"); } =20 @@ -439,7 +439,7 @@ static void tap_win32_overlapped_init(tap_win32_overlap= ped_t* const overlapped, TUN_MAX_BUFFER_COUNT, // maximum count NULL); // unnamed semaphore =20 - if(!overlapped->free_list_semaphore) { + if (!overlapped->free_list_semaphore) { fprintf(stderr, "error creating free list semaphore!\n"); } =20 @@ -447,7 +447,7 @@ static void tap_win32_overlapped_init(tap_win32_overlap= ped_t* const overlapped, =20 { unsigned index; - for(index =3D 0; index < TUN_MAX_BUFFER_COUNT; index++) { + for (index =3D 0; index < TUN_MAX_BUFFER_COUNT; index++) { tun_buffer_t* element =3D &overlapped->buffers[index]; element->next =3D overlapped->free_list; overlapped->free_list =3D element; @@ -455,7 +455,7 @@ static void tap_win32_overlapped_init(tap_win32_overlap= ped_t* const overlapped, } /* To count buffers, initially no-signal. */ overlapped->tap_semaphore =3D CreateSemaphore(NULL, 0, TUN_MAX_BUFFER_= COUNT, NULL); - if(!overlapped->tap_semaphore) + if (!overlapped->tap_semaphore) fprintf(stderr, "error creating tap_semaphore.\n"); } =20 @@ -467,7 +467,7 @@ static int tap_win32_write(tap_win32_overlapped_t *over= lapped, DWORD error; =20 #ifdef TUN_ASYNCHRONOUS_WRITES - result =3D GetOverlappedResult( overlapped->handle, &overlapped->write= _overlapped, + result =3D GetOverlappedResult(overlapped->handle, &overlapped->write_= overlapped, &write_size, FALSE); =20 if (!result && GetLastError() =3D=3D ERROR_IO_INCOMPLETE) @@ -500,7 +500,7 @@ static int tap_win32_write(tap_win32_overlapped_t *over= lapped, #ifdef DEBUG_TAP_WIN32 LPTSTR msgbuf; error =3D GetLastError(); - FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER|FORMAT_MESSAGE_FROM_S= YSTEM, + FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM= _SYSTEM, NULL, error, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAUL= T), &msgbuf, 0, NULL); fprintf(stderr, "Tap-Win32: Error WriteFile %d - %s\n", error, msg= buf); @@ -531,32 +531,32 @@ static DWORD WINAPI tap_win32_thread_entry(LPVOID par= am) dwError =3D GetLastError(); if (dwError =3D=3D ERROR_IO_PENDING) { WaitForSingleObject(overlapped->read_event, INFINITE); - result =3D GetOverlappedResult( overlapped->handle, &overl= apped->read_overlapped, + result =3D GetOverlappedResult(overlapped->handle, &overla= pped->read_overlapped, &read_size, FALSE); if (!result) { #ifdef DEBUG_TAP_WIN32 LPVOID lpBuffer; dwError =3D GetLastError(); - FormatMessage( FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT= _MESSAGE_FROM_SYSTEM, + FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_= MESSAGE_FROM_SYSTEM, NULL, dwError, MAKELANGID(LANG_NEUTRAL,= SUBLANG_DEFAULT), - (LPTSTR) & lpBuffer, 0, NULL ); + (LPTSTR) &lpBuffer, 0, NULL); fprintf(stderr, "Tap-Win32: Error GetOverlappedResult = %d - %s\n", dwError, lpBuffer); - LocalFree( lpBuffer ); + LocalFree(lpBuffer); #endif } } else { #ifdef DEBUG_TAP_WIN32 LPVOID lpBuffer; - FormatMessage( FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MES= SAGE_FROM_SYSTEM, + FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESS= AGE_FROM_SYSTEM, NULL, dwError, MAKELANGID(LANG_NEUTRAL, SUB= LANG_DEFAULT), - (LPTSTR) & lpBuffer, 0, NULL ); + (LPTSTR) &lpBuffer, 0, NULL); fprintf(stderr, "Tap-Win32: Error ReadFile %d - %s\n", dwE= rror, lpBuffer); - LocalFree( lpBuffer ); + LocalFree(lpBuffer); #endif } } =20 - if(read_size > 0) { + if (read_size > 0) { buffer->read_size =3D read_size; put_buffer_on_output_queue(overlapped, buffer); ReleaseSemaphore(overlapped->tap_semaphore, 1, NULL); @@ -574,10 +574,10 @@ static int tap_win32_read(tap_win32_overlapped_t *ove= rlapped, =20 tun_buffer_t* buffer =3D get_buffer_from_output_queue_immediate(overla= pped); =20 - if(buffer !=3D NULL) { + if (buffer !=3D NULL) { *pbuf =3D buffer->buffer; size =3D (int)buffer->read_size; - if(size > max_size) { + if (size > max_size) { size =3D max_size; } } @@ -617,7 +617,7 @@ static int tap_win32_open(tap_win32_overlapped_t **phan= dle, if (rc) return -1; =20 - snprintf (device_path, sizeof(device_path), "%s%s%s", + snprintf(device_path, sizeof(device_path), "%s%s%s", USERMODEDEVICEDIR, device_guid, TAPSUFFIX); @@ -629,15 +629,15 @@ static int tap_win32_open(tap_win32_overlapped_t **ph= andle, 0, OPEN_EXISTING, FILE_ATTRIBUTE_SYSTEM | FILE_FLAG_OVERLAPPED, - 0 ); + 0); =20 if (handle =3D=3D INVALID_HANDLE_VALUE) { return -1; } =20 bret =3D DeviceIoControl(handle, TAP_IOCTL_GET_VERSION, - &version, sizeof (version), - &version, sizeof (version), &version_len, NULL); + &version, sizeof(version), + &version, sizeof(version), &version_len, NULL); =20 if (bret =3D=3D FALSE) { CloseHandle(handle); diff --git a/net/vde.c b/net/vde.c index 99189cccb6..0b06464f4d 100644 --- a/net/vde.c +++ b/net/vde.c @@ -92,7 +92,7 @@ static int net_vde_init(NetClientState *peer, const char = *model, }; =20 vde =3D vde_open(init_sock, (char *)"QEMU", &args); - if (!vde){ + if (!vde) { error_setg_errno(errp, errno, "Could not open vde"); return -1; } diff --git a/net/vhost-user.c b/net/vhost-user.c index ffbd94d944..1cf1af1ab9 100644 --- a/net/vhost-user.c +++ b/net/vhost-user.c @@ -235,7 +235,7 @@ static void chr_closed_bh(void *opaque) =20 s =3D DO_UPCAST(NetVhostUserState, nc, ncs[0]); =20 - for (i =3D queues -1; i >=3D 0; i--) { + for (i =3D queues - 1; i >=3D 0; i--) { s =3D DO_UPCAST(NetVhostUserState, nc, ncs[i]); =20 if (s->vhost_net) { --=20 2.29.1.59.gf9b6481aed From nobody Fri May 17 07:07:53 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1608647545; cv=none; d=zohomail.com; s=zohoarc; b=PSHdJK8ZFsfrbS0Jr7Pqt0SkOlFcNqMkHpyrWjP9ItKLXXRL98DP/JwqzPuI0dIrikmnbrWHDoCC4d18pbWOXzjB/mCBBdFPfW2PgMRCpDHizH9l+QBwR5VyAmrWtqC7Kan88D9J/iSW4A4v/6CPsyvrqRJB7Mr3i5qT1ipV0K4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1608647545; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=pRD9A0gdNRFLjJDHQncqVYjPSABkIsOIQ7cmwe0uQx0=; b=nka4XCjocNEximDDHVqt/isLYV4qAxwUAEsHyZMIIPxxL6LOb9KD/ETQv2MO2R00FGO0rGKi1mhTgrwYZEJ7ElBx2iwGbnNnzGLaCrOSSNU85cUzNmJp0KE9oHzxzIYdgdJVMtS159NyQq5LihQs1QJkoTjfC7E/WvmVG9XnvOc= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1608647545362140.34609250583185; Tue, 22 Dec 2020 06:32:25 -0800 (PST) Received: from localhost ([::1]:49046 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kriGB-0001Si-F7 for importer@patchew.org; Tue, 22 Dec 2020 09:03:31 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:41658) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1krdBb-0001oO-T9; Tue, 22 Dec 2020 03:38:27 -0500 Received: from szxga07-in.huawei.com ([45.249.212.35]:2626) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1krdBY-0002kF-79; Tue, 22 Dec 2020 03:38:27 -0500 Received: from DGGEMS414-HUB.china.huawei.com (unknown [172.30.72.59]) by szxga07-in.huawei.com (SkyGuard) with ESMTP id 4D0V7y6XQdz7Jcl; Tue, 22 Dec 2020 16:37:18 +0800 (CST) Received: from huawei.com (10.175.124.27) by DGGEMS414-HUB.china.huawei.com (10.3.19.214) with Microsoft SMTP Server id 14.3.498.0; Tue, 22 Dec 2020 16:37:52 +0800 From: Zhang Han To: Subject: [PATCH 2/9] net: Add braces for statements/fix braces' position Date: Tue, 22 Dec 2020 16:23:33 +0800 Message-ID: <20201222082340.67405-3-zhanghan64@huawei.com> X-Mailer: git-send-email 2.29.1.59.gf9b6481aed In-Reply-To: <20201222082340.67405-1-zhanghan64@huawei.com> References: <20201222082340.67405-1-zhanghan64@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.175.124.27] X-CFilter-Loop: Reflected Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=45.249.212.35; envelope-from=zhanghan64@huawei.com; helo=szxga07-in.huawei.com X-Spam_score_int: -41 X-Spam_score: -4.2 X-Spam_bar: ---- X-Spam_report: (-4.2 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Tue, 22 Dec 2020 08:55:42 -0500 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: alex.chen@huawei.com, hunongda@huawei.com, qemu-trivial@nongnu.org, hang.zhanghailiang@huawei.com, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" Fix problems about braces: -braces are necessary for all arms of if/for/while statements -open brace { should follow if/for/while statements on the same line -else should follow close brace '}' Signed-off-by: Zhang Han --- net/checksum.c | 3 ++- net/net.c | 24 ++++++++++++++++-------- net/queue.c | 3 ++- net/slirp.c | 6 ++++-- net/socket.c | 9 ++++++--- net/tap-bsd.c | 3 +-- net/tap-linux.c | 20 +++++++++++++------- net/tap-solaris.c | 37 ++++++++++++++++++++++++------------- net/tap-win32.c | 33 ++++++++++++++++----------------- 9 files changed, 84 insertions(+), 54 deletions(-) diff --git a/net/checksum.c b/net/checksum.c index f65ac3ea9f..b78bf15098 100644 --- a/net/checksum.c +++ b/net/checksum.c @@ -41,8 +41,9 @@ uint32_t net_checksum_add_cont(int len, uint8_t *buf, int= seq) =20 uint16_t net_checksum_finish(uint32_t sum) { - while (sum >> 16) + while (sum >> 16) { sum =3D (sum & 0xFFFF) + (sum >> 16); + } return ~sum; } =20 diff --git a/net/net.c b/net/net.c index a835759266..626f1fe99a 100644 --- a/net/net.c +++ b/net/net.c @@ -794,8 +794,9 @@ NetClientState *qemu_find_netdev(const char *id) NetClientState *nc; =20 QTAILQ_FOREACH(nc, &net_clients, next) { - if (nc->info->type =3D=3D NET_CLIENT_DRIVER_NIC) + if (nc->info->type =3D=3D NET_CLIENT_DRIVER_NIC) { continue; + } if (!strcmp(nc->name, id)) { return nc; } @@ -829,9 +830,11 @@ static int nic_get_free_idx(void) { int index; =20 - for (index =3D 0; index < MAX_NICS; index++) - if (!nd_table[index].used) + for (index =3D 0; index < MAX_NICS; index++) { + if (!nd_table[index].used) { return index; + } + } return -1; } =20 @@ -857,10 +860,12 @@ void qemu_check_nic_model(NICInfo *nd, const char *mo= del) models[0] =3D model; models[1] =3D NULL; =20 - if (qemu_show_nic_models(nd->model, models)) + if (qemu_show_nic_models(nd->model, models)) { exit(0); - if (qemu_find_nic_model(nd, models, model) < 0) + } + if (qemu_find_nic_model(nd, models, model) < 0) { exit(1); + } } =20 int qemu_find_nic_model(NICInfo *nd, const char * const *models, @@ -868,12 +873,14 @@ int qemu_find_nic_model(NICInfo *nd, const char * con= st *models, { int i; =20 - if (!nd->model) + if (!nd->model) { nd->model =3D g_strdup(default_model); + } =20 for (i =3D 0 ; models[i]; i++) { - if (strcmp(nd->model, models[i]) =3D=3D 0) + if (strcmp(nd->model, models[i]) =3D=3D 0) { return i; + } } =20 error_report("Unsupported NIC model: %s", nd->model); @@ -1219,8 +1226,9 @@ RxFilterInfoList *qmp_query_rx_filter(bool has_name, = const char *name, /* only query information on queue 0 since the info is per nic, * not per queue */ - if (nc->queue_index !=3D 0) + if (nc->queue_index !=3D 0) { continue; + } =20 if (nc->info->query_rx_filter) { info =3D nc->info->query_rx_filter(nc); diff --git a/net/queue.c b/net/queue.c index fd0e4e66e1..6b19271e2d 100644 --- a/net/queue.c +++ b/net/queue.c @@ -250,8 +250,9 @@ void qemu_net_queue_purge(NetQueue *queue, NetClientSta= te *from) =20 bool qemu_net_queue_flush(NetQueue *queue) { - if (queue->delivering) + if (queue->delivering) { return false; + } =20 while (!QTAILQ_EMPTY(&queue->packets)) { NetPacket *packet; diff --git a/net/slirp.c b/net/slirp.c index 77042e6df7..61a9e3071e 100644 --- a/net/slirp.c +++ b/net/slirp.c @@ -53,13 +53,15 @@ static int get_str_sep(char *buf, int buf_size, const c= har **pp, int sep) int len; p =3D *pp; p1 =3D strchr(p, sep); - if (!p1) + if (!p1) { return -1; + } len =3D p1 - p; p1++; if (buf_size > 0) { - if (len > buf_size - 1) + if (len > buf_size - 1) { len =3D buf_size - 1; + } memcpy(buf, p, len); buf[len] =3D '\0'; } diff --git a/net/socket.c b/net/socket.c index 282264bbcb..61671e41e3 100644 --- a/net/socket.c +++ b/net/socket.c @@ -165,8 +165,9 @@ static void net_socket_send(void *opaque) =20 size =3D qemu_recv(s->fd, buf1, sizeof(buf1), 0); if (size < 0) { - if (errno !=3D EWOULDBLOCK) + if (errno !=3D EWOULDBLOCK) { goto eoc; + } } else if (size =3D=3D 0) { /* end of connection */ eoc: @@ -199,8 +200,9 @@ static void net_socket_send_dgram(void *opaque) int size; =20 size =3D qemu_recv(s->fd, s->rs.buf, sizeof(s->rs.buf), 0); - if (size < 0) + if (size < 0) { return; + } if (size =3D=3D 0) { /* end of connection */ net_socket_read_poll(s, false); @@ -301,8 +303,9 @@ static int net_socket_mcast_create(struct sockaddr_in *= mcastaddr, qemu_set_nonblock(fd); return fd; fail: - if (fd >=3D 0) + if (fd >=3D 0) { closesocket(fd); + } return -1; } =20 diff --git a/net/tap-bsd.c b/net/tap-bsd.c index 77aaf674b1..dc8f9c8658 100644 --- a/net/tap-bsd.c +++ b/net/tap-bsd.c @@ -68,8 +68,7 @@ int tap_open(char *ifname, int ifname_size, int *vnet_hdr, TFR(fd =3D open(dname, O_RDWR)); if (fd >=3D 0) { break; - } - else if (errno =3D=3D ENXIO || errno =3D=3D ENOENT) { + } else if (errno =3D=3D ENXIO || errno =3D=3D ENOENT) { break; } if (*ifname) { diff --git a/net/tap-linux.c b/net/tap-linux.c index b0635e9e32..6aff7023a6 100644 --- a/net/tap-linux.c +++ b/net/tap-linux.c @@ -97,10 +97,11 @@ int tap_open(char *ifname, int ifname_size, int *vnet_h= dr, } } =20 - if (ifname[0] !=3D '\0') + if (ifname[0] !=3D '\0') { pstrcpy(ifr.ifr_name, IFNAMSIZ, ifname); - else + } else { pstrcpy(ifr.ifr_name, IFNAMSIZ, "tap%d"); + } ret =3D ioctl(fd, TUNSETIFF, (void *) &ifr); if (ret !=3D 0) { if (ifname[0] !=3D '\0') { @@ -167,8 +168,9 @@ int tap_probe_has_ufo(int fd) =20 offload =3D TUN_F_CSUM | TUN_F_UFO; =20 - if (ioctl(fd, TUNSETOFFLOAD, offload) < 0) + if (ioctl(fd, TUNSETOFFLOAD, offload) < 0) { return 0; + } =20 return 1; } @@ -248,14 +250,18 @@ void tap_fd_set_offload(int fd, int csum, int tso4, =20 if (csum) { offload |=3D TUN_F_CSUM; - if (tso4) + if (tso4) { offload |=3D TUN_F_TSO4; - if (tso6) + } + if (tso6) { offload |=3D TUN_F_TSO6; - if ((tso4 || tso6) && ecn) + } + if ((tso4 || tso6) && ecn) { offload |=3D TUN_F_TSO_ECN; - if (ufo) + } + if (ufo) { offload |=3D TUN_F_UFO; + } } =20 if (ioctl(fd, TUNSETOFFLOAD, offload) !=3D 0) { diff --git a/net/tap-solaris.c b/net/tap-solaris.c index dcfe92bf17..1c8d5f7982 100644 --- a/net/tap-solaris.c +++ b/net/tap-solaris.c @@ -77,13 +77,16 @@ static int tap_alloc(char *dev, size_t dev_size, Error = **errp) =20 if (*dev) { ptr =3D dev; - while (*ptr && !qemu_isdigit((int)*ptr)) ptr++; + while (*ptr && !qemu_isdigit((int)*ptr)) { + ptr++; + } ppa =3D atoi(ptr); } =20 /* Check if IP device was opened */ - if (ip_fd) + if (ip_fd) { close(ip_fd); + } =20 TFR(ip_fd =3D open("/dev/udp", O_RDWR, 0)); if (ip_fd < 0) { @@ -102,8 +105,9 @@ static int tap_alloc(char *dev, size_t dev_size, Error = **errp) strioc_ppa.ic_timout =3D 0; strioc_ppa.ic_len =3D sizeof(ppa); strioc_ppa.ic_dp =3D (char *)&ppa; - if ((ppa =3D ioctl(tap_fd, I_STR, &strioc_ppa)) < 0) + if ((ppa =3D ioctl(tap_fd, I_STR, &strioc_ppa)) < 0) { error_report("Can't assign new interface"); + } =20 TFR(if_fd =3D open("/dev/tap", O_RDWR, 0)); if (if_fd < 0) { @@ -115,8 +119,9 @@ static int tap_alloc(char *dev, size_t dev_size, Error = **errp) return -1; } =20 - if (ioctl(if_fd, SIOCGLIFFLAGS, &ifr) < 0) + if (ioctl(if_fd, SIOCGLIFFLAGS, &ifr) < 0) { error_report("Can't get flags"); + } =20 snprintf(actual_name, 32, "tap%d", ppa); pstrcpy(ifr.lifr_name, sizeof(ifr.lifr_name), actual_name); @@ -124,23 +129,29 @@ static int tap_alloc(char *dev, size_t dev_size, Erro= r **errp) ifr.lifr_ppa =3D ppa; /* Assign ppa according to the unit number returned by tun device */ =20 - if (ioctl(if_fd, SIOCSLIFNAME, &ifr) < 0) + if (ioctl(if_fd, SIOCSLIFNAME, &ifr) < 0) { error_report("Can't set PPA %d", ppa); - if (ioctl(if_fd, SIOCGLIFFLAGS, &ifr) < 0) + } + if (ioctl(if_fd, SIOCGLIFFLAGS, &ifr) < 0) { error_report("Can't get flags"); + } /* Push arp module to if_fd */ - if (ioctl(if_fd, I_PUSH, "arp") < 0) + if (ioctl(if_fd, I_PUSH, "arp") < 0) { error_report("Can't push ARP module (2)"); + } =20 /* Push arp module to ip_fd */ - if (ioctl(ip_fd, I_POP, NULL) < 0) + if (ioctl(ip_fd, I_POP, NULL) < 0) { error_report("I_POP failed"); - if (ioctl(ip_fd, I_PUSH, "arp") < 0) + } + if (ioctl(ip_fd, I_PUSH, "arp") < 0) { error_report("Can't push ARP module (3)"); + } /* Open arp_fd */ TFR(arp_fd =3D open("/dev/tap", O_RDWR, 0)); - if (arp_fd < 0) + if (arp_fd < 0) { error_report("Can't open %s", "/dev/tap"); + } =20 /* Set ifname to arp */ strioc_if.ic_cmd =3D SIOCSLIFNAME; @@ -156,8 +167,9 @@ static int tap_alloc(char *dev, size_t dev_size, Error = **errp) return -1; } =20 - if ((arp_muxid =3D ioctl(ip_fd, link_type, arp_fd)) < 0) + if ((arp_muxid =3D ioctl(ip_fd, link_type, arp_fd)) < 0) { error_report("Can't link TAP device to ARP"); + } =20 close(if_fd); =20 @@ -166,8 +178,7 @@ static int tap_alloc(char *dev, size_t dev_size, Error = **errp) ifr.lifr_ip_muxid =3D ip_muxid; ifr.lifr_arp_muxid =3D arp_muxid; =20 - if (ioctl(ip_fd, SIOCSLIFMUXID, &ifr) < 0) - { + if (ioctl(ip_fd, SIOCSLIFMUXID, &ifr) < 0) { ioctl(ip_fd, I_PUNLINK , arp_muxid); ioctl(ip_fd, I_PUNLINK, ip_muxid); error_report("Can't set multiplexor id"); diff --git a/net/tap-win32.c b/net/tap-win32.c index 2c8fc9c36b..0a5252ab55 100644 --- a/net/tap-win32.c +++ b/net/tap-win32.c @@ -70,7 +70,6 @@ #define USERMODEDEVICEDIR "\\\\.\\Global\\" #define TAPSUFFIX ".tap" =20 - //=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D // Compile time configuration //=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D @@ -146,8 +145,7 @@ static tun_buffer_t* get_buffer_from_output_queue(tap_w= in32_overlapped_t* const // Non-blocking call result =3D WaitForSingleObject(overlapped->output_queue_semaphore, tim= eout); =20 - switch (result) - { + switch (result) { // The semaphore object was signaled. case WAIT_OBJECT_0: EnterCriticalSection(&overlapped->output_queue_cs); @@ -233,9 +231,9 @@ static int is_tap_win32_dev(const char *guid) NULL, NULL); =20 - if (status =3D=3D ERROR_NO_MORE_ITEMS) + if (status =3D=3D ERROR_NO_MORE_ITEMS) { break; - else if (status !=3D ERROR_SUCCESS) { + } else if (status !=3D ERROR_SUCCESS) { return FALSE; } =20 @@ -312,8 +310,7 @@ static int get_device_guid( return -1; } =20 - while (!stop) - { + while (!stop) { char enum_name[256]; char connection_string[256]; HKEY connection_key; @@ -332,9 +329,9 @@ static int get_device_guid( NULL, NULL); =20 - if (status =3D=3D ERROR_NO_MORE_ITEMS) + if (status =3D=3D ERROR_NO_MORE_ITEMS) { break; - else if (status !=3D ERROR_SUCCESS) { + } else if (status !=3D ERROR_SUCCESS) { return -1; } =20 @@ -363,8 +360,7 @@ static int get_device_guid( if (status !=3D ERROR_SUCCESS || name_type !=3D REG_SZ) { ++i; continue; - } - else { + } else { if (is_tap_win32_dev(enum_name)) { snprintf(name, name_size, "%s", enum_name); if (actual_name) { @@ -374,8 +370,7 @@ static int get_device_guid( ++i; continue; } - } - else { + } else { snprintf(actual_name, actual_name_size, "%s", = name_data); } } @@ -390,8 +385,9 @@ static int get_device_guid( =20 RegCloseKey (control_net_key); =20 - if (stop =3D=3D 0) + if (stop =3D=3D 0) { return -1; + } =20 return 0; } @@ -455,8 +451,9 @@ static void tap_win32_overlapped_init(tap_win32_overlap= ped_t* const overlapped, } /* To count buffers, initially no-signal. */ overlapped->tap_semaphore =3D CreateSemaphore(NULL, 0, TUN_MAX_BUFFER_= COUNT, NULL); - if (!overlapped->tap_semaphore) + if (!overlapped->tap_semaphore) { fprintf(stderr, "error creating tap_semaphore.\n"); + } } =20 static int tap_win32_write(tap_win32_overlapped_t *overlapped, @@ -470,8 +467,9 @@ static int tap_win32_write(tap_win32_overlapped_t *over= lapped, result =3D GetOverlappedResult(overlapped->handle, &overlapped->write_= overlapped, &write_size, FALSE); =20 - if (!result && GetLastError() =3D=3D ERROR_IO_INCOMPLETE) + if (!result && GetLastError() =3D=3D ERROR_IO_INCOMPLETE) { WaitForSingleObject(overlapped->write_event, INFINITE); + } #endif =20 result =3D WriteFile(overlapped->handle, buffer, size, @@ -614,8 +612,9 @@ static int tap_win32_open(tap_win32_overlapped_t **phan= dle, } =20 rc =3D get_device_guid(device_guid, sizeof(device_guid), name_buffer, = sizeof(name_buffer)); - if (rc) + if (rc) { return -1; + } =20 snprintf(device_path, sizeof(device_path), "%s%s%s", USERMODEDEVICEDIR, --=20 2.29.1.59.gf9b6481aed From nobody Fri May 17 07:07:53 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1608656083; cv=none; d=zohomail.com; s=zohoarc; b=SVw5qxP5ibTmDZ5mbSlrBWs4i492Weit7TxUoC8w5yHNy2y7dPDGPwOgBmSF1AnHEBNXlqSW7bBmWmKHWrSnB+ZihhTv7g5YRbLXvdLfBalD/yo/y4yxRWYDb+i9DkOCNRnWWYv4/2i4B4EcHel3BWwwQuVlOz24qtrA1M5BShA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1608656083; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=TwUnha0HGnmEmqF7nicuF85CdPLcPOE5V3zUeR5PnN0=; b=TxsMa61u2G4eFx4PPRoXH/1j0Z1n7TFYVMsAsVS5Qln95hxckfpM1jNBvbXQ/MqIoVjvQ2pKV2coCHM0Zt4CvZqUGXW+OC4rEBA2+S3dMcvhxQLnc2BFKgibJ79kohweDnpQcYXWGtMOZvLF1uGZvLbKNr6CUHPlVIOdJwgo+To= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1608656083205180.98908832642758; Tue, 22 Dec 2020 08:54:43 -0800 (PST) Received: from localhost ([::1]:48292 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kriG4-00019k-AD for importer@patchew.org; Tue, 22 Dec 2020 09:03:24 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:41582) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1krdBX-0001kM-Jb; Tue, 22 Dec 2020 03:38:23 -0500 Received: from szxga07-in.huawei.com ([45.249.212.35]:2619) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1krdBS-0002cY-1z; Tue, 22 Dec 2020 03:38:23 -0500 Received: from DGGEMS414-HUB.china.huawei.com (unknown [172.30.72.59]) by szxga07-in.huawei.com (SkyGuard) with ESMTP id 4D0V7y50Lmz7JYl; Tue, 22 Dec 2020 16:37:18 +0800 (CST) Received: from huawei.com (10.175.124.27) by DGGEMS414-HUB.china.huawei.com (10.3.19.214) with Microsoft SMTP Server id 14.3.498.0; Tue, 22 Dec 2020 16:37:52 +0800 From: Zhang Han To: Subject: [PATCH 3/9] net: Transfer // comments to /**/ Date: Tue, 22 Dec 2020 16:23:34 +0800 Message-ID: <20201222082340.67405-4-zhanghan64@huawei.com> X-Mailer: git-send-email 2.29.1.59.gf9b6481aed In-Reply-To: <20201222082340.67405-1-zhanghan64@huawei.com> References: <20201222082340.67405-1-zhanghan64@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.175.124.27] X-CFilter-Loop: Reflected Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=45.249.212.35; envelope-from=zhanghan64@huawei.com; helo=szxga07-in.huawei.com X-Spam_score_int: -41 X-Spam_score: -4.2 X-Spam_bar: ---- X-Spam_report: (-4.2 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Tue, 22 Dec 2020 08:55:42 -0500 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: alex.chen@huawei.com, hunongda@huawei.com, qemu-trivial@nongnu.org, hang.zhanghailiang@huawei.com, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" Do not use C99 // comments, thransfer // to /**/ Signed-off-by: Zhang Han --- net/checksum.c | 6 ++--- net/tap-solaris.c | 2 +- net/tap-win32.c | 60 +++++++++++++++++++++++++++-------------------- 3 files changed, 38 insertions(+), 30 deletions(-) diff --git a/net/checksum.c b/net/checksum.c index b78bf15098..eb2eff5fa4 100644 --- a/net/checksum.c +++ b/net/checksum.c @@ -52,9 +52,9 @@ uint16_t net_checksum_tcpudp(uint16_t length, uint16_t pr= oto, { uint32_t sum =3D 0; =20 - sum +=3D net_checksum_add(length, buf); // payload - sum +=3D net_checksum_add(8, addrs); // src + dst address - sum +=3D proto + length; // protocol & length + sum +=3D net_checksum_add(length, buf); /* payload */ + sum +=3D net_checksum_add(8, addrs); /* src + dst address */ + sum +=3D proto + length; /* protocol & length */ return net_checksum_finish(sum); } =20 diff --git a/net/tap-solaris.c b/net/tap-solaris.c index 1c8d5f7982..a0a5456ab6 100644 --- a/net/tap-solaris.c +++ b/net/tap-solaris.c @@ -35,7 +35,7 @@ #include #include #include -#include // must come after ip.h +#include /* must come after ip.h */ #include #include #include diff --git a/net/tap-win32.c b/net/tap-win32.c index 0a5252ab55..0f0d95cdbb 100644 --- a/net/tap-win32.c +++ b/net/tap-win32.c @@ -38,9 +38,11 @@ #include #include =20 -//=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D -// TAP IOCTLs -//=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D +/* + * =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D + * TAP IOCTLs + * =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D + */ =20 #define TAP_CONTROL_CODE(request, method) \ CTL_CODE(FILE_DEVICE_UNKNOWN, request, method, FILE_ANY_ACCESS) @@ -55,26 +57,32 @@ #define TAP_IOCTL_GET_LOG_LINE TAP_CONTROL_CODE(8, METHOD_BUFFERE= D) #define TAP_IOCTL_CONFIG_DHCP_SET_OPT TAP_CONTROL_CODE(9, METHOD_BUFFERE= D) =20 -//=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D -// Registry keys -//=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D +/* + * =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D + * Registry keys + * =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D + */ =20 #define ADAPTER_KEY "SYSTEM\\CurrentControlSet\\Control\\Class\\{4D36E972-= E325-11CE-BFC1-08002BE10318}" =20 #define NETWORK_CONNECTIONS_KEY "SYSTEM\\CurrentControlSet\\Control\\Netwo= rk\\{4D36E972-E325-11CE-BFC1-08002BE10318}" =20 -//=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D -// Filesystem prefixes -//=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D +/* + * =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D + * Filesystem prefixes + * =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D + */ =20 #define USERMODEDEVICEDIR "\\\\.\\Global\\" #define TAPSUFFIX ".tap" =20 -//=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D -// Compile time configuration -//=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D +/* + * =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D + * Compile time configuration + * =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D + */ =20 -//#define DEBUG_TAP_WIN32 +/* #define DEBUG_TAP_WIN32 */ =20 /* FIXME: The asynch write path appears to be broken at * present. WriteFile() ignores the lpNumberOfBytesWritten parameter @@ -121,7 +129,7 @@ static tun_buffer_t* get_buffer_from_free_list(tap_win3= 2_overlapped_t* const ove WaitForSingleObject(overlapped->free_list_semaphore, INFINITE); EnterCriticalSection(&overlapped->free_list_cs); buffer =3D overlapped->free_list; -// assert(buffer !=3D NULL); + /* assert(buffer !=3D NULL); */ overlapped->free_list =3D buffer->next; LeaveCriticalSection(&overlapped->free_list_cs); buffer->next =3D NULL; @@ -142,11 +150,11 @@ static tun_buffer_t* get_buffer_from_output_queue(tap= _win32_overlapped_t* const tun_buffer_t* buffer =3D NULL; DWORD result, timeout =3D block ? INFINITE : 0L; =20 - // Non-blocking call + /* Non-blocking call */ result =3D WaitForSingleObject(overlapped->output_queue_semaphore, tim= eout); =20 switch (result) { - // The semaphore object was signaled. + /* The semaphore object was signaled. */ case WAIT_OBJECT_0: EnterCriticalSection(&overlapped->output_queue_cs); =20 @@ -160,9 +168,9 @@ static tun_buffer_t* get_buffer_from_output_queue(tap_w= in32_overlapped_t* const LeaveCriticalSection(&overlapped->output_queue_cs); break; =20 - // Semaphore was nonsignaled, so a time-out occurred. + /* Semaphore was nonsignaled, so a time-out occurred. */ case WAIT_TIMEOUT: - // Cannot open another window. + /* Cannot open another window. */ break; } =20 @@ -420,20 +428,20 @@ static void tap_win32_overlapped_init(tap_win32_overl= apped_t* const overlapped, InitializeCriticalSection(&overlapped->free_list_cs); =20 overlapped->output_queue_semaphore =3D CreateSemaphore( - NULL, // default security attributes - 0, // initial count - TUN_MAX_BUFFER_COUNT, // maximum count - NULL); // unnamed semaphore + NULL, /* default security attributes */ + 0, /* initial count */ + TUN_MAX_BUFFER_COUNT, /* maximum count */ + NULL); /* unnamed semaphore */ =20 if (!overlapped->output_queue_semaphore) { fprintf(stderr, "error creating output queue semaphore!\n"); } =20 overlapped->free_list_semaphore =3D CreateSemaphore( - NULL, // default security attributes - TUN_MAX_BUFFER_COUNT, // initial count - TUN_MAX_BUFFER_COUNT, // maximum count - NULL); // unnamed semaphore + NULL, /* default security attributes */ + TUN_MAX_BUFFER_COUNT, /* initial count */ + TUN_MAX_BUFFER_COUNT, /* maximum count */ + NULL); /* unnamed semaphore */ =20 if (!overlapped->free_list_semaphore) { fprintf(stderr, "error creating free list semaphore!\n"); --=20 2.29.1.59.gf9b6481aed From nobody Fri May 17 07:07:53 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1608645604; cv=none; d=zohomail.com; s=zohoarc; b=S4IuOTTfimRpge0uZXGaTCwyw+l0q/ZynL0Fskzhs6HHrVNXUneLxUPAu1cta1oUZMtOB5sZxddRlzzZe2ng2mAull0nVxaLshAC4X6tcND+hACCEs1VAX2f+dEqcKzNNsSHw+Mw0wcPIuM14dbwMhR7Nb5qpdgEdx6UkCnLLvs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1608645604; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=3lDHywhIG/IQt75MTi7COA2usJzIwwJfOMGmN06R+24=; b=VWB3+GRfHjxO+Oybe8/aUil85DlaMa9fCiz+yVfQe1qYcPY2YHADHpCkLz12Eh0s4ojCmPXcNrQchiUC+t2WIpWRFRiZe+5mxYKpP6p4cbAOx9jVkhi23L+MHrfyHidj9oDOsgp4TLQpR0l/XeDnMA7DfTLhlDiASsuYSgBUZIU= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1608645604221667.3358002506998; Tue, 22 Dec 2020 06:00:04 -0800 (PST) Received: from localhost ([::1]:39864 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kriCo-00062s-1R for importer@patchew.org; Tue, 22 Dec 2020 09:00:02 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:41512) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1krdBT-0001i7-Lx; Tue, 22 Dec 2020 03:38:19 -0500 Received: from szxga07-in.huawei.com ([45.249.212.35]:2620) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1krdBR-0002cW-4D; Tue, 22 Dec 2020 03:38:19 -0500 Received: from DGGEMS414-HUB.china.huawei.com (unknown [172.30.72.59]) by szxga07-in.huawei.com (SkyGuard) with ESMTP id 4D0V7y5R6rz7JcV; Tue, 22 Dec 2020 16:37:18 +0800 (CST) Received: from huawei.com (10.175.124.27) by DGGEMS414-HUB.china.huawei.com (10.3.19.214) with Microsoft SMTP Server id 14.3.498.0; Tue, 22 Dec 2020 16:37:53 +0800 From: Zhang Han To: Subject: [PATCH 4/9] net: Transfer "foo* " to "foo *" Date: Tue, 22 Dec 2020 16:23:35 +0800 Message-ID: <20201222082340.67405-5-zhanghan64@huawei.com> X-Mailer: git-send-email 2.29.1.59.gf9b6481aed In-Reply-To: <20201222082340.67405-1-zhanghan64@huawei.com> References: <20201222082340.67405-1-zhanghan64@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.175.124.27] X-CFilter-Loop: Reflected Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=45.249.212.35; envelope-from=zhanghan64@huawei.com; helo=szxga07-in.huawei.com X-Spam_score_int: -41 X-Spam_score: -4.2 X-Spam_bar: ---- X-Spam_report: (-4.2 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Tue, 22 Dec 2020 08:55:38 -0500 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: alex.chen@huawei.com, hunongda@huawei.com, qemu-trivial@nongnu.org, hang.zhanghailiang@huawei.com, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" Fix style problems about "foo*" -"foo* bar" should be "foo *bar". -"foo* const bar" should be "foo * const bar". -"(foo*)" should be "(foo *)" Signed-off-by: Zhang Han --- net/slirp.c | 2 +- net/tap-win32.c | 34 +++++++++++++++++----------------- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/net/slirp.c b/net/slirp.c index 61a9e3071e..772b3c35f2 100644 --- a/net/slirp.c +++ b/net/slirp.c @@ -809,7 +809,7 @@ static void slirp_smb_cleanup(SlirpState *s) } } =20 -static int slirp_smb(SlirpState* s, const char *exported_dir, +static int slirp_smb(SlirpState *s, const char *exported_dir, struct in_addr vserver_addr, Error **errp) { char *smb_conf; diff --git a/net/tap-win32.c b/net/tap-win32.c index 0f0d95cdbb..ac139e9ec9 100644 --- a/net/tap-win32.c +++ b/net/tap-win32.c @@ -101,7 +101,7 @@ typedef struct tun_buffer_s { unsigned char buffer[TUN_BUFFER_SIZE]; unsigned long read_size; - struct tun_buffer_s* next; + struct tun_buffer_s *next; } tun_buffer_t; =20 typedef struct tap_win32_overlapped { @@ -116,16 +116,16 @@ typedef struct tap_win32_overlapped { OVERLAPPED read_overlapped; OVERLAPPED write_overlapped; tun_buffer_t buffers[TUN_MAX_BUFFER_COUNT]; - tun_buffer_t* free_list; - tun_buffer_t* output_queue_front; - tun_buffer_t* output_queue_back; + tun_buffer_t *free_list; + tun_buffer_t *output_queue_front; + tun_buffer_t *output_queue_back; } tap_win32_overlapped_t; =20 static tap_win32_overlapped_t tap_overlapped; =20 -static tun_buffer_t* get_buffer_from_free_list(tap_win32_overlapped_t* con= st overlapped) +static tun_buffer_t *get_buffer_from_free_list(tap_win32_overlapped_t *con= st overlapped) { - tun_buffer_t* buffer =3D NULL; + tun_buffer_t *buffer =3D NULL; WaitForSingleObject(overlapped->free_list_semaphore, INFINITE); EnterCriticalSection(&overlapped->free_list_cs); buffer =3D overlapped->free_list; @@ -136,7 +136,7 @@ static tun_buffer_t* get_buffer_from_free_list(tap_win3= 2_overlapped_t* const ove return buffer; } =20 -static void put_buffer_on_free_list(tap_win32_overlapped_t* const overlapp= ed, tun_buffer_t* const buffer) +static void put_buffer_on_free_list(tap_win32_overlapped_t *const overlapp= ed, tun_buffer_t *const buffer) { EnterCriticalSection(&overlapped->free_list_cs); buffer->next =3D overlapped->free_list; @@ -145,9 +145,9 @@ static void put_buffer_on_free_list(tap_win32_overlappe= d_t* const overlapped, tu ReleaseSemaphore(overlapped->free_list_semaphore, 1, NULL); } =20 -static tun_buffer_t* get_buffer_from_output_queue(tap_win32_overlapped_t* = const overlapped, const int block) +static tun_buffer_t *get_buffer_from_output_queue(tap_win32_overlapped_t *= const overlapped, const int block) { - tun_buffer_t* buffer =3D NULL; + tun_buffer_t *buffer =3D NULL; DWORD result, timeout =3D block ? INFINITE : 0L; =20 /* Non-blocking call */ @@ -177,12 +177,12 @@ static tun_buffer_t* get_buffer_from_output_queue(tap= _win32_overlapped_t* const return buffer; } =20 -static tun_buffer_t* get_buffer_from_output_queue_immediate(tap_win32_over= lapped_t* const overlapped) +static tun_buffer_t *get_buffer_from_output_queue_immediate(tap_win32_over= lapped_t *const overlapped) { return get_buffer_from_output_queue(overlapped, 0); } =20 -static void put_buffer_on_output_queue(tap_win32_overlapped_t* const overl= apped, tun_buffer_t* const buffer) +static void put_buffer_on_output_queue(tap_win32_overlapped_t *const overl= apped, tun_buffer_t *const buffer) { EnterCriticalSection(&overlapped->output_queue_cs); =20 @@ -409,7 +409,7 @@ static int tap_win32_set_status(HANDLE handle, int stat= us) &status, sizeof(status), &len, NULL); } =20 -static void tap_win32_overlapped_init(tap_win32_overlapped_t* const overla= pped, const HANDLE handle) +static void tap_win32_overlapped_init(tap_win32_overlapped_t *const overla= pped, const HANDLE handle) { overlapped->handle =3D handle; =20 @@ -452,7 +452,7 @@ static void tap_win32_overlapped_init(tap_win32_overlap= ped_t* const overlapped, { unsigned index; for (index =3D 0; index < TUN_MAX_BUFFER_COUNT; index++) { - tun_buffer_t* element =3D &overlapped->buffers[index]; + tun_buffer_t *element =3D &overlapped->buffers[index]; element->next =3D overlapped->free_list; overlapped->free_list =3D element; } @@ -520,11 +520,11 @@ static int tap_win32_write(tap_win32_overlapped_t *ov= erlapped, =20 static DWORD WINAPI tap_win32_thread_entry(LPVOID param) { - tap_win32_overlapped_t *overlapped =3D (tap_win32_overlapped_t*)param; + tap_win32_overlapped_t *overlapped =3D (tap_win32_overlapped_t *)param; unsigned long read_size; BOOL result; DWORD dwError; - tun_buffer_t* buffer =3D get_buffer_from_free_list(overlapped); + tun_buffer_t *buffer =3D get_buffer_from_free_list(overlapped); =20 =20 for (;;) { @@ -578,7 +578,7 @@ static int tap_win32_read(tap_win32_overlapped_t *overl= apped, { int size =3D 0; =20 - tun_buffer_t* buffer =3D get_buffer_from_output_queue_immediate(overla= pped); + tun_buffer_t *buffer =3D get_buffer_from_output_queue_immediate(overla= pped); =20 if (buffer !=3D NULL) { *pbuf =3D buffer->buffer; @@ -594,7 +594,7 @@ static int tap_win32_read(tap_win32_overlapped_t *overl= apped, static void tap_win32_free_buffer(tap_win32_overlapped_t *overlapped, uint8_t *pbuf) { - tun_buffer_t* buffer =3D (tun_buffer_t*)pbuf; + tun_buffer_t *buffer =3D (tun_buffer_t *)pbuf; put_buffer_on_free_list(overlapped, buffer); } =20 --=20 2.29.1.59.gf9b6481aed From nobody Fri May 17 07:07:53 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1608645456; cv=none; d=zohomail.com; s=zohoarc; b=RfUHwZFl42o+yX33oiXT3ukGM7ZLmHtIAHTLx33PSBn6Xn+5c7bYV0hi+rkXgQlDbzntQCMreIYAdEGWvz05977PFskh4BOQrHVb5TRYYedFyS+eF3hMcWI+HMgZ57QuldNTvF/8dfMajoSUsU7eHJQIOeZuCv8S/N1mhj9UtlI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1608645456; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=3pwacu8raS+KEBOsBOh8tyBP3hAikWhyvf6jXW2kUTs=; b=dS4/Vxx/tBI30Krw95urRjyUg8yVsKVMmNyb6pJcbK4C6iwz7FLPLHKTUW9/47irtEcsbyb8cj8cb0rsFfQdeInXVmrTv4LQ2uCTa7W+g3HZV4L+0i1xZDrpasGQNg2zvNfKJ9Yero0TM9yz0sUlhPgwc4Oax0yu1t9b3FAmGVc= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1608645456948313.87596302281634; Tue, 22 Dec 2020 05:57:36 -0800 (PST) Received: from localhost ([::1]:59412 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kriAQ-0002Ww-BB for importer@patchew.org; Tue, 22 Dec 2020 08:57:34 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:41546) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1krdBV-0001ie-8y; Tue, 22 Dec 2020 03:38:21 -0500 Received: from szxga07-in.huawei.com ([45.249.212.35]:2622) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1krdBS-0002cV-Kj; Tue, 22 Dec 2020 03:38:21 -0500 Received: from DGGEMS414-HUB.china.huawei.com (unknown [172.30.72.59]) by szxga07-in.huawei.com (SkyGuard) with ESMTP id 4D0V7y6D8zz7Jcj; Tue, 22 Dec 2020 16:37:18 +0800 (CST) Received: from huawei.com (10.175.124.27) by DGGEMS414-HUB.china.huawei.com (10.3.19.214) with Microsoft SMTP Server id 14.3.498.0; Tue, 22 Dec 2020 16:37:53 +0800 From: Zhang Han To: Subject: [PATCH 5/9] net: Fix lines over 90 characters Date: Tue, 22 Dec 2020 16:23:36 +0800 Message-ID: <20201222082340.67405-6-zhanghan64@huawei.com> X-Mailer: git-send-email 2.29.1.59.gf9b6481aed In-Reply-To: <20201222082340.67405-1-zhanghan64@huawei.com> References: <20201222082340.67405-1-zhanghan64@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.175.124.27] X-CFilter-Loop: Reflected Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=45.249.212.35; envelope-from=zhanghan64@huawei.com; helo=szxga07-in.huawei.com X-Spam_score_int: -41 X-Spam_score: -4.2 X-Spam_bar: ---- X-Spam_report: (-4.2 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Tue, 22 Dec 2020 08:55:42 -0500 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: alex.chen@huawei.com, hunongda@huawei.com, qemu-trivial@nongnu.org, hang.zhanghailiang@huawei.com, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" Fix the line width of code. Signed-off-by: Zhang Han --- net/socket.c | 11 +++++++---- net/tap-win32.c | 39 ++++++++++++++++++++++++++------------- 2 files changed, 33 insertions(+), 17 deletions(-) diff --git a/net/socket.c b/net/socket.c index 61671e41e3..0093ed2794 100644 --- a/net/socket.c +++ b/net/socket.c @@ -113,7 +113,9 @@ static ssize_t net_socket_receive(NetClientState *nc, c= onst uint8_t *buf, size_t return size; } =20 -static ssize_t net_socket_receive_dgram(NetClientState *nc, const uint8_t = *buf, size_t size) +static ssize_t net_socket_receive_dgram(NetClientState *nc, + const uint8_t *buf, + size_t size) { NetSocketState *s =3D DO_UPCAST(NetSocketState, nc, nc); ssize_t ret; @@ -353,9 +355,10 @@ static NetSocketState *net_socket_fd_init_dgram(NetCli= entState *peer, sa_type =3D sa->type; qapi_free_SocketAddress(sa); =20 - /* fd passed: multicast: "learn" dgram_dst address from bound address = and save it - * Because this may be "shared" socket from a "master" process, datagr= ams would be recv() - * by ONLY ONE process: we must "clone" this dgram socket --jjo + /* fd passed: multicast: "learn" dgram_dst address from bound address + * and save it. Because this may be "shared" socket from a "master" pr= ocess, + * datagrams would be recv() by ONLY ONE process: we must "clone" + * this dgram socket --jjo */ =20 if (is_connected && mcast !=3D NULL) { diff --git a/net/tap-win32.c b/net/tap-win32.c index ac139e9ec9..107027aa24 100644 --- a/net/tap-win32.c +++ b/net/tap-win32.c @@ -63,9 +63,11 @@ * =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D */ =20 -#define ADAPTER_KEY "SYSTEM\\CurrentControlSet\\Control\\Class\\{4D36E972-= E325-11CE-BFC1-08002BE10318}" +#define ADAPTER_KEY \ + "SYSTEM\\CurrentControlSet\\Control\\Class\\{4D36E972-E325-11CE-BFC1-0= 8002BE10318}" =20 -#define NETWORK_CONNECTIONS_KEY "SYSTEM\\CurrentControlSet\\Control\\Netwo= rk\\{4D36E972-E325-11CE-BFC1-08002BE10318}" +#define NETWORK_CONNECTIONS_KEY \ + "SYSTEM\\CurrentControlSet\\Control\\Network\\{4D36E972-E325-11CE-BFC1= -08002BE10318}" =20 /* * =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D @@ -136,7 +138,8 @@ static tun_buffer_t *get_buffer_from_free_list(tap_win3= 2_overlapped_t *const ove return buffer; } =20 -static void put_buffer_on_free_list(tap_win32_overlapped_t *const overlapp= ed, tun_buffer_t *const buffer) +static void put_buffer_on_free_list(tap_win32_overlapped_t *const overlapp= ed, + tun_buffer_t *const buffer) { EnterCriticalSection(&overlapped->free_list_cs); buffer->next =3D overlapped->free_list; @@ -145,7 +148,8 @@ static void put_buffer_on_free_list(tap_win32_overlappe= d_t *const overlapped, tu ReleaseSemaphore(overlapped->free_list_semaphore, 1, NULL); } =20 -static tun_buffer_t *get_buffer_from_output_queue(tap_win32_overlapped_t *= const overlapped, const int block) +static tun_buffer_t *get_buffer_from_output_queue(tap_win32_overlapped_t *= const overlapped, + const int block) { tun_buffer_t *buffer =3D NULL; DWORD result, timeout =3D block ? INFINITE : 0L; @@ -182,7 +186,8 @@ static tun_buffer_t *get_buffer_from_output_queue_immed= iate(tap_win32_overlapped return get_buffer_from_output_queue(overlapped, 0); } =20 -static void put_buffer_on_output_queue(tap_win32_overlapped_t *const overl= apped, tun_buffer_t *const buffer) +static void put_buffer_on_output_queue(tap_win32_overlapped_t *const overl= apped, + tun_buffer_t *const buffer) { EnterCriticalSection(&overlapped->output_queue_cs); =20 @@ -194,7 +199,7 @@ static void put_buffer_on_output_queue(tap_win32_overla= pped_t *const overlapped, overlapped->output_queue_back =3D buffer; } =20 - LeaveCriticalSection(&overlapped->output_queue_cs); + LeaveCriticalSection(&overlapped->ou412tput_queue_cs); =20 ReleaseSemaphore(overlapped->output_queue_semaphore, 1, NULL); } @@ -409,7 +414,8 @@ static int tap_win32_set_status(HANDLE handle, int stat= us) &status, sizeof(status), &len, NULL); } =20 -static void tap_win32_overlapped_init(tap_win32_overlapped_t *const overla= pped, const HANDLE handle) +static void tap_win32_overlapped_init(tap_win32_overlapped_t *const overla= pped, + const HANDLE handle) { overlapped->handle =3D handle; =20 @@ -447,7 +453,9 @@ static void tap_win32_overlapped_init(tap_win32_overlap= ped_t *const overlapped, fprintf(stderr, "error creating free list semaphore!\n"); } =20 - overlapped->free_list =3D overlapped->output_queue_front =3D overlappe= d->output_queue_back =3D NULL; + overlapped->free_list =3D overlapped->output_queue_front =3D + overlapped->output_queue_back =3D + NULL; =20 { unsigned index; @@ -537,16 +545,20 @@ static DWORD WINAPI tap_win32_thread_entry(LPVOID par= am) dwError =3D GetLastError(); if (dwError =3D=3D ERROR_IO_PENDING) { WaitForSingleObject(overlapped->read_event, INFINITE); - result =3D GetOverlappedResult(overlapped->handle, &overla= pped->read_overlapped, + result =3D GetOverlappedResult(overlapped->handle, + &overlapped->read_overlapped, &read_size, FALSE); if (!result) { #ifdef DEBUG_TAP_WIN32 LPVOID lpBuffer; dwError =3D GetLastError(); - FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_= MESSAGE_FROM_SYSTEM, - NULL, dwError, MAKELANGID(LANG_NEUTRAL,= SUBLANG_DEFAULT), + FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | + FORMAT_MESSAGE_FROM_SYSTEM, + NULL, dwError, + MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAUL= T), (LPTSTR) &lpBuffer, 0, NULL); - fprintf(stderr, "Tap-Win32: Error GetOverlappedResult = %d - %s\n", dwError, lpBuffer); + fprintf(stderr, "Tap-Win32: Error GetOverlappedResult = %d - %s\n", + dwError, lpBuffer); LocalFree(lpBuffer); #endif } @@ -619,7 +631,8 @@ static int tap_win32_open(tap_win32_overlapped_t **phan= dle, snprintf(name_buffer, sizeof(name_buffer), "%s", preferred_name); } =20 - rc =3D get_device_guid(device_guid, sizeof(device_guid), name_buffer, = sizeof(name_buffer)); + rc =3D get_device_guid(device_guid, sizeof(device_guid), + name_buffer, sizeof(name_buffer)); if (rc) { return -1; } --=20 2.29.1.59.gf9b6481aed From nobody Fri May 17 07:07:53 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1608645615; cv=none; d=zohomail.com; s=zohoarc; b=KcnaJ0gSePYQpIEBl4Z7pZsXJx6Ky6ojN/eTRIZTBaTIHlPADO1IbXDIUVMIjPm2rom3GvZM1DuzutqVS7cgkunI9Bpx6Q3tA3kK52Cvc+89onWNa7fu7H4nEhc6Wr2o9+ggK5Aj9mPUKRIUs3zLwmTwTrCJq8xVbFIciY08iZg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1608645615; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=3X1lZY+HTwTc8M5CbEFkGtaS/vPp0Maew1L3Ik5Qxxc=; b=Vh/zN1HyF3XgPFEGzgn37D/cec1gqKirZHBET9tBl+Kqx7kEa/a+ew9Ze4Y3/Zb29XgN4cvhRWT5F/F6DuIMxuEXEkvs5cs8GZde1JGxmDkMhWcYs1gt66/MNghS3IMeqMhHtLG66HqxwQQneE7AvslOBEmAjuhVbv8dP6u9f0w= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1608645615666878.0148513034671; Tue, 22 Dec 2020 06:00:15 -0800 (PST) Received: from localhost ([::1]:40570 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kriCy-0006LW-Hj for importer@patchew.org; Tue, 22 Dec 2020 09:00:12 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:41628) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1krdBZ-0001mi-QP; Tue, 22 Dec 2020 03:38:25 -0500 Received: from szxga07-in.huawei.com ([45.249.212.35]:2625) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1krdBY-0002kE-6C; Tue, 22 Dec 2020 03:38:25 -0500 Received: from DGGEMS414-HUB.china.huawei.com (unknown [172.30.72.59]) by szxga07-in.huawei.com (SkyGuard) with ESMTP id 4D0V7y60kbz7Jcd; Tue, 22 Dec 2020 16:37:18 +0800 (CST) Received: from huawei.com (10.175.124.27) by DGGEMS414-HUB.china.huawei.com (10.3.19.214) with Microsoft SMTP Server id 14.3.498.0; Tue, 22 Dec 2020 16:37:53 +0800 From: Zhang Han To: Subject: [PATCH 6/9] net: Transfer tabs to spcaes Date: Tue, 22 Dec 2020 16:23:37 +0800 Message-ID: <20201222082340.67405-7-zhanghan64@huawei.com> X-Mailer: git-send-email 2.29.1.59.gf9b6481aed In-Reply-To: <20201222082340.67405-1-zhanghan64@huawei.com> References: <20201222082340.67405-1-zhanghan64@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.175.124.27] X-CFilter-Loop: Reflected Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=45.249.212.35; envelope-from=zhanghan64@huawei.com; helo=szxga07-in.huawei.com X-Spam_score_int: -41 X-Spam_score: -4.2 X-Spam_bar: ---- X-Spam_report: (-4.2 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Tue, 22 Dec 2020 08:55:42 -0500 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: alex.chen@huawei.com, hunongda@huawei.com, qemu-trivial@nongnu.org, hang.zhanghailiang@huawei.com, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" Code indent use spaces instead of tabs. Signed-off-by: Zhang Han --- net/tap-linux.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/net/tap-linux.h b/net/tap-linux.h index 2f36d100fc..db72960c19 100644 --- a/net/tap-linux.h +++ b/net/tap-linux.h @@ -44,10 +44,10 @@ #define IFF_DETACH_QUEUE 0x0400 =20 /* Features for GSO (TUNSETOFFLOAD). */ -#define TUN_F_CSUM 0x01 /* You can hand me unchecksummed packets. */ -#define TUN_F_TSO4 0x02 /* I can handle TSO for IPv4 packets */ -#define TUN_F_TSO6 0x04 /* I can handle TSO for IPv6 packets */ -#define TUN_F_TSO_ECN 0x08 /* I can handle TSO with ECN bits. */ -#define TUN_F_UFO 0x10 /* I can handle UFO packets */ +#define TUN_F_CSUM 0x01 /* You can hand me unchecksummed packets. = */ +#define TUN_F_TSO4 0x02 /* I can handle TSO for IPv4 packets */ +#define TUN_F_TSO6 0x04 /* I can handle TSO for IPv6 packets */ +#define TUN_F_TSO_ECN 0x08 /* I can handle TSO with ECN bits. */ +#define TUN_F_UFO 0x10 /* I can handle UFO packets */ =20 #endif /* QEMU_TAP_LINUX_H */ --=20 2.29.1.59.gf9b6481aed From nobody Fri May 17 07:07:53 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1608647390; cv=none; d=zohomail.com; s=zohoarc; b=HrSVJ0M0zHvrcfAi5+uJYv+Ak0a25ClPHb9UAABh4IckSZfrVPTbQR3QAnOfqwixrsrQPd1zSgkxwREeP/GOMyMbPNN6BuTnVAUbqStufytXeMKeR+Op0+ulfIDy21AxXScY4XpD1scPRMGJmcp03Ek9fOA3PBrdxBOcE35ptKY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1608647390; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=Px1drQAMDC7JbQ+zi8vuxuHRNGc3N+nGZWs2vaj2urA=; b=gZlwmE5IWefGSOEsKGtQsQA4n86LN8kcU0zewv8APhIf44N9rdss1t9ZEBGDKyNWXVRYOCiqgjYOpO9/nRanSflDi/67CEOfvzw5e4yJo554S7gcTVlUNHIjDtfxH4WI35k5YFsAua08fhHKr0DgLRiQdTPXgnYG4+i7wkBXVTE= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1608647390343411.99929736519914; Tue, 22 Dec 2020 06:29:50 -0800 (PST) Received: from localhost ([::1]:55568 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kriIK-00046h-Dn for importer@patchew.org; Tue, 22 Dec 2020 09:05:44 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:41568) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1krdBW-0001jW-GB; Tue, 22 Dec 2020 03:38:22 -0500 Received: from szxga07-in.huawei.com ([45.249.212.35]:2621) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1krdBU-0002cX-U4; Tue, 22 Dec 2020 03:38:22 -0500 Received: from DGGEMS414-HUB.china.huawei.com (unknown [172.30.72.59]) by szxga07-in.huawei.com (SkyGuard) with ESMTP id 4D0V7y4dmJz7JXT; Tue, 22 Dec 2020 16:37:18 +0800 (CST) Received: from huawei.com (10.175.124.27) by DGGEMS414-HUB.china.huawei.com (10.3.19.214) with Microsoft SMTP Server id 14.3.498.0; Tue, 22 Dec 2020 16:37:54 +0800 From: Zhang Han To: Subject: [PATCH 7/9] net: Remove assignment in if condition Date: Tue, 22 Dec 2020 16:23:38 +0800 Message-ID: <20201222082340.67405-8-zhanghan64@huawei.com> X-Mailer: git-send-email 2.29.1.59.gf9b6481aed In-Reply-To: <20201222082340.67405-1-zhanghan64@huawei.com> References: <20201222082340.67405-1-zhanghan64@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.175.124.27] X-CFilter-Loop: Reflected Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=45.249.212.35; envelope-from=zhanghan64@huawei.com; helo=szxga07-in.huawei.com X-Spam_score_int: -41 X-Spam_score: -4.2 X-Spam_bar: ---- X-Spam_report: (-4.2 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Tue, 22 Dec 2020 08:55:42 -0500 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: alex.chen@huawei.com, hunongda@huawei.com, qemu-trivial@nongnu.org, hang.zhanghailiang@huawei.com, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" Put the assignment before the if condition Signed-off-by: Zhang Han Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- net/tap-bsd.c | 3 ++- net/tap-solaris.c | 9 ++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/net/tap-bsd.c b/net/tap-bsd.c index dc8f9c8658..d1dca793f9 100644 --- a/net/tap-bsd.c +++ b/net/tap-bsd.c @@ -176,7 +176,8 @@ int tap_open(char *ifname, int ifname_size, int *vnet_h= dr, =20 if (fd < 0) { /* Tap device not specified or does not exist. */ - if ((fd =3D tap_open_clone(ifname, ifname_size, errp)) < 0) { + fd =3D tap_open_clone(ifname, ifname_size, errp); + if (fd < 0) { return -1; } } diff --git a/net/tap-solaris.c b/net/tap-solaris.c index a0a5456ab6..d5af4efd60 100644 --- a/net/tap-solaris.c +++ b/net/tap-solaris.c @@ -105,7 +105,8 @@ static int tap_alloc(char *dev, size_t dev_size, Error = **errp) strioc_ppa.ic_timout =3D 0; strioc_ppa.ic_len =3D sizeof(ppa); strioc_ppa.ic_dp =3D (char *)&ppa; - if ((ppa =3D ioctl(tap_fd, I_STR, &strioc_ppa)) < 0) { + ppa =3D ioctl(tap_fd, I_STR, &strioc_ppa)); + if (ppa < 0) { error_report("Can't assign new interface"); } =20 @@ -162,12 +163,14 @@ static int tap_alloc(char *dev, size_t dev_size, Erro= r **errp) error_report("Can't set ifname to arp"); } =20 - if ((ip_muxid =3D ioctl(ip_fd, I_LINK, if_fd)) < 0) { + ip_muxid =3D ioctl(ip_fd, I_LINK, if_fd); + if (ip_muxid < 0) { error_setg(errp, "Can't link TAP device to IP"); return -1; } =20 - if ((arp_muxid =3D ioctl(ip_fd, link_type, arp_fd)) < 0) { + arp_muxid =3D ioctl(ip_fd, link_type, arp_fd); + if (arp_muxid < 0) { error_report("Can't link TAP device to ARP"); } =20 --=20 2.29.1.59.gf9b6481aed From nobody Fri May 17 07:07:53 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1608656096; cv=none; d=zohomail.com; s=zohoarc; b=ZdrM1QlbSYYP0eOIw6PFkMWmyPwyaqQg1DqenNvTZxF5H8MV2NFkzjAP0Noealvi1HTYsdCf6HjpWMcPOh+L+mV6Gw4nHTyNdBdP+Nz8HdreDMd1Gzs4NhsNXA5UDJM869PRvkXt8rDy9Kli/vH2K3qyoIPT+i8tCqTQsSsQgaw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1608656096; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=CY983n4crCJSIMUHqDCJaGpz0w7sPux8MUfzyE6MNOg=; b=m2VGo2PCCORRKxlOYO1vkVoCaOCzS9a3XwIn0Hu+BLVVk2H7D1Z0mG2UAeZ7IcaweHad0Ox3fHKyGVMNVnBkce6h18jwYnHYFxsVqkIT3kowUZ8fBSy/Sy3SpWmmt1ykAhvDGOEp2aKPymueoyORUH9Bjzuuvis3QKbSGaa6LzM= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1608656096271318.189832989264; Tue, 22 Dec 2020 08:54:56 -0800 (PST) Received: from localhost ([::1]:48370 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kriG4-0001Bz-BT for importer@patchew.org; Tue, 22 Dec 2020 09:03:24 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:41544) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1krdBU-0001iQ-SG; Tue, 22 Dec 2020 03:38:20 -0500 Received: from szxga07-in.huawei.com ([45.249.212.35]:2618) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1krdBR-0002cZ-Uu; Tue, 22 Dec 2020 03:38:20 -0500 Received: from DGGEMS414-HUB.china.huawei.com (unknown [172.30.72.59]) by szxga07-in.huawei.com (SkyGuard) with ESMTP id 4D0V7y4qPJz7JYV; Tue, 22 Dec 2020 16:37:18 +0800 (CST) Received: from huawei.com (10.175.124.27) by DGGEMS414-HUB.china.huawei.com (10.3.19.214) with Microsoft SMTP Server id 14.3.498.0; Tue, 22 Dec 2020 16:37:54 +0800 From: Zhang Han To: Subject: [PATCH 8/9] net: Remove initialization of static ints Date: Tue, 22 Dec 2020 16:23:39 +0800 Message-ID: <20201222082340.67405-9-zhanghan64@huawei.com> X-Mailer: git-send-email 2.29.1.59.gf9b6481aed In-Reply-To: <20201222082340.67405-1-zhanghan64@huawei.com> References: <20201222082340.67405-1-zhanghan64@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.175.124.27] X-CFilter-Loop: Reflected Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=45.249.212.35; envelope-from=zhanghan64@huawei.com; helo=szxga07-in.huawei.com X-Spam_score_int: -41 X-Spam_score: -4.2 X-Spam_bar: ---- X-Spam_report: (-4.2 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Tue, 22 Dec 2020 08:55:40 -0500 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: alex.chen@huawei.com, hunongda@huawei.com, qemu-trivial@nongnu.org, hang.zhanghailiang@huawei.com, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" Do not initialise statics to 0 or NULL Signed-off-by: Zhang Han --- net/tap-solaris.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/net/tap-solaris.c b/net/tap-solaris.c index d5af4efd60..0b4f709abc 100644 --- a/net/tap-solaris.c +++ b/net/tap-solaris.c @@ -63,10 +63,10 @@ static int tap_alloc(char *dev, size_t dev_size, Error = **errp) /* FIXME leaks like a sieve on error paths */ /* FIXME suspicious: many errors are reported, then ignored */ int tap_fd, if_fd, ppa =3D -1; - static int ip_fd =3D 0; + static int ip_fd; char *ptr; =20 - static int arp_fd =3D 0; + static int arp_fd; int ip_muxid, arp_muxid; struct strioctl strioc_if, strioc_ppa; int link_type =3D I_PLINK; --=20 2.29.1.59.gf9b6481aed From nobody Fri May 17 07:07:53 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1608645462; cv=none; d=zohomail.com; s=zohoarc; b=ke0oSUDR7VGtj83YNp5tHyFX8lOZkcL+D/BrNHfUPjZ2YeDfH1Z2PNDI5vuSnqCxGq26Md9qZDgGJE7DP5OP6/oj9yZ8EPYGh54n/FU1YWJ5MMSH4P8UAQbcX2RpuGXO31y4GSwQw/okt5BsFkhMWzRJQyJq2HHKMJ96R3hnkJE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1608645462; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=/CNzQBmtnk5+AEGJRqqtSwUVrcVO87TDLDUl8ofNwNM=; b=l2BoqvGwsah750OqmI6Xl3aNGmWynMfwyHiCbqoBUR8y1sUbT14/0H19CS82fC4Mie8VMwvYz2Jc3YiY8myOfcIm4PatdLRb8WB7H7irz902UOO3vX3blMt/diArL6wIyZXHstqSyQRad2k6o4DT4vB5BWPYk4SeOJekbTRZt6M= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1608645462436753.3536210187589; Tue, 22 Dec 2020 05:57:42 -0800 (PST) Received: from localhost ([::1]:59988 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kriAX-0002lZ-93 for importer@patchew.org; Tue, 22 Dec 2020 08:57:41 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:41518) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1krdBT-0001i9-PR; Tue, 22 Dec 2020 03:38:19 -0500 Received: from szxga05-in.huawei.com ([45.249.212.191]:2919) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1krdBR-0002dx-3p; Tue, 22 Dec 2020 03:38:19 -0500 Received: from DGGEMS414-HUB.china.huawei.com (unknown [172.30.72.58]) by szxga05-in.huawei.com (SkyGuard) with ESMTP id 4D0V7q1rf2zM7G1; Tue, 22 Dec 2020 16:37:11 +0800 (CST) Received: from huawei.com (10.175.124.27) by DGGEMS414-HUB.china.huawei.com (10.3.19.214) with Microsoft SMTP Server id 14.3.498.0; Tue, 22 Dec 2020 16:37:55 +0800 From: Zhang Han To: Subject: [PATCH 9/9] net: Fix the indent problems Date: Tue, 22 Dec 2020 16:23:40 +0800 Message-ID: <20201222082340.67405-10-zhanghan64@huawei.com> X-Mailer: git-send-email 2.29.1.59.gf9b6481aed In-Reply-To: <20201222082340.67405-1-zhanghan64@huawei.com> References: <20201222082340.67405-1-zhanghan64@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.175.124.27] X-CFilter-Loop: Reflected Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=45.249.212.191; envelope-from=zhanghan64@huawei.com; helo=szxga05-in.huawei.com X-Spam_score_int: -41 X-Spam_score: -4.2 X-Spam_bar: ---- X-Spam_report: (-4.2 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Tue, 22 Dec 2020 08:55:39 -0500 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: alex.chen@huawei.com, hunongda@huawei.com, qemu-trivial@nongnu.org, hang.zhanghailiang@huawei.com, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" Fix Suspect code indent for statements Signed-off-by: Zhang Han --- net/tap-solaris.c | 18 +++++++++--------- net/tap-win32.c | 28 ++++++++++++++-------------- net/vde.c | 2 +- 3 files changed, 24 insertions(+), 24 deletions(-) diff --git a/net/tap-solaris.c b/net/tap-solaris.c index 0b4f709abc..fc1e796f70 100644 --- a/net/tap-solaris.c +++ b/net/tap-solaris.c @@ -76,16 +76,16 @@ static int tap_alloc(char *dev, size_t dev_size, Error = **errp) memset(&ifr, 0x0, sizeof(ifr)); =20 if (*dev) { - ptr =3D dev; - while (*ptr && !qemu_isdigit((int)*ptr)) { - ptr++; - } - ppa =3D atoi(ptr); + ptr =3D dev; + while (*ptr && !qemu_isdigit((int)*ptr)) { + ptr++; + } + ppa =3D atoi(ptr); } =20 /* Check if IP device was opened */ if (ip_fd) { - close(ip_fd); + close(ip_fd); } =20 TFR(ip_fd =3D open("/dev/udp", O_RDWR, 0)); @@ -182,9 +182,9 @@ static int tap_alloc(char *dev, size_t dev_size, Error = **errp) ifr.lifr_arp_muxid =3D arp_muxid; =20 if (ioctl(ip_fd, SIOCSLIFMUXID, &ifr) < 0) { - ioctl(ip_fd, I_PUNLINK , arp_muxid); - ioctl(ip_fd, I_PUNLINK, ip_muxid); - error_report("Can't set multiplexor id"); + ioctl(ip_fd, I_PUNLINK , arp_muxid); + ioctl(ip_fd, I_PUNLINK, ip_muxid); + error_report("Can't set multiplexor id"); } =20 snprintf(dev, dev_size, "tap%d", ppa); diff --git a/net/tap-win32.c b/net/tap-win32.c index 107027aa24..b3af8fcba9 100644 --- a/net/tap-win32.c +++ b/net/tap-win32.c @@ -158,24 +158,24 @@ static tun_buffer_t *get_buffer_from_output_queue(tap= _win32_overlapped_t *const result =3D WaitForSingleObject(overlapped->output_queue_semaphore, tim= eout); =20 switch (result) { - /* The semaphore object was signaled. */ - case WAIT_OBJECT_0: - EnterCriticalSection(&overlapped->output_queue_cs); + /* The semaphore object was signaled. */ + case WAIT_OBJECT_0: + EnterCriticalSection(&overlapped->output_queue_cs); =20 - buffer =3D overlapped->output_queue_front; - overlapped->output_queue_front =3D buffer->next; + buffer =3D overlapped->output_queue_front; + overlapped->output_queue_front =3D buffer->next; =20 - if (overlapped->output_queue_front =3D=3D NULL) { - overlapped->output_queue_back =3D NULL; - } + if (overlapped->output_queue_front =3D=3D NULL) { + overlapped->output_queue_back =3D NULL; + } =20 - LeaveCriticalSection(&overlapped->output_queue_cs); - break; + LeaveCriticalSection(&overlapped->output_queue_cs); + break; =20 - /* Semaphore was nonsignaled, so a time-out occurred. */ - case WAIT_TIMEOUT: - /* Cannot open another window. */ - break; + /* Semaphore was nonsignaled, so a time-out occurred. */ + case WAIT_TIMEOUT: + /* Cannot open another window. */ + break; } =20 return buffer; diff --git a/net/vde.c b/net/vde.c index 0b06464f4d..9ccedddc63 100644 --- a/net/vde.c +++ b/net/vde.c @@ -55,7 +55,7 @@ static ssize_t vde_receive(NetClientState *nc, const uint= 8_t *buf, size_t size) ssize_t ret; =20 do { - ret =3D vde_send(s->vde, (const char *)buf, size, 0); + ret =3D vde_send(s->vde, (const char *)buf, size, 0); } while (ret < 0 && errno =3D=3D EINTR); =20 return ret; --=20 2.29.1.59.gf9b6481aed