Modify and print log information

Signed-off-by: toutes <zhaoruiyuan2@huawei.com>
This commit is contained in:
toutes
2021-12-01 15:44:55 +08:00
parent bf4f0ea338
commit 10acd53868
4 changed files with 14 additions and 14 deletions
+8 -8
View File
@@ -40,7 +40,7 @@ static BOOL AddRunningLock(RunningLock *lock)
}
int16_t pos = VECTOR_Add(&g_runningLocks, (void *)lock);
if (pos == INVALID_INDEX) {
POWER_HILOGE("Failed to add lock to vector for lock: %s", lock->name);
POWER_HILOGE("Failed to add lock to vector");
pthread_mutex_unlock(&g_mutex);
return FALSE;
}
@@ -54,7 +54,7 @@ static BOOL RemoveRunningLock(const RunningLock *lock)
pthread_mutex_lock(&g_mutex);
int16_t pos = VECTOR_Find(&g_runningLocks, (void *)lock);
if (pos < 0) {
POWER_HILOGE("Non-existent running lock: %s", lock->name);
POWER_HILOGE("Non-existent running lock");
pthread_mutex_unlock(&g_mutex);
return FALSE;
}
@@ -115,19 +115,19 @@ const RunningLock *CreateRunningLock(const char *name, RunningLockType type, Run
return NULL;
}
AddRunningLock(&entry->lock);
POWER_HILOGI("Create %s, pid: %u, token: %llu", name, entry->identity.pid, (long long)entry->identity.token);
POWER_HILOGD("Create %s, pid: %u, token: %llu", name, entry->identity.pid, (long long)entry->identity.token);
return &entry->lock;
}
BOOL AcquireRunningLock(const RunningLock *lock)
{
if (IsRunningLockExisted(lock) == FALSE) {
POWER_HILOGE("Non-existent running lock: %s", lock->name);
POWER_HILOGE("Non-existent running lock");
return FALSE;
}
RunningLockEntry *entry = GetRunningLockEntry(lock);
if (entry->status.isHolding == TRUE) {
POWER_HILOGI("Already acquired, name: %s", lock->name);
POWER_HILOGD("Already acquired, name: %s", lock->name);
return TRUE;
}
entry->status.isHolding = AcquireRunningLockEntry(entry, -1);
@@ -137,12 +137,12 @@ BOOL AcquireRunningLock(const RunningLock *lock)
BOOL ReleaseRunningLock(const RunningLock *lock)
{
if (IsRunningLockExisted(lock) == FALSE) {
POWER_HILOGE("Non-existent running lock: %s", lock->name);
POWER_HILOGE("Non-existent running lock");
return FALSE;
}
RunningLockEntry *entry = GetRunningLockEntry(lock);
if (entry->status.isHolding == FALSE) {
POWER_HILOGI("Already released, name: %s", lock->name);
POWER_HILOGD("Already released, name: %s", lock->name);
return TRUE;
}
entry->status.isHolding = !ReleaseRunningLockEntry(entry);
@@ -164,7 +164,7 @@ void DestroyRunningLock(const RunningLock *lock)
BOOL IsRunningLockHolding(const RunningLock *lock)
{
if (IsRunningLockExisted(lock) == FALSE) {
POWER_HILOGE("Non-existent running lock: %s", lock->name);
POWER_HILOGE("Non-existent running lock");
return FALSE;
}
RunningLockEntry *entry = GetRunningLockEntry(lock);
+1 -1
View File
@@ -93,7 +93,7 @@ void OnWakeupDevice(IUnknown *iUnknown, WakeupDeviceType reason, const char* det
* It should check if the calling pid has permission to wakeup device
*/
(void)iUnknown;
POWER_HILOGI("Waking up device, reason: %{public}d, details: %{public}s", reason, details);
POWER_HILOGI("Waking up device, reason: %{public}d", reason);
DisableSuspend();
}
+3 -3
View File
@@ -51,7 +51,7 @@ static BOOL AddRunningLockEntryLocked(Vector *vec, RunningLockEntry *entry)
{
int16_t pos = VECTOR_FindByKey(vec, (void *)&entry->identity);
if (pos >= 0) {
POWER_HILOGI("Already acquired: %s", entry->lock.name);
POWER_HILOGD("Already acquired: %s", entry->lock.name);
return TRUE;
}
RunningLockEntry *e = DupRunningLockEntry(entry);
@@ -61,7 +61,7 @@ static BOOL AddRunningLockEntryLocked(Vector *vec, RunningLockEntry *entry)
}
pos = VECTOR_Add(vec, (void *)e);
if (pos == INVALID_INDEX) {
POWER_HILOGE("Failed to add entry to vector for lock: %s", e->lock.name);
POWER_HILOGE("Failed to add entry to vector");
free(e);
return FALSE;
}
@@ -76,7 +76,7 @@ static BOOL RemoveRunningLockEntryLocked(Vector *vec, RunningLockEntry *entry)
{
int16_t pos = VECTOR_FindByKey(vec, (void *)&entry->identity);
if (pos < 0) {
POWER_HILOGE("Non-existent running lock: %s", entry->lock.name);
POWER_HILOGE("Non-existent running lock");
return TRUE;
}
RunningLockEntry *e = (RunningLockEntry *)VECTOR_Swap(vec, pos, NULL);
+2 -2
View File
@@ -56,7 +56,7 @@ static BOOL StartTimer(PowerTimer timer, int64_t whenMsec, int64_t intervalMsec)
SetTimeSpec(&ts.it_interval, intervalMsec);
int32_t ret = timer_settime(timer, 0, &ts, NULL);
if (ret < 0) {
POWER_HILOGE("Failed to start timer: %s", strerror(errno));
POWER_HILOGE("Failed to start timer");
return FALSE;
}
return TRUE;
@@ -94,7 +94,7 @@ PowerTimer *PowerMgrCreateTimer(int64_t whenMsec, int64_t intervalMsec, PowerTim
evp.sigev_notify_function = TimerHandle;
int32_t ret = timer_create(CLOCK_REALTIME, &evp, &info->timerId);
if (ret < 0) {
POWER_HILOGE("Failed to create timer: %s", strerror(errno));
POWER_HILOGE("Failed to create timer");
free(info);
return NULL;
}