diff mbox series

channel_curl: make sourcetype configurable

Message ID 20180110152804.20163-1-christian.storm@siemens.com
State Accepted
Headers show
Series channel_curl: make sourcetype configurable | expand

Commit Message

Storm, Christian Jan. 10, 2018, 3:28 p.m. UTC
As channel_curl can be used generically, it should not
unconditionally report sourcetype=SOURCE_SURICATTA,
hence introduce a 'source' field in channel_data_t.

Signed-off-by: Christian Storm <christian.storm@siemens.com>
---
 corelib/channel_curl.c     | 2 +-
 include/channel_curl.h     | 1 +
 suricatta/server_hawkbit.c | 1 +
 3 files changed, 3 insertions(+), 1 deletion(-)

Comments

Stefano Babic Jan. 11, 2018, 1:34 p.m. UTC | #1
On 10/01/2018 16:28, Christian Storm wrote:
> As channel_curl can be used generically, it should not
> unconditionally report sourcetype=SOURCE_SURICATTA,
> hence introduce a 'source' field in channel_data_t.
> 
> Signed-off-by: Christian Storm <christian.storm@siemens.com>
> ---
>  corelib/channel_curl.c     | 2 +-
>  include/channel_curl.h     | 1 +
>  suricatta/server_hawkbit.c | 1 +
>  3 files changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/corelib/channel_curl.c b/corelib/channel_curl.c
> index 608f5d3..264b38e 100644
> --- a/corelib/channel_curl.c
> +++ b/corelib/channel_curl.c
> @@ -679,7 +679,7 @@ channel_op_res_t channel_get_file(channel_t *this, void *data, int file_handle)
>  
>  	if (file_handle == FD_USE_IPC) {
>  		for (int retries = 3; retries >= 0; retries--) {
> -			file_handle = ipc_inst_start_ext(SOURCE_SURICATTA,
> +			file_handle = ipc_inst_start_ext(channel_data->source,
>  				channel_data->info == NULL ? 0 : strlen(channel_data->info),
>  				channel_data->info);
>  			if (file_handle > 0)
> diff --git a/include/channel_curl.h b/include/channel_curl.h
> index 4b23cf8..8015eb5 100644
> --- a/include/channel_curl.h
> +++ b/include/channel_curl.h
> @@ -58,4 +58,5 @@ typedef struct {
>  	int (*checkdwl)(void);
>  	struct swupdate_digest *dgst;
>  	char sha1hash[SHA_DIGEST_LENGTH * 2 + 1];
> +	sourcetype source;
>  } channel_data_t;
> diff --git a/suricatta/server_hawkbit.c b/suricatta/server_hawkbit.c
> index 746f4a1..670c7ae 100644
> --- a/suricatta/server_hawkbit.c
> +++ b/suricatta/server_hawkbit.c
> @@ -140,6 +140,7 @@ server_hawkbit_t server_hawkbit = {.url = NULL,
>  				   .channel = NULL};
>  
>  static channel_data_t channel_data_defaults = {.debug = false,
> +					       .source = SOURCE_SURICATTA,
>  					       .retries = DEFAULT_RESUME_TRIES,
>  					       .retry_sleep =
>  						   DEFAULT_RESUME_DELAY,
> 
Applied to -master, thanks !

Best regards,
Stefano Babic
diff mbox series

Patch

diff --git a/corelib/channel_curl.c b/corelib/channel_curl.c
index 608f5d3..264b38e 100644
--- a/corelib/channel_curl.c
+++ b/corelib/channel_curl.c
@@ -679,7 +679,7 @@  channel_op_res_t channel_get_file(channel_t *this, void *data, int file_handle)
 
 	if (file_handle == FD_USE_IPC) {
 		for (int retries = 3; retries >= 0; retries--) {
-			file_handle = ipc_inst_start_ext(SOURCE_SURICATTA,
+			file_handle = ipc_inst_start_ext(channel_data->source,
 				channel_data->info == NULL ? 0 : strlen(channel_data->info),
 				channel_data->info);
 			if (file_handle > 0)
diff --git a/include/channel_curl.h b/include/channel_curl.h
index 4b23cf8..8015eb5 100644
--- a/include/channel_curl.h
+++ b/include/channel_curl.h
@@ -58,4 +58,5 @@  typedef struct {
 	int (*checkdwl)(void);
 	struct swupdate_digest *dgst;
 	char sha1hash[SHA_DIGEST_LENGTH * 2 + 1];
+	sourcetype source;
 } channel_data_t;
diff --git a/suricatta/server_hawkbit.c b/suricatta/server_hawkbit.c
index 746f4a1..670c7ae 100644
--- a/suricatta/server_hawkbit.c
+++ b/suricatta/server_hawkbit.c
@@ -140,6 +140,7 @@  server_hawkbit_t server_hawkbit = {.url = NULL,
 				   .channel = NULL};
 
 static channel_data_t channel_data_defaults = {.debug = false,
+					       .source = SOURCE_SURICATTA,
 					       .retries = DEFAULT_RESUME_TRIES,
 					       .retry_sleep =
 						   DEFAULT_RESUME_DELAY,