Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Bdd/Targets/Common/BddTargetAppName.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#include <stdbool.h>
#include <string.h>

/* Length of ".exe" used to recognise and strip the Windows executable
/* Length of ".exe" - used to recognise and strip the Windows executable
extension so the syslog app name omits it regardless of build platform. */
enum
{
Expand Down
2 changes: 1 addition & 1 deletion Bdd/Targets/Common/BddTargetCustomSd.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#include "SolidSyslogSdValue.h"
#include "SolidSyslogStructuredDataDefinition.h"

/* IANA-reserved "example" Private Enterprise Number safe for documentation. */
/* IANA-reserved "example" Private Enterprise Number - safe for documentation. */
enum
{
EXAMPLE_ENTERPRISE_NUMBER = 32473U
Expand Down
2 changes: 1 addition & 1 deletion Bdd/Targets/Common/BddTargetCustomSd.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ SOLIDSYSLOG_EXTERN_C_BEGIN

/* The worked custom SD-ELEMENT for the integrator guide
* (docs/structured-data.md). Emits [example@32473 detail="Hello World"].
* Stateless singleton handed to SolidSyslog_LogWithSd by the
* Stateless singleton - handed to SolidSyslog_LogWithSd by the
* `send-custom` interactive command. */
struct SolidSyslogStructuredData* BddTargetCustomSd_Get(void);

Expand Down
12 changes: 6 additions & 6 deletions Bdd/Targets/Common/BddTargetFatFsMount.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* ChaN-FatFs implementation of the shared pipeline's FS-mount seam see
/* ChaN-FatFs implementation of the shared pipeline's FS-mount seam - see
* BddTargetFatFsMount.h. Extracted from BddTargetFreeRtosPipeline.c in
* SolidSyslog S29.05 when the two FreeRTOS targets first diverged on the
* filesystem (FatFs on lwIP, FreeRTOS-Plus-FAT on Plus-TCP). The logic here is
Expand All @@ -9,12 +9,12 @@

#include "SolidSyslogFatFsFile.h"

#include "ff.h" /* f_mount / f_mkfs eager mount-or-format on the `set store file` rebuild trigger. */
#include "ff.h" /* f_mount / f_mkfs - eager mount-or-format on the `set store file` rebuild trigger. */

#include <stdio.h>

/* FATFS object lives in .bss because f_mount stores its address inside the FatFs
* volume registry the object must outlive every f_open / f_stat / f_unlink.
* volume registry - the object must outlive every f_open / f_stat / f_unlink.
* One per volume (FF_VOLUMES = 1). */
static FATFS fatfs;
static bool fatfsMounted = false;
Expand All @@ -25,10 +25,10 @@ bool BddTargetFatFsMount_Mount(void)
{
return true;
}
FRESULT res = f_mount(&fatfs, "", 1); /* opt=1 mount immediately, surface FR_NO_FILESYSTEM here */
FRESULT res = f_mount(&fatfs, "", 1); /* opt=1 -> mount immediately, surface FR_NO_FILESYSTEM here */
if (res == FR_NO_FILESYSTEM)
{
/* Fresh disk image lay down a FAT and re-mount. FM_FAT keeps the
/* Fresh disk image - lay down a FAT and re-mount. FM_FAT keeps the
* formatter on FAT12/16; at the shared 8 MiB geometry auto cluster
* sizing clears the ~4085-cluster boundary, so this lands FAT16 (the
* geometry the FreeRTOS-Plus-FAT formatter needs on the sibling
Expand Down Expand Up @@ -67,6 +67,6 @@ struct SolidSyslogFile* BddTargetFatFsMount_CreateFile(void)

void BddTargetFatFsMount_DestroyFile(struct SolidSyslogFile* file)
{
/* FatFsFile_Destroy Close f_close flushes the underlying FIL's dir entry. */
/* FatFsFile_Destroy -> Close -> f_close flushes the underlying FIL's dir entry. */
SolidSyslogFatFsFile_Destroy(file);
}
2 changes: 1 addition & 1 deletion Bdd/Targets/Common/BddTargetFatFsMount.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ SOLIDSYSLOG_EXTERN_C_BEGIN
* (BddTargetPlusFatMount). */

/* Mount volume 0, formatting on first use if the disk image has no FAT
* yet. Idempotent repeated calls short-circuit on the mounted flag.
* yet. Idempotent - repeated calls short-circuit on the mounted flag.
* Returns false on an unrecoverable mount/format failure so the caller
* can leave the target on its original store. */
bool BddTargetFatFsMount_Mount(void);
Expand Down
52 changes: 26 additions & 26 deletions Bdd/Targets/Common/BddTargetFreeRtosPipeline.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Shared FreeRTOS BDD-target pipeline see BddTargetFreeRtosPipeline.h.
/* Shared FreeRTOS BDD-target pipeline - see BddTargetFreeRtosPipeline.h.
*
* Extracted from the two near-identical FreeRTOS target main.c files
* (Bdd/Targets/FreeRtos = FreeRTOS-Plus-TCP, Bdd/Targets/FreeRtosLwip = lwIP)
Expand Down Expand Up @@ -55,7 +55,7 @@
/* Unprivileged mirror of SOLIDSYSLOG_UDP_DEFAULT_PORT (514) for BDD listeners. */
#define BDD_TARGET_UDP_PORT 5514U

/* The injected platform seam set once via BddTargetFreeRtosPipeline_SetConfig
/* The injected platform seam - set once via BddTargetFreeRtosPipeline_SetConfig
* before the tasks run. */
static const struct BddTargetFreeRtosPipelineConfig* g_config = NULL;

Expand Down Expand Up @@ -99,8 +99,8 @@ static volatile bool solidSyslogTeardown = false;

/* File-backed store storage. Lives in .bss so it persists across the `set store
* file` rebuild; only populated when that command fires. STORE_PATH_PREFIX is
* "/STORE" sequence-numbered filenames land at the volume root as
* /STORE00.log, /STORE01.log, which fit 8.3 short-filename mode. The leading
* "/STORE" - sequence-numbered filenames land at the volume root as
* /STORE00.log, /STORE01.log, ... which fit 8.3 short-filename mode. The leading
* slash makes the path absolute: ChaN-FatFs treats it as the default-drive root
* (unchanged behaviour), and FreeRTOS-Plus-FAT's ff_stdio requires an absolute
* path when ffconfigHAS_CWD is 0 (its prvABSPath is a pass-through). */
Expand Down Expand Up @@ -131,11 +131,11 @@ static size_t pendingCapacityThreshold = 0;
* DestroyCurrentStore can release it. */
static const char* pendingSecurityPolicy = "crc16";
static struct SolidSyslogSecurityPolicy* currentPolicy = NULL;
/* The policy kind captured when currentPolicy was built DestroySecurityPolicy
/* The policy kind captured when currentPolicy was built - DestroySecurityPolicy
* must dispatch on this, NOT pendingSecurityPolicy, which a later `set
* security-policy` can change out from under the installed policy. */
static const char* installedSecurityPolicy = "crc16";
/* When true, SolidSyslog gets only the meta SD timeQuality and origin are
/* When true, SolidSyslog gets only the meta SD - timeQuality and origin are
* dropped. Mirrors Linux's --no-sd. */
static volatile bool pendingNoSd = false;

Expand Down Expand Up @@ -224,7 +224,7 @@ static void GetAppName(struct SolidSyslogHeaderField* field, void* context)
SolidSyslogHeaderField_PrintUsAscii(field, appName, strlen(appName));
}

/* No RTC and no time-sync on these reference targets RFC 5424 §6.2.3.1
/* No RTC and no time-sync on these reference targets - RFC 5424 §6.2.3.1
* mandates NILVALUE TIMESTAMP, and the timeQuality SD reports tzKnown=0,
* isSynced=0. SolidSyslogConfig.Clock=NULL drops through to the library's
* NilClock. */
Expand Down Expand Up @@ -350,7 +350,7 @@ static bool OnSet(const char* name, const char* value)
{
return false;
}
/* String literal storage target_driver.py emits one of the three
/* String literal storage - target_driver.py emits one of the three
* literals so the pointer stays valid (no copy needed). */
pendingDiscardPolicy =
(strcmp(value, "newest") == 0) ? "newest" : ((strcmp(value, "halt") == 0) ? "halt" : "oldest");
Expand All @@ -363,7 +363,7 @@ static bool OnSet(const char* name, const char* value)
{
return false;
}
/* String literal storage see discard-policy above. */
/* String literal storage - see discard-policy above. */
if (strcmp(value, "hmac-sha256") == 0)
{
pendingSecurityPolicy = "hmac-sha256";
Expand Down Expand Up @@ -406,7 +406,7 @@ static bool OnSet(const char* name, const char* value)
}
if (strcmp(name, "no-sd") == 0)
{
/* `set no-sd 1` drops the SD list to only metaSd mirrors Linux's
/* `set no-sd 1` drops the SD list to only metaSd - mirrors Linux's
* --no-sd. Takes effect via SolidSyslog re-Create. */
unsigned long parsed = 0U;
if (!TryParseUInt(value, &parsed))
Expand All @@ -418,7 +418,7 @@ static bool OnSet(const char* name, const char* value)
}
if (strcmp(name, "store") == 0)
{
/* "null" is the default state accept it as a no-op so the harness can
/* "null" is the default state - accept it as a no-op so the harness can
* pass --store null without special-casing. "file" triggers the rebuild
* (one-way for the lifetime of this QEMU instance). */
if (strcmp(value, "null") == 0)
Expand Down Expand Up @@ -482,7 +482,7 @@ static bool TryParseUInt(const char* value, unsigned long* out)
}

/* DEMO KEY ONLY. A real integrator supplies key material from a secure element,
* a KDF, or encrypted NVM via their own SolidSyslogKeyFunction never a
* a KDF, or encrypted NVM via their own SolidSyslogKeyFunction - never a
* hard-coded constant. This exists so the BDD scenario can exercise the mbedTLS
* HMAC-SHA256 / AES-256-GCM at-rest policies end-to-end with real crypto. */
static bool BddDemoGetKey(void* context, uint8_t* keyOut, size_t capacity, size_t* keyLengthOut)
Expand Down Expand Up @@ -514,7 +514,7 @@ static struct SolidSyslogSecurityPolicy* CreateSecurityPolicy(void)
else if (strcmp(pendingSecurityPolicy, "aes-256-gcm") == 0)
{
/* Reuse the TLS module's already-seeded CTR-DRBG as the AEAD nonce
* source see BddTargetTlsSender_GetRng. Not static const: Rng is a
* source - see BddTargetTlsSender_GetRng. Not static const: Rng is a
* runtime handle. */
const struct SolidSyslogMbedTlsAesGcmPolicyConfig aesConfig =
{BddDemoGetKey, NULL, BddTargetTlsSender_GetRng()};
Expand All @@ -534,12 +534,12 @@ static struct SolidSyslogSecurityPolicy* CreateSecurityPolicy(void)
/* `set store file` trigger: swap the default NullStore for a file-backed
* BlockStore over the platform FS-mount seam. One-way for the lifetime of this
* QEMU instance. The lifecycle mutex blocks the Service task across the
* Destroy re-Create transition. */
* Destroy -> re-Create transition. */
static bool RebuildWithFileStore(void)
{
SolidSyslogMutex_Lock(lifecycleMutex);

/* The FS layer does NOT auto-mount on first open mount (and
/* The FS layer does NOT auto-mount on first open - mount (and
* format-on-first-use) via the platform FS-mount seam before tearing down
* the existing store so a mount failure leaves the target running on the
* original NullStore (zero-disruption); return false so OnSet reports the
Expand Down Expand Up @@ -575,7 +575,7 @@ static bool RebuildWithFileStore(void)
currentStoreIsFile = true;

solidSyslogConfig.Store = currentStore;
/* Re-honour `set no-sd 1` if it arrived before this rebuild target_driver.py
/* Re-honour `set no-sd 1` if it arrived before this rebuild - target_driver.py
* sorts `set no-sd` before `set store file`, so the value is final here. */
solidSyslogConfig.SdCount = pendingNoSd ? 1U : (sizeof(sdList) / sizeof(sdList[0]));
solidSyslog = SolidSyslog_Create(&solidSyslogConfig);
Expand All @@ -598,7 +598,7 @@ static void DestroySecurityPolicy(void)
{
SolidSyslogCrc16Policy_Destroy();
}
/* else "null": the shared NullSecurityPolicy is immutable nothing to free. */
/* else "null": the shared NullSecurityPolicy is immutable - nothing to free. */
currentPolicy = NULL;
}

Expand All @@ -614,7 +614,7 @@ static void DestroyCurrentStore(void)
DestroySecurityPolicy();
g_config->DestroyStoreFile(storeFile);
}
/* else: NullStore is shared and immutable nothing to destroy. */
/* else: NullStore is shared and immutable - nothing to destroy. */
}

