diff --git a/interfaces/kits/samgr/common.h b/interfaces/kits/samgr/common.h
index adc924c029f5816ff430cc39b92cb0fd6c7fda8c..ed60b1d56cc98503bae8403fb98f257a93c40fcd 100755
--- a/interfaces/kits/samgr/common.h
+++ b/interfaces/kits/samgr/common.h
@@ -56,11 +56,11 @@ typedef void *MutexId;
typedef void *ThreadId;
/**
- * @brief Calculates the offset of the member in the T type.
+ * @brief Calculates the offset for the member of the T type.
*
*
*
- * @param Indicates the T type.
+ * @param T Indicates the T type.
* @param member Indicates the name of the T member variable.
*
* @since 1.0
@@ -141,7 +141,7 @@ typedef struct SimpleVector {
Vector VECTOR_Make(VECTOR_Key key, VECTOR_Compare compare);
/**
- * @brief Destruct a vector object.
+ * @brief Destructs a vector object.
*
* This function is used to clear the memory applied by the vector after the temporary vector in
* the stack is used. \n
diff --git a/interfaces/kits/samgr/iunknown.h b/interfaces/kits/samgr/iunknown.h
index 74780868dbc00fe8be6d2e6544e4c634838ca31d..9fdd49da7b7d4d74273b69031b1241618c5db051 100755
--- a/interfaces/kits/samgr/iunknown.h
+++ b/interfaces/kits/samgr/iunknown.h
@@ -116,7 +116,7 @@ typedef struct IUnknown IUnknown;
DEFAULT_IUNKNOWN_IMPL
/**
- * @brief IUnknown Defines the end macro for initializing the IUnknown implementation
+ * @brief Defines the end macro for initializing the IUnknown implementation
* object.
*
* This macro is used when a subclass object of the IUnknown implementation class is
@@ -149,11 +149,11 @@ typedef struct IUnknown IUnknown;
*/
struct IUnknown {
/**
- * Queries the subclass object of the IUnknown interface of a specified version
+ * Query the subclass object of the IUnknown interface of a specified version
* (downcasting).
*/
int (*QueryInterface)(IUnknown *iUnknown, int version, void **target);
- /** Adds the reference count. */
+ /** Add the reference count. */
int (*AddRef)(IUnknown *iUnknown);
/** Release the reference to an IUnknown interface. */
int (*Release)(IUnknown *iUnknown);
@@ -213,7 +213,7 @@ int IUNKNOWN_AddRef(IUnknown *iUnknown);
* @param version Indicates the version of the IUnknown interface object to be converted.
* @param target Indicates the IUnknown subclass type required by the caller. This is an
* output parameter.
- * @return Returns EC_SUCCESS if the conversion is successful; returns other error codes
+ * @return Returns EC_SUCCESS if the conversion is successful; returns an error code
* if the conversion fails.
*
* @since 1.0
diff --git a/interfaces/kits/samgr/message.h b/interfaces/kits/samgr/message.h
index b48bdb4a33a0d0f3ac29fbeef49ca39b63b4920a..090e47f34f27faf7bebb84edc3b20d856b1c8dd1 100644
--- a/interfaces/kits/samgr/message.h
+++ b/interfaces/kits/samgr/message.h
@@ -34,7 +34,7 @@
* @brief Provides message communication APIs that help you to implement asynchronous functions
* of {@link IUnknown}.
*
- * This API is used to implement asynchronous functions of {@link IUnknown}. \n
+ * This file is used to implement asynchronous functions of {@link IUnknown}. \n
*
* @since 1.0
* @version 1.0
@@ -65,7 +65,6 @@ typedef struct Response Response;
*/
typedef void (*Handler)(const Request *request, const Response *response);
-// Will be used for message interaction, so use one-byte alignment
#pragma pack(1)
/**
* @brief Identifies a service and feature.
diff --git a/interfaces/kits/samgr/samgr_lite.h b/interfaces/kits/samgr/samgr_lite.h
index e8e1718d50956578d8439ebac3c78267eb9926f1..b16e9cfe1f897001bebbc3d9c132617e3149e7ba 100755
--- a/interfaces/kits/samgr/samgr_lite.h
+++ b/interfaces/kits/samgr/samgr_lite.h
@@ -33,7 +33,7 @@
*
* @brief Manages system capabilities.
*
- * This is used when services, features, and functions are registered with and discovered by Samgr. \n
+ * This file is used for the Samgr client to register and discover services, features, and functions. \n
*
* @since 1.0
* @version 1.0
@@ -72,7 +72,7 @@ extern "C" {
/**
* @brief Enumerates the IDs of the message to be processed for starting the bootstrap service.
*
- * This function is implemented by developers of the system service. \n
+ * This function is implemented by system service developers. \n
* Messages sent to the bootstrap service when Samgr is started. \n
*
*/
diff --git a/samgr_server/source/samgr_server.c b/samgr_server/source/samgr_server.c
index 650bcfe4e6568cab4f8239756b428defe56b82c6..31ebfa12a3e0f14e86291736efa3dd1312788311 100755
--- a/samgr_server/source/samgr_server.c
+++ b/samgr_server/source/samgr_server.c
@@ -89,15 +89,14 @@ static const char *GetSysCapName(const SysCapImpl *serviceImpl)
static void InitializeRegistry(void)
{
- HILOG_INFO(HILOG_MODULE_SAMGR, "Initialize Registry!");
+ HILOG_INFO(HILOG_MODULE_SAMGR, "Registry initialized.");
g_server.mtx = MUTEX_InitValue();
SASTORA_Init(&g_server.store);
- g_server.samgr = SAMGR_CreateEndpoint("samgr", RegisterSamgrEndpoint);
SAMGR_GetInstance()->RegisterService((Service *)&g_server);
g_server.sysCapMtx = MUTEX_InitValue();
g_server.sysCapabilitys = VECTOR_Make((VECTOR_Key)GetSysCapName, (VECTOR_Compare)strcmp);
ParseSysCap();
- HILOG_INFO(HILOG_MODULE_SAMGR, "InitializeRegistry ParseSysCap size: %d", VECTOR_Size(&(g_server.sysCapabilitys)));
+ HILOG_INFO(HILOG_MODULE_SAMGR, "Registry initialized, ParseSysCap size: %d", VECTOR_Size(&(g_server.sysCapabilitys)));
}
SYS_SERVICE_INIT(InitializeRegistry);
@@ -140,7 +139,8 @@ static BOOL MessageHandle(Service *service, Request *request)
static TaskConfig GetTaskConfig(Service *service)
{
(void)service;
- TaskConfig config = {LEVEL_HIGH, PRI_BUTT - 1, 0x400, 20, SINGLE_TASK}; // Cannot use PRI_BUTT directly, so minus 1
+ TaskConfig config = {LEVEL_HIGH, PRI_BUTT - 1, 0x400, 20, SINGLE_TASK};
+ // PRI_BUTT cannot be used directly, so 1 is minus
return config;
}
@@ -211,7 +211,7 @@ static int32 ProcPutFeature(SamgrServer *server, const void *origin, IpcIo *req,
int index = SASTORA_FindHandleByUidPid(&server->store, uid, pid, &handle);
if (index == INVALID_INDEX) {
MUTEX_Unlock(server->mtx);
- HILOG_ERROR(HILOG_MODULE_SAMGR, "Endpoint[%d] is not register", pid);
+ HILOG_ERROR(HILOG_MODULE_SAMGR, "Endpoint[%d] is not registered", pid);
IpcIoPushInt32(reply, EC_NOSERVICE);
return EC_NOSERVICE;
}
@@ -231,7 +231,7 @@ static int32 ProcPutFeature(SamgrServer *server, const void *origin, IpcIo *req,
if (ret != EC_SUCCESS || policy == NULL) {
MUTEX_Unlock(server->mtx);
SAMGR_Free(policy);
- HILOG_DEBUG(HILOG_MODULE_SAMGR, "Remote Get Communication Strategy<%s, %s> No Permission<%d>!",
+ HILOG_DEBUG(HILOG_MODULE_SAMGR, "Failed to get communication strategy<%s, %s> no permission<%d>!",
service, feature, ret);
IpcIoPushInt32(reply, EC_PERMISSION);
return EC_PERMISSION;
@@ -239,7 +239,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<%u, %u> ret:%d",
+ HILOG_DEBUG(HILOG_MODULE_SAMGR, "Register feature<%s, %s> pid<%d>, id<%u, %u> ret:%d",
service, feature, pid, identity->handle, identity->token, ret);
TransmitPolicy(ret, identity, reply, policy, policyNum);
SAMGR_Free(policy);
@@ -304,7 +304,7 @@ 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<%u, %u> ret:%d",
+ HILOG_DEBUG(HILOG_MODULE_SAMGR, "Feature<%s not found, %s> id<%u, %u> ret:%d",
service, feature, identity->handle, identity->token, EC_NOSERVICE);
return EC_NOSERVICE;
}
@@ -312,7 +312,7 @@ static int32 ProcGetFeature(SamgrServer *server, const void *origin, IpcIo *req,
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, "PidHandle<%s not found, %s> id<%d, %d> ret:%d",
service, feature, identity->handle, identity->token, EC_FAILURE);
return EC_FAILURE;
}
@@ -328,7 +328,7 @@ static int32 ProcGetFeature(SamgrServer *server, const void *origin, IpcIo *req,
HILOG_DEBUG(HILOG_MODULE_SAMGR, "Judge Auth<%s, %s> ret:%d", service, feature, isAuth);
int32 ret = (isAuth == EC_SUCCESS) ? AddServiceAccess(*identity, GetCallingTid(origin)) : EC_PERMISSION;
- HILOG_DEBUG(HILOG_MODULE_SAMGR, "Find Feature<%s, %s> id<%d, %d> ret:%d",
+ HILOG_DEBUG(HILOG_MODULE_SAMGR, "Feature<%s found, %s> id<%d, %d> ret:%d",
service, feature, identity->handle, identity->token, ret);
return ret;
}
@@ -453,9 +453,9 @@ void ProcGetAllSysCap(SamgrServer *server, IpcIo *req, IpcIo *reply)
HILOG_DEBUG(HILOG_MODULE_SAMGR, "ProcGetAllSysCap replyNum: %d, size: %d, startIdx: %u, nextRequestIdx: %d",
replyNum, size, startIdx, nextRequestIdx);
IpcIoPushInt32(reply, EC_SUCCESS);
- // indicate is the last reply
+ // Indication of the last reply
IpcIoPushBool(reply, nextRequestIdx == size);
- // indicate is the next start idx
+ // Indication of the next start idx
IpcIoPushUint32(reply, nextRequestIdx);
IpcIoPushUint32(reply, replyNum);
int32 cnt = 0;
@@ -505,8 +505,8 @@ static int RegisterSamgrEndpoint(const IpcContext* context, SvcIdentity* identit
{
int ret = SetSaManager(context, MAX_SA_SIZE);
if (ret != LITEIPC_OK) {
- HILOG_FATAL(HILOG_MODULE_SAMGR, "Set sa manager<%d> failed!", ret);
- // Set sa manager failed! We need restart to recover
+ HILOG_FATAL(HILOG_MODULE_SAMGR, "Setting sa manager<%d> failed!", ret);
+ // Setting SA manager failed. A restart is needed to recover.
exit(-ret);
}
identity->handle = SAMGR_HANDLE;
@@ -542,7 +542,7 @@ static int OnEndpointExit(const IpcContext *context, void* ipcMsg, IpcIo* data,
BinderRelease(context, handle.handle);
}
#endif
- HILOG_ERROR(HILOG_MODULE_SAMGR, "IPC pid<%d> exit! send clean request retry(%d), ret(%d)!", pid, retry, ret);
+ HILOG_ERROR(HILOG_MODULE_SAMGR, "IPC pid<%d> exit! Send clean request retry(%d), ret(%d)!", pid, retry, ret);
return EC_SUCCESS;
}
@@ -608,7 +608,7 @@ static void ParseSysCap(void)
int32_t sysCapNum = 0;
for (int32_t i = 0; i < size; i++) {
if (sysCapNum >= MAX_SYSCAP_NUM) {
- HILOG_ERROR(HILOG_MODULE_SAMGR, "ParseSycCapMap system capability exceed");
+ HILOG_ERROR(HILOG_MODULE_SAMGR, "ParseSycCapMap system capability exceeded");
break;
}
cJSON *item = cJSON_GetArrayItem(sysCaps, i);
@@ -622,7 +622,7 @@ static void ParseSysCap(void)
}
char *nameStr = cJSON_GetStringValue(name);
if (VECTOR_FindByKey(&(g_server.sysCapabilitys), nameStr) != INVALID_INDEX) {
- HILOG_WARN(HILOG_MODULE_SAMGR, "Duplicate system capability %s register!", nameStr);
+ HILOG_WARN(HILOG_MODULE_SAMGR, "Duplicate system capability %s registered!", nameStr);
continue;
}
SysCapImpl *impl = (SysCapImpl *)SAMGR_Malloc(sizeof(SysCapImpl));
@@ -636,7 +636,7 @@ static void ParseSysCap(void)
impl->isRegister = cJSON_IsTrue(isRegister);
if (VECTOR_Add(&(g_server.sysCapabilitys), impl) == INVALID_INDEX) {
SAMGR_Free(impl);
- HILOG_ERROR(HILOG_MODULE_SAMGR, "system capability %s register failed!", impl->name);
+ HILOG_ERROR(HILOG_MODULE_SAMGR, "Registering system capability %s failed!", impl->name);
continue;
}
sysCapNum++;
diff --git a/samgr_server/source/samgr_server_rpc.c b/samgr_server/source/samgr_server_rpc.c
old mode 100644
new mode 100755
index fabded24b3a36b6c34e11140402b320d84f9b93e..aca1ddb3e4d522c7308789ac53df0b102780b8f8
--- a/samgr_server/source/samgr_server_rpc.c
+++ b/samgr_server/source/samgr_server_rpc.c
@@ -232,7 +232,8 @@ static BOOL MessageHandle(Service *service, Request *request)
static TaskConfig GetTaskConfig(Service *service)
{
(void)service;
- TaskConfig config = {LEVEL_HIGH, PRI_BUTT - 1, 0x4000, 20, SINGLE_TASK}; // Cannot use PRI_BUTT directly, so minus 1
+ TaskConfig config = {LEVEL_HIGH, PRI_BUTT - 1, 0x4000, 20, SINGLE_TASK};
+ // PRI_BUTT cannot be used directly, so 1 is minus
return config;
}
@@ -315,7 +316,7 @@ static int32 ProcPutFeature(SamgrServer *server, const void *origin, IpcIo *req,
int index = SASTORA_FindHandleByUidPid(&server->store, uid, pid, &handle);
if (index == INVALID_INDEX) {
MUTEX_Unlock(server->mtx);
- HILOG_ERROR(HILOG_MODULE_SAMGR, "Endpoint[%d] is not register", pid);
+ HILOG_ERROR(HILOG_MODULE_SAMGR, "Endpoint[%d] is not registered", pid);
WriteInt32(reply, EC_NOSERVICE);
return EC_NOSERVICE;
}
@@ -339,14 +340,14 @@ static int32 ProcPutFeature(SamgrServer *server, const void *origin, IpcIo *req,
if (ret != EC_SUCCESS || policy == NULL) {
MUTEX_Unlock(server->mtx);
SAMGR_Free(policy);
- HILOG_DEBUG(HILOG_MODULE_SAMGR, "Remote Get Communication Strategy<%s, %s> No Permission<%d>!",
+ HILOG_DEBUG(HILOG_MODULE_SAMGR, "Failed to get communication strategy<%s, %s> no permission<%d>!",
service, feature, ret);
WriteInt32(reply, EC_PERMISSION);
return EC_PERMISSION;
}
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, "Feature<%s registered, %s> pid<%d>, id<%d, %d> ret:%d",
service, feature, pid, identity->handle, identity->token, ret);
TransmitPolicy(ret, identity, reply, policy, policyNum);
SAMGR_Free(policy);
@@ -416,14 +417,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, "Feature<%s not found, %s> id<%d, %d> 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, "PidHandle<%s not found, %s> id<%d, %d> ret:%d",
service, feature, identity->handle, identity->token, EC_FAILURE);
return EC_FAILURE;
}
@@ -436,7 +437,7 @@ static int32 ProcGetFeature(SamgrServer *server, const void *origin, IpcIo *req,
.providerUid = providerPid.uid
};
int isAuth = g_server.ipcAuth->IsCommunicationAllowed(authParams);
- HILOG_DEBUG(HILOG_MODULE_SAMGR, "Judge Auth<%s, %s> ret:%d", service, feature, isAuth);
+ HILOG_DEBUG(HILOG_MODULE_SAMGR, "Check Auth<%s, %s> ret:%d", service, feature, isAuth);
return isAuth;
}
@@ -563,9 +564,9 @@ void ProcGetAllSysCap(SamgrServer *server, IpcIo *req, IpcIo *reply)
HILOG_DEBUG(HILOG_MODULE_SAMGR, "ProcGetAllSysCap replyNum: %d, size: %d, startIdx: %u, nextRequestIdx: %d",
replyNum, size, startIdx, nextRequestIdx);
WriteInt32(reply, EC_SUCCESS);
- // indicate is the last reply
+ // Indication of the last reply
WriteBool(reply, nextRequestIdx == size);
- // indicate is the next start idx
+ // Indication of the next start idx
WriteUint32(reply, nextRequestIdx);
WriteUint32(reply, replyNum);
int32 cnt = 0;
@@ -729,7 +730,7 @@ static void ParseSysCap(void)
}
char *nameStr = cJSON_GetStringValue(name);
if (VECTOR_FindByKey(&(g_server.sysCapabilitys), nameStr) != INVALID_INDEX) {
- HILOG_WARN(HILOG_MODULE_SAMGR, "Duplicate system capability %s register!", nameStr);
+ HILOG_WARN(HILOG_MODULE_SAMGR, "Duplicate system capability %s registered!", nameStr);
continue;
}
SysCapImpl *impl = (SysCapImpl *)SAMGR_Malloc(sizeof(SysCapImpl));
@@ -743,7 +744,7 @@ static void ParseSysCap(void)
impl->isRegister = cJSON_IsTrue(isRegister);
if (VECTOR_Add(&(g_server.sysCapabilitys), impl) == INVALID_INDEX) {
SAMGR_Free(impl);
- HILOG_ERROR(HILOG_MODULE_SAMGR, "system capability %s register failed!", impl->name);
+ HILOG_ERROR(HILOG_MODULE_SAMGR, "Registering system capability %s failed!", impl->name);
continue;
}
sysCapNum++;