From 3478c67964a9df751e3319f7355273f036140a62 Mon Sep 17 00:00:00 2001 From: Nodir Temirkhodjaev Date: Sat, 17 Feb 2018 08:50:37 +0500 Subject: [PATCH] Driver: Fix comments. --- src/driver/fortdrv.c | 16 ++++++++-------- src/driver/fortpkt.c | 22 +++++++++++----------- src/driver/fortstat.c | 10 +++++----- src/driver/forttmr.c | 4 ++-- 4 files changed, 26 insertions(+), 26 deletions(-) diff --git a/src/driver/fortdrv.c b/src/driver/fortdrv.c index a4971248..243abf52 100644 --- a/src/driver/fortdrv.c +++ b/src/driver/fortdrv.c @@ -3,7 +3,7 @@ #define NDIS_WDM 1 #define NDIS630 1 -#define WIN9X_COMPAT_SPINLOCK // XXX: Support Windows 7: KeInitializeSpinLock() +#define WIN9X_COMPAT_SPINLOCK /* XXX: Support Windows 7: KeInitializeSpinLock() */ #include #include @@ -230,7 +230,7 @@ fort_callout_classify_v4 (const FWPS_INCOMING_VALUES0 *inFixedValues, remote_ip = inFixedValues->incomingValue[remoteIpField].value.uint32; if ((flags & FWP_CONDITION_FLAG_IS_LOOPBACK) - || remote_ip == 0xFFFFFFFF) { // Local broadcast + || remote_ip == 0xFFFFFFFF) { /* Local broadcast */ fort_callout_classify_permit(filter, classifyOut); return; } @@ -239,7 +239,7 @@ fort_callout_classify_v4 (const FWPS_INCOMING_VALUES0 *inFixedValues, if (conf_ref == NULL) { if (g_device->prov_boot || ((flags & FWP_CONDITION_FLAG_IS_REAUTHORIZE) - && !g_device->was_conf)) { // Block existing flows after driver installation to use flow-contexts + && !g_device->was_conf)) { /* Block existing flows after driver installation to use flow-contexts */ fort_callout_classify_block(classifyOut); } else { fort_callout_classify_continue(classifyOut); @@ -260,7 +260,7 @@ fort_callout_classify_v4 (const FWPS_INCOMING_VALUES0 *inFixedValues, goto block; process_id = (UINT32) inMetaValues->processId; - path_len = inMetaValues->processPath->size - sizeof(WCHAR); // chop terminating zero + path_len = inMetaValues->processPath->size - sizeof(WCHAR); /* chop terminating zero */ path = inMetaValues->processPath->data; if (fort_conf_ip_inet_included(&conf_ref->conf, remote_ip)) { @@ -787,7 +787,7 @@ fort_callout_timer_force (void) KLOCK_QUEUE_HANDLE lock_queue; KeAcquireInStackQueuedSpinLock(&g_device->conf_lock, &lock_queue); - fort_callout_timer(); // Should be called from DISPATCH_LEVEL! + fort_callout_timer(); /* Should be called from DISPATCH_LEVEL! */ KeReleaseInStackQueuedSpinLock(&lock_queue); } @@ -804,7 +804,7 @@ fort_device_create (PDEVICE_OBJECT device, PIRP irp) KeAcquireInStackQueuedSpinLock(&g_device->conf_lock, &lock_queue); if (g_device->is_opened) { - status = STATUS_SHARING_VIOLATION; // Only one client may connect + status = STATUS_SHARING_VIOLATION; /* Only one client may connect */ } else { g_device->is_opened = TRUE; } @@ -1028,8 +1028,8 @@ fort_driver_unload (PDRIVER_OBJECT driver) static NTSTATUS fort_bfe_wait (void) { LARGE_INTEGER delay; - delay.QuadPart = -5000000; // sleep 500000us (500ms) - int count = 600; // wait for 5 minutes + delay.QuadPart = -5000000; /* sleep 500000us (500ms) */ + int count = 600; /* wait for 5 minutes */ do { const FWPM_SERVICE_STATE state = FwpmBfeStateGet0(); diff --git a/src/driver/fortpkt.c b/src/driver/fortpkt.c index 73b88d81..42a9eca4 100644 --- a/src/driver/fortpkt.c +++ b/src/driver/fortpkt.c @@ -15,20 +15,20 @@ #define TCP_FLAG_CWR 0x0080 typedef struct tcp_header { - UINT16 source; // Source Port - UINT16 dest; // Destination Port + UINT16 source; /* Source Port */ + UINT16 dest; /* Destination Port */ - UINT32 seq; // Sequence number - UINT32 ack_seq; // Acknowledgement number + UINT32 seq; /* Sequence number */ + UINT32 ack_seq; /* Acknowledgement number */ - UCHAR res1 : 4; // Unused - UCHAR doff : 4; // Data offset + UCHAR res1 : 4; /* Unused */ + UCHAR doff : 4; /* Data offset */ - UCHAR flags; // Flags + UCHAR flags; /* Flags */ - UINT16 window; // Window size - UINT16 csum; // Checksum - UINT16 urg_ptr; // Urgent Pointer + UINT16 window; /* Window size */ + UINT16 csum; /* Checksum */ + UINT16 urg_ptr; /* Urgent Pointer */ } TCP_HEADER, *PTCP_HEADER; typedef struct fort_packet_in { @@ -143,7 +143,7 @@ fort_defer_add (PFORT_DEFER defer, } else { const tommy_count_t size = tommy_arrayof_size(&defer->packets); - // TODO: tommy_arrayof_grow(): check calloc()'s result for NULL + /* TODO: tommy_arrayof_grow(): check calloc()'s result for NULL */ if (tommy_arrayof_grow(&defer->packets, size + 1), 0) { status = STATUS_INSUFFICIENT_RESOURCES; goto end; diff --git a/src/driver/fortstat.c b/src/driver/fortstat.c index 0e36bf9e..7a5c464c 100644 --- a/src/driver/fortstat.c +++ b/src/driver/fortstat.c @@ -324,7 +324,7 @@ fort_stat_flow_add (PFORT_STAT stat, UINT64 flow_id, } else { const tommy_count_t size = tommy_arrayof_size(&stat->flows); - // TODO: tommy_arrayof_grow(): check calloc()'s result for NULL + /* TODO: tommy_arrayof_grow(): check calloc()'s result for NULL */ if (tommy_arrayof_grow(&stat->flows, size + 1), 0) return STATUS_INSUFFICIENT_RESOURCES; @@ -491,7 +491,7 @@ fort_stat_flow_delete (PFORT_STAT stat, UINT64 flowContext) PFORT_STAT_FLOW flow = (PFORT_STAT_FLOW) flowContext; if (stat->closed) - return; // double check to avoid deadlock after remove-flow-context + return; /* double check to avoid deadlock after remove-flow-context */ KeAcquireInStackQueuedSpinLock(&stat->lock, &lock_queue); if (!stat->closed) { @@ -515,7 +515,7 @@ fort_stat_flow_classify (PFORT_STAT stat, UINT64 flowContext, UINT32 *proc_bytes = inbound ? &proc->traf.in_bytes : &proc->traf.out_bytes; - // Add traffic to process + /* Add traffic to process */ *proc_bytes += data_len; if (flow->opt.speed_limit) { @@ -531,7 +531,7 @@ fort_stat_flow_classify (PFORT_STAT stat, UINT64 flowContext, UCHAR defer_flow = TRUE; if (*group_bytes < limit_bytes) { - // Add traffic to app. group + /* Add traffic to app. group */ *group_bytes += data_len; defer_flow = (*group_bytes >= limit_bytes); @@ -539,7 +539,7 @@ fort_stat_flow_classify (PFORT_STAT stat, UINT64 flowContext, limited = TRUE; } - // Defer ACK + /* Defer ACK */ if (inbound) { flow->opt.defer_out = defer_flow; } else { diff --git a/src/driver/forttmr.c b/src/driver/forttmr.c index 3f018865..90418b8f 100644 --- a/src/driver/forttmr.c +++ b/src/driver/forttmr.c @@ -54,9 +54,9 @@ fort_timer_update (PFORT_TIMER timer, BOOL run) timer->running = run; if (run) { - const LONG period = 500; // 500ms + const LONG period = 500; /* 500ms */ LARGE_INTEGER due; - due.QuadPart = period * -10000; // 500000us + due.QuadPart = period * -10000; /* 500000us */ KeSetTimerEx(&timer->id, due, period, &timer->dpc); } else {