From: Zhang Han <zhanghan64@huawei.com>
To: <jasowang@redhat.com>
Cc: alex.chen@huawei.com, hunongda@huawei.com,
qemu-trivial@nongnu.org, hang.zhanghailiang@huawei.com,
qemu-devel@nongnu.org
Subject: [PATCH 3/9] net: Transfer // comments to /**/
Date: Tue, 22 Dec 2020 16:23:34 +0800 [thread overview]
Message-ID: <20201222082340.67405-4-zhanghan64@huawei.com> (raw)
In-Reply-To: <20201222082340.67405-1-zhanghan64@huawei.com>
Do not use C99 // comments, thransfer // to /**/
Signed-off-by: Zhang Han <zhanghan64@huawei.com>
---
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 proto,
{
uint32_t sum = 0;
- sum += net_checksum_add(length, buf); // payload
- sum += net_checksum_add(8, addrs); // src + dst address
- sum += proto + length; // protocol & length
+ sum += net_checksum_add(length, buf); /* payload */
+ sum += net_checksum_add(8, addrs); /* src + dst address */
+ sum += proto + length; /* protocol & length */
return net_checksum_finish(sum);
}
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 <netinet/in.h>
#include <netinet/in_systm.h>
#include <netinet/ip.h>
-#include <netinet/ip_icmp.h> // must come after ip.h
+#include <netinet/ip_icmp.h> /* must come after ip.h */
#include <netinet/udp.h>
#include <netinet/tcp.h>
#include <net/if.h>
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 <windows.h>
#include <winioctl.h>
-//=============
-// TAP IOCTLs
-//=============
+/*
+ * =============
+ * TAP IOCTLs
+ * =============
+ */
#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_BUFFERED)
#define TAP_IOCTL_CONFIG_DHCP_SET_OPT TAP_CONTROL_CODE(9, METHOD_BUFFERED)
-//=================
-// Registry keys
-//=================
+/*
+ * =================
+ * Registry keys
+ * =================
+ */
#define ADAPTER_KEY "SYSTEM\\CurrentControlSet\\Control\\Class\\{4D36E972-E325-11CE-BFC1-08002BE10318}"
#define NETWORK_CONNECTIONS_KEY "SYSTEM\\CurrentControlSet\\Control\\Network\\{4D36E972-E325-11CE-BFC1-08002BE10318}"
-//======================
-// Filesystem prefixes
-//======================
+/*
+ * ======================
+ * Filesystem prefixes
+ * ======================
+ */
#define USERMODEDEVICEDIR "\\\\.\\Global\\"
#define TAPSUFFIX ".tap"
-//======================
-// Compile time configuration
-//======================
+/*
+ * ======================
+ * Compile time configuration
+ * ======================
+ */
-//#define DEBUG_TAP_WIN32
+/* #define DEBUG_TAP_WIN32 */
/* 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_win32_overlapped_t* const ove
WaitForSingleObject(overlapped->free_list_semaphore, INFINITE);
EnterCriticalSection(&overlapped->free_list_cs);
buffer = overlapped->free_list;
-// assert(buffer != NULL);
+ /* assert(buffer != NULL); */
overlapped->free_list = buffer->next;
LeaveCriticalSection(&overlapped->free_list_cs);
buffer->next = NULL;
@@ -142,11 +150,11 @@ static tun_buffer_t* get_buffer_from_output_queue(tap_win32_overlapped_t* const
tun_buffer_t* buffer = NULL;
DWORD result, timeout = block ? INFINITE : 0L;
- // Non-blocking call
+ /* Non-blocking call */
result = WaitForSingleObject(overlapped->output_queue_semaphore, timeout);
switch (result) {
- // The semaphore object was signaled.
+ /* The semaphore object was signaled. */
case WAIT_OBJECT_0:
EnterCriticalSection(&overlapped->output_queue_cs);
@@ -160,9 +168,9 @@ static tun_buffer_t* get_buffer_from_output_queue(tap_win32_overlapped_t* const
LeaveCriticalSection(&overlapped->output_queue_cs);
break;
- // 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;
}
@@ -420,20 +428,20 @@ static void tap_win32_overlapped_init(tap_win32_overlapped_t* const overlapped,
InitializeCriticalSection(&overlapped->free_list_cs);
overlapped->output_queue_semaphore = 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 */
if (!overlapped->output_queue_semaphore) {
fprintf(stderr, "error creating output queue semaphore!\n");
}
overlapped->free_list_semaphore = 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 */
if (!overlapped->free_list_semaphore) {
fprintf(stderr, "error creating free list semaphore!\n");
--
2.29.1.59.gf9b6481aed
next prev parent reply other threads:[~2020-12-22 14:03 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-12-22 8:23 [PATCH 0/9] Fix some style problems in net Zhang Han
2020-12-22 8:23 ` [PATCH 1/9] net: Add spaces around operator/delete redundant spaces Zhang Han
2020-12-22 8:23 ` [PATCH 2/9] net: Add braces for statements/fix braces' position Zhang Han
2020-12-22 8:23 ` Zhang Han [this message]
2020-12-22 8:23 ` [PATCH 4/9] net: Transfer "foo* " to "foo *" Zhang Han
2020-12-22 8:23 ` [PATCH 5/9] net: Fix lines over 90 characters Zhang Han
2020-12-22 8:23 ` [PATCH 6/9] net: Transfer tabs to spcaes Zhang Han
2021-01-14 11:34 ` Philippe Mathieu-Daudé
2020-12-22 8:23 ` [PATCH 7/9] net: Remove assignment in if condition Zhang Han
2021-01-14 11:35 ` Philippe Mathieu-Daudé
2020-12-22 8:23 ` [PATCH 8/9] net: Remove initialization of static ints Zhang Han
2020-12-22 8:23 ` [PATCH 9/9] net: Fix the indent problems Zhang Han
2020-12-22 17:00 ` [PATCH 0/9] Fix some style problems in net no-reply
2021-01-14 2:34 ` zhanghan (J)
2021-02-01 6:18 ` zhanghan (J)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20201222082340.67405-4-zhanghan64@huawei.com \
--to=zhanghan64@huawei.com \
--cc=alex.chen@huawei.com \
--cc=hang.zhanghailiang@huawei.com \
--cc=hunongda@huawei.com \
--cc=jasowang@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-trivial@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).