From 1cc35fa64c4a4a4c5716e5085616db2615eaee14 Mon Sep 17 00:00:00 2001 From: liubb_0516 Date: Tue, 22 Feb 2022 11:08:01 +0800 Subject: [PATCH 1/2] ipc MessageOption is extended from enum to structure Signed-off-by: liubb_0516 --- samgr_endpoint/source/default_client_rpc.c | 9 +++++++-- samgr_endpoint/source/endpoint_rpc.c | 20 ++++++++++++++++---- 2 files changed, 23 insertions(+), 6 deletions(-) mode change 100755 => 100644 samgr_endpoint/source/default_client_rpc.c mode change 100755 => 100644 samgr_endpoint/source/endpoint_rpc.c diff --git a/samgr_endpoint/source/default_client_rpc.c b/samgr_endpoint/source/default_client_rpc.c old mode 100755 new mode 100644 index fe317b9..c83563f --- a/samgr_endpoint/source/default_client_rpc.c +++ b/samgr_endpoint/source/default_client_rpc.c @@ -217,7 +217,9 @@ static int ProxyInvoke(IClientProxy *proxy, int funcId, IpcIo *request, IOwner o IpcIo reply; void *replyBuf = NULL; - MessageOption flag = (notify == NULL) ? TF_OP_ASYNC : TF_OP_SYNC; + MessageOption flag = { + .flags = (notify == NULL) ? TF_OP_ASYNC : TF_OP_SYNC + }; HILOG_DEBUG(HILOG_MODULE_SAMGR, "%d %lu, %lu, saId: %d\n", header->target.handle, header->target.token, header->target.cookie, header->saId); IpcIo requestWrapper; @@ -277,7 +279,10 @@ static SvcIdentity QueryIdentity(const char *service, const char *feature) IpcIo reply; void *replyBuf = NULL; SvcIdentity samgr = {SAMGR_HANDLE, SAMGR_TOKEN, SAMGR_COOKIE}; - int ret = SendRequest(samgr, INVALID_INDEX, &req, &reply, TF_OP_SYNC, (uintptr_t *)&replyBuf); + MessageOption flag = { + .flags = TF_OP_SYNC + }; + int ret = SendRequest(samgr, INVALID_INDEX, &req, &reply, flag, (uintptr_t *)&replyBuf); int32_t sa_ret; ret = (ret != EC_SUCCESS) ? EC_FAILURE : ReadInt32(&reply, &sa_ret); SvcIdentity target = {INVALID_INDEX, INVALID_INDEX, INVALID_INDEX}; diff --git a/samgr_endpoint/source/endpoint_rpc.c b/samgr_endpoint/source/endpoint_rpc.c old mode 100755 new mode 100644 index da8f445..25023a7 --- a/samgr_endpoint/source/endpoint_rpc.c +++ b/samgr_endpoint/source/endpoint_rpc.c @@ -166,8 +166,11 @@ int32 SAMGR_AddSysCap(const Endpoint *endpoint, const char *sysCap, BOOL isReg) IpcIo reply; void *replyBuf = NULL; SvcIdentity samgr = {SAMGR_HANDLE, SAMGR_TOKEN, SAMGR_COOKIE}; + MessageOption option = { + .flags = TF_OP_SYNC + }; int ret = SendRequest(samgr, INVALID_INDEX, &req, &reply, - TF_OP_SYNC, (uintptr_t *)&replyBuf); + option, (uintptr_t *)&replyBuf); ret = -ret; int32_t ipcRet = ret; if (ret == EC_SUCCESS) { @@ -198,8 +201,11 @@ int32 SAMGR_GetSysCap(const Endpoint *endpoint, const char *sysCap, BOOL *isReg) IpcIo reply; void *replyBuf = NULL; SvcIdentity samgr = {SAMGR_HANDLE, SAMGR_TOKEN, SAMGR_COOKIE}; + MessageOption option = { + .flags = TF_OP_SYNC + }; int ret = SendRequest(samgr, INVALID_INDEX, &req, &reply, - TF_OP_SYNC, (uintptr_t *)&replyBuf); + option, (uintptr_t *)&replyBuf); ret = -ret; *isReg = FALSE; int32_t ipcRet = ret; @@ -225,8 +231,11 @@ static int SendGetAllSysCapsRequest(const Endpoint *endpoint, uint32 startIdx, I WriteUint32(&req, OP_ALL); WriteUint32(&req, startIdx); SvcIdentity samgr = {SAMGR_HANDLE, SAMGR_TOKEN, SAMGR_COOKIE}; + MessageOption option = { + .flags = TF_OP_SYNC + }; int ret = SendRequest(samgr, INVALID_INDEX, &req, reply, - TF_OP_SYNC, (uintptr_t *)replyBuf); + option, (uintptr_t *)replyBuf); HILOG_DEBUG(HILOG_MODULE_SAMGR, "SendGetAllSysCapsRequest startIdx:%d, ret:%d!", startIdx, ret); return -ret; } @@ -450,7 +459,10 @@ static int RegisterIdentity(const SaName *saName, SvcIdentity *saInfo, IpcIo reply; void *replyBuf = NULL; SvcIdentity samgr = {SAMGR_HANDLE, SAMGR_TOKEN, SAMGR_COOKIE}; - int ret = SendRequest(samgr, INVALID_INDEX, &req, &reply, TF_OP_SYNC, + MessageOption option = { + .flags = TF_OP_SYNC + }; + int ret = SendRequest(samgr, INVALID_INDEX, &req, &reply, option, (uintptr_t *)&replyBuf); ret = -ret; int32_t ipcRet; -- Gitee From 3ef07fcbe95e3b585b51943783de3fae6277dfc3 Mon Sep 17 00:00:00 2001 From: liubb_0516 Date: Tue, 22 Feb 2022 17:06:14 +0800 Subject: [PATCH 2/2] =?UTF-8?q?ipc=20MessageOption=E7=94=B1=E6=9E=9A?= =?UTF-8?q?=E4=B8=BE=E6=89=A9=E5=B1=95=E4=B8=BA=E7=BB=93=E6=9E=84=E4=BD=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: liubb_0516 --- samgr_endpoint/source/default_client_rpc.c | 11 +++++------ samgr_endpoint/source/endpoint_rpc.c | 20 ++++++++------------ 2 files changed, 13 insertions(+), 18 deletions(-) diff --git a/samgr_endpoint/source/default_client_rpc.c b/samgr_endpoint/source/default_client_rpc.c index c83563f..b1f0d5c 100644 --- a/samgr_endpoint/source/default_client_rpc.c +++ b/samgr_endpoint/source/default_client_rpc.c @@ -217,9 +217,9 @@ static int ProxyInvoke(IClientProxy *proxy, int funcId, IpcIo *request, IOwner o IpcIo reply; void *replyBuf = NULL; - MessageOption flag = { - .flags = (notify == NULL) ? TF_OP_ASYNC : TF_OP_SYNC - }; + MessageOption flag; + MessageOptionInit(&flag); + flag.flags = (notify == NULL) ? TF_OP_ASYNC : TF_OP_SYNC; HILOG_DEBUG(HILOG_MODULE_SAMGR, "%d %lu, %lu, saId: %d\n", header->target.handle, header->target.token, header->target.cookie, header->saId); IpcIo requestWrapper; @@ -279,9 +279,8 @@ static SvcIdentity QueryIdentity(const char *service, const char *feature) IpcIo reply; void *replyBuf = NULL; SvcIdentity samgr = {SAMGR_HANDLE, SAMGR_TOKEN, SAMGR_COOKIE}; - MessageOption flag = { - .flags = TF_OP_SYNC - }; + MessageOption flag; + MessageOptionInit(&flag); int ret = SendRequest(samgr, INVALID_INDEX, &req, &reply, flag, (uintptr_t *)&replyBuf); int32_t sa_ret; ret = (ret != EC_SUCCESS) ? EC_FAILURE : ReadInt32(&reply, &sa_ret); diff --git a/samgr_endpoint/source/endpoint_rpc.c b/samgr_endpoint/source/endpoint_rpc.c index 25023a7..885c79f 100644 --- a/samgr_endpoint/source/endpoint_rpc.c +++ b/samgr_endpoint/source/endpoint_rpc.c @@ -166,9 +166,8 @@ int32 SAMGR_AddSysCap(const Endpoint *endpoint, const char *sysCap, BOOL isReg) IpcIo reply; void *replyBuf = NULL; SvcIdentity samgr = {SAMGR_HANDLE, SAMGR_TOKEN, SAMGR_COOKIE}; - MessageOption option = { - .flags = TF_OP_SYNC - }; + MessageOption option; + MessageOptionInit(&option); int ret = SendRequest(samgr, INVALID_INDEX, &req, &reply, option, (uintptr_t *)&replyBuf); ret = -ret; @@ -201,9 +200,8 @@ int32 SAMGR_GetSysCap(const Endpoint *endpoint, const char *sysCap, BOOL *isReg) IpcIo reply; void *replyBuf = NULL; SvcIdentity samgr = {SAMGR_HANDLE, SAMGR_TOKEN, SAMGR_COOKIE}; - MessageOption option = { - .flags = TF_OP_SYNC - }; + MessageOption option; + MessageOptionInit(&option); int ret = SendRequest(samgr, INVALID_INDEX, &req, &reply, option, (uintptr_t *)&replyBuf); ret = -ret; @@ -231,9 +229,8 @@ static int SendGetAllSysCapsRequest(const Endpoint *endpoint, uint32 startIdx, I WriteUint32(&req, OP_ALL); WriteUint32(&req, startIdx); SvcIdentity samgr = {SAMGR_HANDLE, SAMGR_TOKEN, SAMGR_COOKIE}; - MessageOption option = { - .flags = TF_OP_SYNC - }; + MessageOption option; + MessageOptionInit(&option); int ret = SendRequest(samgr, INVALID_INDEX, &req, reply, option, (uintptr_t *)replyBuf); HILOG_DEBUG(HILOG_MODULE_SAMGR, "SendGetAllSysCapsRequest startIdx:%d, ret:%d!", startIdx, ret); @@ -459,9 +456,8 @@ static int RegisterIdentity(const SaName *saName, SvcIdentity *saInfo, IpcIo reply; void *replyBuf = NULL; SvcIdentity samgr = {SAMGR_HANDLE, SAMGR_TOKEN, SAMGR_COOKIE}; - MessageOption option = { - .flags = TF_OP_SYNC - }; + MessageOption option; + MessageOptionInit(&option); int ret = SendRequest(samgr, INVALID_INDEX, &req, &reply, option, (uintptr_t *)&replyBuf); ret = -ret; -- Gitee