From be279e305ae0cc518e7a087f9e9229079aa3af0f Mon Sep 17 00:00:00 2001 From: wuminjie Date: Wed, 26 Feb 2025 17:26:18 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E7=BC=96=E8=AF=91=E5=91=8A=E8=AD=A6?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: wuminjie --- samgr/source/message.c | 2 +- samgr_endpoint/source/default_client_rpc.c | 2 +- samgr_endpoint/source/endpoint_rpc.c | 10 +++++----- samgr_endpoint/source/samgr_small_ipc_adapter.c | 8 ++++---- samgr_server/source/samgr_server_rpc.c | 6 +++--- 5 files changed, 14 insertions(+), 14 deletions(-) diff --git a/samgr/source/message.c b/samgr/source/message.c index c35e761..a117c27 100644 --- a/samgr/source/message.c +++ b/samgr/source/message.c @@ -36,7 +36,7 @@ int32 SAMGR_SendRequest(const Identity *identity, const Request *request, Handle return EC_INVALID; } - Exchange exchange = {*identity, *request, {NULL, 0}, MSG_NON, handler, NULL}; + Exchange exchange = {*identity, *request, {NULL, 0, NULL}, MSG_NON, handler, NULL}; exchange.id.queueId = NULL; if (handler != NULL) { exchange.id.queueId = SAMGR_GetCurrentQueueID(); diff --git a/samgr_endpoint/source/default_client_rpc.c b/samgr_endpoint/source/default_client_rpc.c index d7cc4b7..e5562b4 100644 --- a/samgr_endpoint/source/default_client_rpc.c +++ b/samgr_endpoint/source/default_client_rpc.c @@ -207,7 +207,7 @@ static void OnServiceExit(void *argv) header->target.handle = INVALID_INDEX; header->target.token = INVALID_INDEX; header->target.cookie = INVALID_INDEX; - HILOG_ERROR(HILOG_MODULE_SAMGR, "Miss the remote service<%u, %u>!", header->target.handle, header->target.token); + HILOG_ERROR(HILOG_MODULE_SAMGR, "Miss the remote service<%d, %lu>!", header->target.handle, header->target.token); } static SvcIdentity QueryIdentity(const char *service, const char *feature) diff --git a/samgr_endpoint/source/endpoint_rpc.c b/samgr_endpoint/source/endpoint_rpc.c index 9a40af6..2d2b9b4 100644 --- a/samgr_endpoint/source/endpoint_rpc.c +++ b/samgr_endpoint/source/endpoint_rpc.c @@ -115,7 +115,7 @@ int32 SAMGR_AddSysCap(const Endpoint *endpoint, const char *sysCap, BOOL isReg) IpcIo reply; void *replyBuf = NULL; - SvcIdentity *samgr = GetContextObject(); + const SvcIdentity *samgr = GetContextObject(); MessageOption option; MessageOptionInit(&option); int ret = SendRequest(*samgr, INVALID_INDEX, &req, &reply, @@ -150,7 +150,7 @@ int32 SAMGR_GetSysCap(const Endpoint *endpoint, const char *sysCap, BOOL *isReg) IpcIo reply; void *replyBuf = NULL; - SvcIdentity *samgr = GetContextObject(); + const SvcIdentity *samgr = GetContextObject(); MessageOption option; MessageOptionInit(&option); int ret = SendRequest(*samgr, INVALID_INDEX, &req, &reply, @@ -180,7 +180,7 @@ static int SendGetAllSysCapsRequest(const Endpoint *endpoint, uint32 startIdx, I WriteUint32(&req, RES_SYSCAP); WriteUint32(&req, OP_ALL); WriteUint32(&req, startIdx); - SvcIdentity *samgr = GetContextObject(); + const SvcIdentity *samgr = GetContextObject(); MessageOption option; MessageOptionInit(&option); int ret = SendRequest(*samgr, INVALID_INDEX, &req, reply, @@ -272,7 +272,7 @@ int SAMGR_ProcPolicy(const Endpoint *endpoint, const SaName *saName, int token) SAMGR_Free(policy); continue; } - HILOG_INFO(HILOG_MODULE_SAMGR, "Register server sa<%s, %s> id<%lu, %u> retry:%d ret:%d!", + HILOG_INFO(HILOG_MODULE_SAMGR, "Register server sa<%s, %s> id<%d, %lu> retry:%d ret:%d!", saName->service, saName->feature, saInfo.handle, saInfo.token, retry, ret); ret = AddPolicyToRouter(endpoint, &saInfo, policy, policyNum); SAMGR_Free(policy); @@ -293,7 +293,7 @@ static int AddPolicyToRouter(const Endpoint *endpoint, const SvcIdentity *saInfo Router *router = VECTOR_At((Vector *)&endpoint->routers, saInfo->token); if (router == NULL) { - HILOG_ERROR(HILOG_MODULE_SAMGR, "Router <%s, %u> is NULL", endpoint->name, saInfo->token); + HILOG_ERROR(HILOG_MODULE_SAMGR, "Router <%s, %lu> is NULL", endpoint->name, saInfo->token); return EC_INVALID; } diff --git a/samgr_endpoint/source/samgr_small_ipc_adapter.c b/samgr_endpoint/source/samgr_small_ipc_adapter.c index 2749f88..8dd8d87 100644 --- a/samgr_endpoint/source/samgr_small_ipc_adapter.c +++ b/samgr_endpoint/source/samgr_small_ipc_adapter.c @@ -18,8 +18,8 @@ typedef struct IRegisterEpArg IRegisterEpArg; struct IRegisterEpArg { Endpoint *endpoint; int token; - char *service; - char *feature; + const char *service; + const char *feature; }; static int Dispatch(uint32_t code, IpcIo *data, IpcIo *reply, MessageOption option); static void HandleIpc(const Request *request, const Response *response); @@ -111,7 +111,7 @@ static void *Receive(void *argv) ret = registerEpArg->endpoint->registerEP(®isterEpArg->endpoint->identity, registerEpArg->token, registerEpArg->service, registerEpArg->feature); if (ret == EC_SUCCESS) { - SvcIdentity *samgr = GetContextObject(); + const SvcIdentity *samgr = GetContextObject(); (void)RemoveDeathRecipient(*samgr, registerEpArg->endpoint->deadId); (void)AddDeathRecipient(*samgr, OnSamgrServerExit, registerEpArg->endpoint, ®isterEpArg->endpoint->deadId); @@ -177,7 +177,7 @@ int RegisterIdentity(const SaName *saName, SvcIdentity *saInfo, PolicyTrans **po WriteUint32(&req, saInfo->token); IpcIo reply; void *replyBuf = NULL; - SvcIdentity *samgr = GetContextObject(); + const SvcIdentity *samgr = GetContextObject(); MessageOption option; MessageOptionInit(&option); int ret = SendRequest(*samgr, INVALID_INDEX, &req, &reply, option, diff --git a/samgr_server/source/samgr_server_rpc.c b/samgr_server/source/samgr_server_rpc.c index 1c024cc..4d50bfb 100644 --- a/samgr_server/source/samgr_server_rpc.c +++ b/samgr_server/source/samgr_server_rpc.c @@ -349,7 +349,7 @@ static int32 ProcPutFeature(SamgrServer *server, const void *origin, IpcIo *req, } ret = SASTORA_Save(&server->store, service, feature, identity); MUTEX_Unlock(server->mtx); - HILOG_DEBUG(HILOG_MODULE_SAMGR, "Register Feature<%s, %s> pid<%d>, id<%d, %d> ret:%d", + HILOG_DEBUG(HILOG_MODULE_SAMGR, "Register Feature<%s, %s> pid<%d>, id<%d, %lu> ret:%d", service, feature, pid, identity->handle, identity->token, ret); TransmitPolicy(ret, identity, reply, policy, policyNum); SAMGR_Free(policy); @@ -419,14 +419,14 @@ static int32 ProcGetFeature(SamgrServer *server, const void *origin, IpcIo *req, *identity = SASTORA_Find(&server->store, service, feature); if (identity->handle == INVALID_INDEX) { MUTEX_Unlock(server->mtx); - HILOG_DEBUG(HILOG_MODULE_SAMGR, "Cannot Find Feature<%s, %s> id<%d, %d> ret:%d", + HILOG_DEBUG(HILOG_MODULE_SAMGR, "Cannot Find Feature<%s, %s> id<%d, %lu> ret:%d", service, feature, identity->handle, identity->token, EC_NOSERVICE); return EC_NOSERVICE; } PidHandle providerPid = SASTORA_FindPidHandleByIpcHandle(&server->store, identity->handle); MUTEX_Unlock(server->mtx); if (providerPid.pid == INVALID_INDEX || providerPid.uid == INVALID_INDEX) { - HILOG_DEBUG(HILOG_MODULE_SAMGR, "Cannot Find PidHandle<%s, %s> id<%d, %d> ret:%d", + HILOG_DEBUG(HILOG_MODULE_SAMGR, "Cannot Find PidHandle<%s, %s> id<%d, %lu> ret:%d", service, feature, identity->handle, identity->token, EC_FAILURE); return EC_FAILURE; } -- Gitee From 1fe87c6a505c59ca21cd183bbc9978ce88de166f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=B4=E6=95=8F=E6=9D=B0?= Date: Wed, 5 Mar 2025 09:41:13 +0000 Subject: [PATCH 2/4] update samgr_endpoint/source/endpoint_rpc.c. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 吴敏杰 --- samgr_endpoint/source/endpoint_rpc.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/samgr_endpoint/source/endpoint_rpc.c b/samgr_endpoint/source/endpoint_rpc.c index 55c2076..b9fffda 100644 --- a/samgr_endpoint/source/endpoint_rpc.c +++ b/samgr_endpoint/source/endpoint_rpc.c @@ -287,8 +287,6 @@ int SAMGR_ProcPolicy(const Endpoint *endpoint, const SaName *saName, int token) SAMGR_Free(policy); continue; } - HILOG_INFO(HILOG_MODULE_SAMGR, "Register server sa<%s, %s> id<%d, %lu> retry:%d ret:%d!", - saName->service, saName->feature, saInfo.handle, saInfo.token, retry, ret); HILOG_INFO(HILOG_MODULE_SAMGR, "Register server sa<%s, %s> id<%d> retry:%d ret:%d!", saName->service, saName->feature, saInfo.handle, retry, ret); ret = AddPolicyToRouter(endpoint, &saInfo, policy, policyNum); @@ -310,7 +308,6 @@ static int AddPolicyToRouter(const Endpoint *endpoint, const SvcIdentity *saInfo Router *router = VECTOR_At((Vector *)&endpoint->routers, saInfo->token); if (router == NULL) { - HILOG_ERROR(HILOG_MODULE_SAMGR, "Router <%s, %lu> is NULL", endpoint->name, saInfo->token); HILOG_ERROR(HILOG_MODULE_SAMGR, "Router <%s> is NULL", endpoint->name); return EC_INVALID; } -- Gitee From 573d19fa7005b7d546904c36eefe05c7118121df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=B4=E6=95=8F=E6=9D=B0?= Date: Wed, 5 Mar 2025 11:22:57 +0000 Subject: [PATCH 3/4] update samgr_endpoint/source/endpoint_rpc.c. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 吴敏杰 --- samgr_endpoint/source/endpoint_rpc.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/samgr_endpoint/source/endpoint_rpc.c b/samgr_endpoint/source/endpoint_rpc.c index b9fffda..65dc248 100644 --- a/samgr_endpoint/source/endpoint_rpc.c +++ b/samgr_endpoint/source/endpoint_rpc.c @@ -116,7 +116,6 @@ int32 SAMGR_AddSysCap(const Endpoint *endpoint, const char *sysCap, BOOL isReg) IpcIo reply; void *replyBuf = NULL; const SvcIdentity *samgr = GetContextObject(); - SvcIdentity *samgr = GetContextObject(); if (samgr == NULL) { return EC_INVALID; } @@ -155,7 +154,6 @@ int32 SAMGR_GetSysCap(const Endpoint *endpoint, const char *sysCap, BOOL *isReg) IpcIo reply; void *replyBuf = NULL; const SvcIdentity *samgr = GetContextObject(); - SvcIdentity *samgr = GetContextObject(); if (samgr == NULL) { return EC_INVALID; } @@ -189,7 +187,6 @@ static int SendGetAllSysCapsRequest(const Endpoint *endpoint, uint32 startIdx, I WriteUint32(&req, OP_ALL); WriteUint32(&req, startIdx); const SvcIdentity *samgr = GetContextObject(); - SvcIdentity *samgr = GetContextObject(); if (samgr == NULL) { return EC_INVALID; } -- Gitee From 1b4e4ee05ca4c2c8296a9fd47cd31fbdd83cea26 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=B4=E6=95=8F=E6=9D=B0?= Date: Wed, 5 Mar 2025 11:23:28 +0000 Subject: [PATCH 4/4] update samgr_endpoint/source/samgr_small_ipc_adapter.c. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 吴敏杰 --- samgr_endpoint/source/samgr_small_ipc_adapter.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/samgr_endpoint/source/samgr_small_ipc_adapter.c b/samgr_endpoint/source/samgr_small_ipc_adapter.c index 676b241..378d14a 100644 --- a/samgr_endpoint/source/samgr_small_ipc_adapter.c +++ b/samgr_endpoint/source/samgr_small_ipc_adapter.c @@ -114,7 +114,6 @@ static void *Receive(void *argv) registerEpArg->token, registerEpArg->service, registerEpArg->feature); if (ret == EC_SUCCESS) { const SvcIdentity *samgr = GetContextObject(); - SvcIdentity *samgr = GetContextObject(); if (samgr == NULL) { continue; } @@ -184,7 +183,6 @@ int RegisterIdentity(const SaName *saName, SvcIdentity *saInfo, PolicyTrans **po IpcIo reply; void *replyBuf = NULL; const SvcIdentity *samgr = GetContextObject(); - SvcIdentity *samgr = GetContextObject(); if (samgr == NULL) { return EC_INVALID; } -- Gitee