-
Notifications
You must be signed in to change notification settings - Fork 1
RDK-57502 - [RDKE] Migrate Operation Support Log Upload Related Scripts To C Implementation #34
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR refactors the RuntimeContext structure to simplify variable access by flattening nested sub-structures into a single flat structure. Previously, fields were organized into separate sub-structures (paths, flags, settings, device, endpoints, retry, certificates), requiring access patterns like ctx->paths.log_path. Now all fields are direct members of RuntimeContext, accessed as ctx->log_path.
Key Changes:
- Flattened
RuntimeContextstructure by removing 7 nested sub-structures - Updated all source and test files to use direct field access instead of nested access
- Maintained all field names and documentation
Reviewed changes
Copilot reviewed 26 out of 26 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| uploadstblogs/include/uploadstblogs_types.h | Removed nested struct definitions (UploadFlags, UploadSettings, PathConfig, EndpointConfig, DeviceInfo, CertificateConfig, RetryConfig) and flattened all fields into RuntimeContext |
| uploadstblogs/src/validation.c | Updated all field accesses from ctx->paths.* and ctx->settings.* to direct access |
| uploadstblogs/src/uploadstblogs.c | Updated all field accesses from ctx->flags.*, ctx->paths.*, ctx->device.*, and ctx->endpoints.* to direct access |
| uploadstblogs/src/strategy_selector.c | Updated all field accesses from ctx->flags.*, ctx->settings.*, ctx->device.*, and ctx->paths.* to direct access |
| uploadstblogs/src/strategy_reboot.c | Updated all field accesses from ctx->paths.*, ctx->settings.*, ctx->flags.*, and ctx->device.* to direct access |
| uploadstblogs/src/strategy_ondemand.c | Updated all field accesses from ctx->paths.*, ctx->flags.*, and ctx->device.* to direct access |
| uploadstblogs/src/strategy_handler.c | Updated field accesses from ctx->device.* to direct access |
| uploadstblogs/src/strategy_dcm.c | Updated all field accesses from ctx->paths.* and ctx->settings.* to direct access |
| uploadstblogs/src/retry_logic.c | Updated all field accesses from ctx->retry.* to direct access |
| uploadstblogs/src/path_handler.c | Updated all field accesses from ctx->endpoints.*, ctx->settings.*, and ctx->device.* to direct access |
| uploadstblogs/src/log_collector.c | Updated all field accesses from ctx->paths.* and ctx->settings.* to direct access |
| uploadstblogs/src/event_manager.c | Updated field accesses from ctx->device.* to direct access |
| uploadstblogs/src/context_manager.c | Updated all field accesses from all nested structures to direct access throughout initialization and loading functions |
| uploadstblogs/src/archive_manager.c | Updated all field accesses from ctx->device.* and ctx->paths.* to direct access |
| uploadstblogs/unittest/*.cpp (11 files) | Updated all test code to use direct field access instead of nested structure access |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 34 out of 34 changed files in this pull request and generated 1 comment.
Comments suppressed due to low confidence (1)
uploadstblogs/include/uploadstblogs_types.h:188
- The nested structure type definitions (UploadFlags, UploadSettings, PathConfig, EndpointConfig, DeviceInfo, CertificateConfig, RetryConfig) at lines 105-188 are no longer used after flattening RuntimeContext. These type definitions should be removed to avoid confusion and maintain code cleanliness, as they're now obsolete.
typedef struct {
int rrd_flag; /**< RRD mode flag */
int dcm_flag; /**< DCM mode flag */
int flag; /**< General upload flag */
int upload_on_reboot; /**< Upload on reboot flag */
int trigger_type; /**< Type of upload trigger */
} UploadFlags;
/**
* @struct UploadSettings
* @brief Boolean settings for upload behavior
*/
typedef struct {
bool privacy_do_not_share; /**< Privacy mode enabled */
bool ocsp_enabled; /**< OCSP validation enabled */
bool encryption_enable; /**< Encryption enabled */
bool direct_blocked; /**< Direct path blocked */
bool codebig_blocked; /**< CodeBig path blocked */
bool include_pcap; /**< Include PCAP files */
bool include_dri; /**< Include DRI logs */
bool tls_enabled; /**< TLS 1.2 support enabled */
bool maintenance_enabled; /**< Maintenance mode enabled */
} UploadSettings;
/**
* @struct PathConfig
* @brief File system paths and directories
*/
typedef struct {
char log_path[MAX_PATH_LENGTH]; /**< Main log directory */
char prev_log_path[MAX_PATH_LENGTH]; /**< Previous logs directory */
char archive_path[MAX_PATH_LENGTH]; /**< Archive output directory */
char rrd_file[MAX_PATH_LENGTH]; /**< RRD log file path */
char dri_log_path[MAX_PATH_LENGTH]; /**< DRI logs directory */
char temp_dir[MAX_PATH_LENGTH]; /**< Temporary directory */
char telemetry_path[MAX_PATH_LENGTH]; /**< Telemetry directory */
char dcm_log_file[MAX_PATH_LENGTH]; /**< DCM log file path */
char dcm_log_path[MAX_PATH_LENGTH]; /**< DCM log directory */
char iarm_event_binary[MAX_PATH_LENGTH]; /**< IARM event sender location */
} PathConfig;
/**
* @struct EndpointConfig
* @brief Upload endpoint URLs and links
*/
typedef struct {
char endpoint_url[MAX_URL_LENGTH]; /**< Upload endpoint URL */
char upload_http_link[MAX_URL_LENGTH]; /**< HTTP upload link */
char presign_url[MAX_URL_LENGTH]; /**< Pre-signed URL */
char proxy_bucket[MAX_URL_LENGTH]; /**< Proxy bucket for fallback uploads */
} EndpointConfig;
/**
* @struct DeviceInfo
* @brief Device identification information
*/
typedef struct {
char mac_address[MAX_MAC_LENGTH]; /**< Device MAC address */
char device_type[32]; /**< Device type (mediaclient, etc.) */
char build_type[32]; /**< Build type */
} DeviceInfo;
/**
* @struct CertificateConfig
* @brief TLS/mTLS certificate paths
*/
typedef struct {
char cert_path[MAX_CERT_PATH_LENGTH]; /**< Client certificate path */
char key_path[MAX_CERT_PATH_LENGTH]; /**< Private key path */
char ca_cert_path[MAX_CERT_PATH_LENGTH]; /**< CA certificate path */
} CertificateConfig;
/**
* @struct RetryConfig
* @brief Retry and timeout configuration
*/
typedef struct {
int direct_max_attempts; /**< Max attempts for direct path */
int codebig_max_attempts; /**< Max attempts for CodeBig path */
int direct_retry_delay; /**< Retry delay for direct (seconds) */
int codebig_retry_delay; /**< Retry delay for CodeBig (seconds) */
int curl_timeout; /**< Curl operation timeout */
int curl_tls_timeout; /**< TLS handshake timeout */
} RetryConfig;
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 36 out of 36 changed files in this pull request and generated 4 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| bool maintenance_enabled; /**< Maintenance mode enabled */ | ||
|
|
||
| } UploadSettings; | ||
|
|
Copilot
AI
Dec 30, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Empty line removed from the structure definition. While this doesn't affect functionality, it changes the structure formatting which appears inconsistent with the rest of the type definitions in this file.
| #include "strategy_handler.h" | ||
| #include "log_collector.h" | ||
| #include "archive_manager.h" | ||
| #include "archive_manager.h" |
Copilot
AI
Dec 30, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Duplicate include directive. Line 39 includes "archive_manager.h" but line 40 also includes the same file. Remove one of the duplicate includes.
| #include "archive_manager.h" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 37 out of 37 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 39 out of 39 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 39 out of 40 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 40 out of 41 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 40 out of 41 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Reason for change: Migrate uploadSTBlogs.sh to C implementation
Test Procedure: Focused Regression
Risks: Low
Signed-off-by: Abhinav P V Abhinav_Valappil@comcast.com