static enum SolidSyslogDiscardPolicy MapDiscardPolicy(const char* policy)
Expand All @@ -635,7 +635,7 @@ static void OnStoreFull(void* context)
(void) context;
if (pendingHaltExit)
{
/* Semihosting SYS_EXIT terminates QEMU with status 2 so the BDD
/* Semihosting SYS_EXIT - terminates QEMU with status 2 so the BDD
* harness sees the run end deterministically. Mirrors the Linux
* example's _exit(2). */
BddTargetFreeRtosPipeline_Exit(2);
Expand All @@ -656,8 +656,8 @@ static void OnThresholdCrossed(void* context)
(void) printf("[THRESHOLD-CROSSED]\r\n");
}

/* Full teardown of every shared resource. Two entry points `quit` (falls
* through after BddTargetInteractive_Run returns) and `set shutdown 1` both
/* Full teardown of every shared resource. Two entry points - `quit` (falls
* through after BddTargetInteractive_Run returns) and `set shutdown 1` - both
* route through here. The platform UnmountStore hook fires regardless so the
* next session's mount finds STORE*.log directory entries up-to-date
* (power_cycle_replay relies on this). The lifecycle mutex held across the
Expand All @@ -682,7 +682,7 @@ static void TeardownAll(void)

/* Wait for Service to observe the teardown flag and vTaskDelete itself
* before the lifecycle mutex is destroyed under it. Bounded so a Service
* task that never started (xTaskCreate failure NULL handle) cannot wedge
* task that never started (xTaskCreate failure -> NULL handle) cannot wedge
* teardown. */
if (serviceTaskHandle != NULL)
{
Expand All @@ -701,7 +701,7 @@ static void TeardownAll(void)

void BddTargetFreeRtosPipeline_Exit(int status)
{
/* SYS_EXIT_EXTENDED (0x20) the only ARM Semihosting exit form on AArch32
/* SYS_EXIT_EXTENDED (0x20) - the only ARM Semihosting exit form on AArch32
* that propagates a non-zero status: R1 points to a { reason, subcode }
* block. QEMU terminates the VM; the for(;;) is defensive. */
const struct
Expand Down Expand Up @@ -742,7 +742,7 @@ void BddTargetFreeRtosPipeline_InteractiveTask(void* argument)
* very first iteration without a NULL check. */
lifecycleMutex = SolidSyslogFreeRtosMutex_Create();

/* Default store is NullStore flipped to the file-backed BlockStore by
/* Default store is NullStore - flipped to the file-backed BlockStore by
* `set store file` via RebuildWithFileStore(). */
currentStore = SolidSyslogNullStore_Get();
currentStoreIsFile = false;
Expand Down Expand Up @@ -773,7 +773,7 @@ void BddTargetFreeRtosPipeline_InteractiveTask(void* argument)
.Clock = NULL,
.GetHostname = g_config->GetHostname,
.GetAppName = GetAppName,
/* PROCID RFC 5424 §6.2.6 NILVALUE: no process model on these targets. */
/* PROCID - RFC 5424 §6.2.6 NILVALUE: no process model on these targets. */
.GetProcessId = NULL,
.Store = currentStore,
.Sd = sdList,
Expand Down Expand Up @@ -809,7 +809,7 @@ void BddTargetFreeRtosPipeline_ServiceTask(void* argument)

/* Wait until the interactive task has finished initial Setup and created the
* lifecycle mutex / SolidSyslog. After that the mutex is the source of
* truth Setup, RebuildWithFileStore, and Teardown all hold it across their
* truth - Setup, RebuildWithFileStore, and Teardown all hold it across their
* Destroy/Create transitions. */
while ((lifecycleMutex == NULL) || !solidSyslogReady)
{
Expand Down
14 changes: 7 additions & 7 deletions Bdd/Targets/Common/BddTargetFreeRtosPipeline.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,19 @@
* the CircularBuffer + Service drain task, and the console glue. Both FreeRTOS
* BDD targets (Bdd/Targets/FreeRtos = FreeRTOS-Plus-TCP, Bdd/Targets/FreeRtosLwip
* = lwIP) drive this; their main.c files keep only the network backend and the
* FS-mount seam behind the config below the network adapter wiring (PlusTcp vs
* FS-mount seam behind the config below - the network adapter wiring (PlusTcp vs
* LwipRaw), the IP-stack bring-up, and the filesystem vendor (FreeRTOS-Plus-FAT
* vs ChaN-FatFs) that genuinely differ. See SolidSyslog S29.03 (network seam)
* and S29.05 (FS-mount seam). */

/* Forward declaration the FS-mount seam traffics in SolidSyslogFile handles
/* Forward declaration - the FS-mount seam traffics in SolidSyslogFile handles
* without the pipeline header pulling SolidSyslogFile.h. */
struct SolidSyslogFile;

/* The platform seam each target injects via BddTargetFreeRtosPipeline_SetConfig. */
struct BddTargetFreeRtosPipelineConfig
{
/* Default destination host before any `set host` numeric for the no-DNS
/* Default destination host before any `set host` - numeric for the no-DNS
* PlusTcp target ("10.0.2.2"); the DNS alias for lwIP ("syslog-ng"). */
const char* DefaultHost;
/* Bring up the platform network and build the (Switching) sender, with the
Expand All @@ -42,7 +42,7 @@ struct BddTargetFreeRtosPipelineConfig
* after the shared pipeline teardown (SolidSyslog / SD / store / buffer). */
void (*TeardownNetwork)(void);

/* FS-mount seam the FS-vendor-specific half of the file-backed store.
/* FS-mount seam - the FS-vendor-specific half of the file-backed store.
* The Plus-TCP target wires the FreeRTOS-Plus-FAT shim (BddTargetPlusFatMount);
* the lwIP target wires the ChaN-FatFs shim (BddTargetFatFsMount). The
* pipeline drives the store machinery (BlockStore / FileBlockDevice /
Expand All @@ -60,7 +60,7 @@ struct BddTargetFreeRtosPipelineConfig
/* Install the platform seam. Call once from main() before the tasks run. */
void BddTargetFreeRtosPipeline_SetConfig(const struct BddTargetFreeRtosPipelineConfig* config);

/* Endpoint callbacks (SolidSyslogEndpointFunction / VersionFunction shaped),
/* Endpoint callbacks (SolidSyslogEndpointFunction / ...VersionFunction shaped),
* reading the shared host/port that `set host` / `set port` rewrite. A target's
* BuildSender wires these into its UdpSender / StreamSender configs. */
void BddTargetFreeRtosPipeline_GetEndpoint(struct SolidSyslogEndpoint* endpoint, void* context);
Expand All @@ -74,14 +74,14 @@ void BddTargetFreeRtosPipeline_InitConsole(uint32_t uartBaseAddress);
* the CMSDK UART yield. */
void BddTargetFreeRtosPipeline_Sleep(int milliseconds);

/* ARM Semihosting SYS_EXIT terminates QEMU with the given status. Used
/* ARM Semihosting SYS_EXIT - terminates QEMU with the given status. Used
* internally by the `shutdown` / halt paths; exposed so a target's main() can
* bail out on an unrecoverable bring-up failure (e.g. xTaskCreate). */
void BddTargetFreeRtosPipeline_Exit(int status);

/* Stack depths as configMINIMAL_STACK_SIZE multipliers (the header cannot see
* the FreeRTOS config macro). Each main.c does the xTaskCreate so it controls
* the timing the PlusTcp target on the network-up hook, lwIP from main(). */
* the timing - the PlusTcp target on the network-up hook, lwIP from main(). */
#define BDD_TARGET_INTERACTIVE_STACK_MULTIPLIER 48U
#define BDD_TARGET_SERVICE_STACK_MULTIPLIER 16U

Expand Down
4 changes: 2 additions & 2 deletions Bdd/Targets/Common/BddTargetInteractive.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ enum
* can carry a full path-MTU-class message body without fgets
* splitting it across reads. The HandleSet name[] mirrors this size
* because the parser splits at the first whitespace; future work
* may decouple the name buffer (always short RFC 5424 maxima are
* 255 chars) from the line buffer. */
* may decouple the name buffer (always short - RFC 5424 maxima are
* <= 255 chars) from the line buffer. */
MAX_LINE_LENGTH = SOLIDSYSLOG_MAX_MESSAGE_SIZE
};

Expand Down
2 changes: 1 addition & 1 deletion Bdd/Targets/Common/BddTargetIps.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ enum
BDD_TARGET_IP_MAX = 64 /* matches ORIGIN_IP_MAX in OriginSd */
};

/* Static demo IP in real deployments this comes from getifaddrs(3) on POSIX,
/* Static demo IP - in real deployments this comes from getifaddrs(3) on POSIX,
GetAdaptersAddresses on Windows, or wherever the host's reachable addresses
are observed. The library supplies the callback shape; address enumeration
is opinionated and left to integrators.
Expand Down
2 changes: 1 addition & 1 deletion Bdd/Targets/Common/BddTargetMtlsConfig.c
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ void BddTargetMtlsConfig_GetEndpoint(struct SolidSyslogEndpoint* endpoint, void*
endpoint->Port = BddTargetMtlsConfig_GetPort();
}

/* Static config host/port never change, so version stays 0 forever and the
/* Static config - host/port never change, so version stays 0 forever and the
sender connects exactly once. */
uint32_t BddTargetMtlsConfig_GetEndpointVersion(void* context)
{
Expand Down
Loading
Loading