Do not use C99 // comments, thransfer // to /**/ Signed-off-by: Zhang Han <zhangha...@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