diff mbox series

[5/6] suricatta: factorize map_channel_retcode

Message ID 20180920114033.31082-5-sbabic@denx.de
State Accepted
Headers show
Series [1/6] suricatta: factorize channel default values | expand

Commit Message

Stefano Babic Sept. 20, 2018, 11:40 a.m. UTC
Signed-off-by: Stefano Babic <sbabic@denx.de>
---
 suricatta/common.c            | 23 +++++++++++++++++++++++
 suricatta/server_hawkbit.c    | 24 ------------------------
 suricatta/suricatta_private.h |  1 +
 3 files changed, 24 insertions(+), 24 deletions(-)
diff mbox series

Patch

diff --git a/suricatta/common.c b/suricatta/common.c
index a5e5e10..2e085c2 100644
--- a/suricatta/common.c
+++ b/suricatta/common.c
@@ -41,3 +41,26 @@  void suricatta_channel_settings(void *elem, channel_data_t *chan)
 	if (strlen(tmp))
 		SETSTRING(chan->proxy, tmp);
 }
+
+server_op_res_t map_channel_retcode(channel_op_res_t response)
+{
+	switch (response) {
+	case CHANNEL_ENONET:
+	case CHANNEL_EAGAIN:
+		return SERVER_EAGAIN;
+	case CHANNEL_EACCES:
+		return SERVER_EACCES;
+	case CHANNEL_ENOENT:
+	case CHANNEL_EIO:
+	case CHANNEL_EILSEQ:
+	case CHANNEL_ENOMEM:
+	case CHANNEL_EINIT:
+	case CHANNEL_ELOOP:
+		return SERVER_EERR;
+	case CHANNEL_EBADMSG:
+		return SERVER_EBADMSG;
+	case CHANNEL_OK:
+		return SERVER_OK;
+	}
+	return SERVER_EERR;
+}
diff --git a/suricatta/server_hawkbit.c b/suricatta/server_hawkbit.c
index b6f0407..02767e9 100644
--- a/suricatta/server_hawkbit.c
+++ b/suricatta/server_hawkbit.c
@@ -81,7 +81,6 @@  static hawkbit_enums_t hawkbit_enums[] = {
 extern channel_op_res_t channel_curl_init(void);
 /* Prototypes for "internal" functions */
 /* Note that they're not `static` so that they're callable from unit tests. */
-server_op_res_t map_channel_retcode(channel_op_res_t response);
 server_op_res_t server_handle_initial_state(update_state_t stateovrrd);
 static int server_update_status_callback(ipc_message *msg);
 int server_update_done_callback(RECOVERY_STATUS status);
@@ -254,29 +253,6 @@  static void check_action_changed(int action_id, const char *update_action)
 	}
 }
 
-server_op_res_t map_channel_retcode(channel_op_res_t response)
-{
-	switch (response) {
-	case CHANNEL_ENONET:
-	case CHANNEL_EAGAIN:
-		return SERVER_EAGAIN;
-	case CHANNEL_EACCES:
-		return SERVER_EACCES;
-	case CHANNEL_ENOENT:
-	case CHANNEL_EIO:
-	case CHANNEL_EILSEQ:
-	case CHANNEL_ENOMEM:
-	case CHANNEL_EINIT:
-	case CHANNEL_ELOOP:
-		return SERVER_EERR;
-	case CHANNEL_EBADMSG:
-		return SERVER_EBADMSG;
-	case CHANNEL_OK:
-		return SERVER_OK;
-	}
-	return SERVER_EERR;
-}
-
 server_op_res_t server_send_cancel_reply(channel_t *channel, const int action_id)
 {
 	assert(server_hawkbit.url != NULL);
diff --git a/suricatta/suricatta_private.h b/suricatta/suricatta_private.h
index 32ec2c4..b31c6c7 100644
--- a/suricatta/suricatta_private.h
+++ b/suricatta/suricatta_private.h
@@ -12,3 +12,4 @@ 
 #include <util.h>
 
 void suricatta_channel_settings(void *elem, channel_data_t *chan);
+server_op_res_t map_channel_retcode(channel_op_res_t response);