diff mbox series

[V2,05/10] IPC: drop source parameter

Message ID 20201113083108.12567-6-sbabic@denx.de
State Changes Requested
Headers show
Series Rework and extend IPC for install | expand

Commit Message

Stefano Babic Nov. 13, 2020, 8:31 a.m. UTC
source is part of the request structure passed to the IPC interface and
does not need to be explicitely set.

Signed-off-by: Stefano Babic <sbabic@denx.de>
---
 bindings/lua_swupdate.c       | 5 ++++-
 corelib/channel_curl.c        | 3 +--
 include/network_ipc.h         | 2 +-
 ipc/network_ipc-if.c          | 2 +-
 ipc/network_ipc.c             | 4 ++--
 mongoose/mongoose_interface.c | 2 +-
 6 files changed, 10 insertions(+), 8 deletions(-)
diff mbox series

Patch

diff --git a/bindings/lua_swupdate.c b/bindings/lua_swupdate.c
index d17a596..3172152 100644
--- a/bindings/lua_swupdate.c
+++ b/bindings/lua_swupdate.c
@@ -130,6 +130,7 @@  static luaL_Reg ctrl_methods[] = {
  */
 static int ctrl_connect(lua_State *L) {
 	struct ctrl_obj *p = (struct ctrl_obj *) auxiliar_checkclass(L, "swupdate_control", 1);
+	struct swupdate_request req;
 	if (p->socket != -1) {
 		lua_pop(L, 1);
 		lua_pushnil(L);
@@ -137,7 +138,9 @@  static int ctrl_connect(lua_State *L) {
 		return 2;
 	}
 
-	int connfd = ipc_inst_start_ext(SOURCE_LOCAL, NULL, 0);
+	swupdate_prepare_req(&req);
+	req.source = SOURCE_LOCAL;
+	int connfd = ipc_inst_start_ext(&req, sizeof(req));
 	if (connfd < 0) {
 		lua_pop(L, 1);
 		lua_pushnil(L);
diff --git a/corelib/channel_curl.c b/corelib/channel_curl.c
index bf39063..a3e785f 100644
--- a/corelib/channel_curl.c
+++ b/corelib/channel_curl.c
@@ -1046,8 +1046,7 @@  channel_op_res_t channel_get_file(channel_t *this, void *data)
 			  sizeof(req.info) - 1 );
 	}
 	for (int retries = 3; retries >= 0; retries--) {
-		file_handle = ipc_inst_start_ext(channel_data->source,
-			&req, sizeof(struct swupdate_request));
+		file_handle = ipc_inst_start_ext( &req, sizeof(struct swupdate_request));
 		if (file_handle > 0)
 			break;
 		sleep(1);
diff --git a/include/network_ipc.h b/include/network_ipc.h
index 238709f..9558183 100644
--- a/include/network_ipc.h
+++ b/include/network_ipc.h
@@ -104,7 +104,7 @@  typedef struct {
 
 char *get_ctrl_socket(void);
 int ipc_inst_start(void);
-int ipc_inst_start_ext(sourcetype source, void *priv, ssize_t size);
+int ipc_inst_start_ext(void *priv, ssize_t size);
 int ipc_send_data(int connfd, char *buf, int size);
 void ipc_end(int connfd);
 int ipc_get_status(ipc_message *msg);
diff --git a/ipc/network_ipc-if.c b/ipc/network_ipc-if.c
index ba521ec..fb59339 100644
--- a/ipc/network_ipc-if.c
+++ b/ipc/network_ipc-if.c
@@ -122,7 +122,7 @@  int swupdate_async_start(writedata wr_func, getstatus status_func,
 	rq->get = status_func;
 	rq->end = end_func;
 
-	connfd = ipc_inst_start_ext(SOURCE_UNKNOWN, priv, size);
+	connfd = ipc_inst_start_ext(priv, size);
 
 	if (connfd < 0)
 		return connfd;
diff --git a/ipc/network_ipc.c b/ipc/network_ipc.c
index 71bbb50..f3097ca 100644
--- a/ipc/network_ipc.c
+++ b/ipc/network_ipc.c
@@ -176,7 +176,7 @@  int ipc_get_status_timeout(ipc_message *msg, unsigned int timeout_ms)
 	return ret;
 }
 
-int ipc_inst_start_ext(sourcetype source, void *priv, ssize_t size)
+int ipc_inst_start_ext(void *priv, ssize_t size)
 {
 	int connfd;
 	ipc_message msg;
@@ -243,7 +243,7 @@  int ipc_inst_start_ext(sourcetype source, void *priv, ssize_t size)
  */
 int ipc_inst_start(void)
 {
-	return ipc_inst_start_ext(SOURCE_UNKNOWN, NULL, 0);
+	return ipc_inst_start_ext(NULL, 0);
 }
 
 /*
diff --git a/mongoose/mongoose_interface.c b/mongoose/mongoose_interface.c
index 8bb41bf..e7a2743 100644
--- a/mongoose/mongoose_interface.c
+++ b/mongoose/mongoose_interface.c
@@ -293,7 +293,7 @@  static void upload_handler(struct mg_connection *nc, int ev, void *p)
 		req.len = strlen(mp->file_name);
 		strncpy(req.info, mp->file_name, sizeof(req.info) - 1);
 		req.source = SOURCE_WEBSERVER;
-		fus->fd = ipc_inst_start_ext(SOURCE_WEBSERVER, &req, sizeof(req));
+		fus->fd = ipc_inst_start_ext(&req, sizeof(req));
 		if (fus->fd < 0) {
 			mg_http_send_error(nc, 500, "Failed to queue command");
 			free(fus);