rewrite comments into one, unified style

This commit is contained in:
maksw committed 2026-06-15 10:17:48 +02:00
1 parent 6260de0085
commit 467a58c9c6
163 files changed
+3560 -2556

No files matched your search

+9 -1
View File
@@ -1,4 +1,5 @@
// net_device.c - minimal network-device registry and stack-provider RX handoff.
// Network device registry. This file owns net-device registration and RX handoff to the active stack provider.
#include <stdint.h>
#include <stddef.h>
#include <stdbool.h>
@@ -14,6 +15,7 @@ static NET_DEVICE* gNetDevices[NET_MAX_DEVICES];
static uint32_t gNetDeviceCount = 0;
static SPINLOCK gNetLock = SPINLOCK_INIT;
// Implements the net Make Default Name operation.
static void NetMakeDefaultName(NET_DEVICE* device, uint32_t index) {
if (!device || device->Name[0])
return;
@@ -25,6 +27,7 @@ static void NetMakeDefaultName(NET_DEVICE* device, uint32_t index) {
device->Name[4] = '\0';
}
// Implements the net Is Device Registered Locked operation.
static bool NetIsDeviceRegisteredLocked(const NET_DEVICE* device) {
for (uint32_t i = 0; i < gNetDeviceCount; ++i) {
if (gNetDevices[i] == device)
@@ -33,10 +36,12 @@ static bool NetIsDeviceRegisteredLocked(const NET_DEVICE* device) {
return false;
}
// Implements the net Device Has Ethernet Address operation.
static bool NetDeviceHasEthernetAddress(const NET_DEVICE* device) {
return device && device->HardwareAddressLength == NET_ETHERNET_ADDRESS_LENGTH;
}
// Implements the net Log Hardware Address operation.
static void NetLogHardwareAddress(const NET_DEVICE* device) {
if (NetDeviceHasEthernetAddress(device)) {
DbgPrint("%02x:%02x:%02x:%02x:%02x:%02x",
@@ -48,6 +53,7 @@ static void NetLogHardwareAddress(const NET_DEVICE* device) {
}
}
// Implements the net Register Device operation.
__declspec(dllexport) KSTATUS NetRegisterDevice(NET_DEVICE* device) {
if (!device || !device->SendFrame)
return STATUS_INVALID_PARAMETER;
@@ -90,6 +96,7 @@ __declspec(dllexport) KSTATUS NetRegisterDevice(NET_DEVICE* device) {
return STATUS_SUCCESS;
}
// Implements the net Get Device Count operation.
__declspec(dllexport) uint32_t NetGetDeviceCount(void) {
uintptr_t flags = KeAcquireSpinlock(&gNetLock);
uint32_t count = gNetDeviceCount;
@@ -97,6 +104,7 @@ __declspec(dllexport) uint32_t NetGetDeviceCount(void) {
return count;
}
// Implements the net Get Device operation.
__declspec(dllexport) NET_DEVICE* NetGetDevice(uint32_t index) {
uintptr_t flags = KeAcquireSpinlock(&gNetLock);
NET_DEVICE* device = (index < gNetDeviceCount) ? gNetDevices[index] : (NET_DEVICE*)0;