logd: specify clang format
Switch _all_ file's coding style to match to ease all future changes.
SideEffects: None
Test: compile
Bug: 35373582
Change-Id: I470cb17f64fa48f14aafc02f574e296bffe3a3f3
diff --git a/logd/LogTimes.cpp b/logd/LogTimes.cpp
index 2a04880..bdaeb75 100644
--- a/logd/LogTimes.cpp
+++ b/logd/LogTimes.cpp
@@ -19,30 +19,30 @@
#include "FlushCommand.h"
#include "LogBuffer.h"
-#include "LogTimes.h"
#include "LogReader.h"
+#include "LogTimes.h"
pthread_mutex_t LogTimeEntry::timesLock = PTHREAD_MUTEX_INITIALIZER;
-LogTimeEntry::LogTimeEntry(LogReader &reader, SocketClient *client,
+LogTimeEntry::LogTimeEntry(LogReader& reader, SocketClient* client,
bool nonBlock, unsigned long tail,
- unsigned int logMask, pid_t pid,
- uint64_t start, uint64_t timeout) :
- mRefCount(1),
- mRelease(false),
- mError(false),
- threadRunning(false),
- leadingDropped(false),
- mReader(reader),
- mLogMask(logMask),
- mPid(pid),
- mCount(0),
- mTail(tail),
- mIndex(0),
- mClient(client),
- mStart(start),
- mNonBlock(nonBlock),
- mEnd(LogBufferElement::getCurrentSequence()) {
+ unsigned int logMask, pid_t pid, uint64_t start,
+ uint64_t timeout)
+ : mRefCount(1),
+ mRelease(false),
+ mError(false),
+ threadRunning(false),
+ leadingDropped(false),
+ mReader(reader),
+ mLogMask(logMask),
+ mPid(pid),
+ mCount(0),
+ mTail(tail),
+ mIndex(0),
+ mClient(client),
+ mStart(start),
+ mNonBlock(nonBlock),
+ mEnd(LogBufferElement::getCurrentSequence()) {
mTimeout.tv_sec = timeout / NS_PER_SEC;
mTimeout.tv_nsec = timeout % NS_PER_SEC;
pthread_cond_init(&threadTriggeredCondition, NULL);
@@ -56,8 +56,8 @@
if (!pthread_attr_init(&attr)) {
if (!pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED)) {
- if (!pthread_create(&mThread, &attr,
- LogTimeEntry::threadStart, this)) {
+ if (!pthread_create(&mThread, &attr, LogTimeEntry::threadStart,
+ this)) {
pthread_attr_destroy(&attr);
return;
}
@@ -71,8 +71,8 @@
decRef_Locked();
}
-void LogTimeEntry::threadStop(void *obj) {
- LogTimeEntry *me = reinterpret_cast<LogTimeEntry *>(obj);
+void LogTimeEntry::threadStop(void* obj) {
+ LogTimeEntry* me = reinterpret_cast<LogTimeEntry*>(obj);
lock();
@@ -80,14 +80,14 @@
me->error_Locked();
}
- SocketClient *client = me->mClient;
+ SocketClient* client = me->mClient;
if (me->isError_Locked()) {
- LogReader &reader = me->mReader;
- LastLogTimes × = reader.logbuf().mTimes;
+ LogReader& reader = me->mReader;
+ LastLogTimes& times = reader.logbuf().mTimes;
LastLogTimes::iterator it = times.begin();
- while(it != times.end()) {
+ while (it != times.end()) {
if (*it == me) {
times.erase(it);
me->release_nodelete_Locked();
@@ -110,20 +110,20 @@
unlock();
}
-void *LogTimeEntry::threadStart(void *obj) {
+void* LogTimeEntry::threadStart(void* obj) {
prctl(PR_SET_NAME, "logd.reader.per");
- LogTimeEntry *me = reinterpret_cast<LogTimeEntry *>(obj);
+ LogTimeEntry* me = reinterpret_cast<LogTimeEntry*>(obj);
pthread_cleanup_push(threadStop, obj);
- SocketClient *client = me->mClient;
+ SocketClient* client = me->mClient;
if (!client) {
me->error();
return NULL;
}
- LogBuffer &logbuf = me->mReader.logbuf();
+ LogBuffer& logbuf = me->mReader.logbuf();
bool privileged = FlushCommand::hasReadLogs(client);
bool security = FlushCommand::hasSecurityLogs(client);
@@ -135,11 +135,9 @@
uint64_t start = me->mStart;
while (me->threadRunning && !me->isError_Locked()) {
-
if (me->mTimeout.tv_sec || me->mTimeout.tv_nsec) {
if (pthread_cond_timedwait(&me->threadTriggeredCondition,
- ×Lock,
- &me->mTimeout) == ETIMEDOUT) {
+ ×Lock, &me->mTimeout) == ETIMEDOUT) {
me->mTimeout.tv_sec = 0;
me->mTimeout.tv_nsec = 0;
}
@@ -151,10 +149,12 @@
unlock();
if (me->mTail) {
- logbuf.flushTo(client, start, privileged, security, FilterFirstPass, me);
+ logbuf.flushTo(client, start, privileged, security, FilterFirstPass,
+ me);
me->leadingDropped = true;
}
- start = logbuf.flushTo(client, start, privileged, security, FilterSecondPass, me);
+ start = logbuf.flushTo(client, start, privileged, security,
+ FilterSecondPass, me);
lock();
@@ -184,8 +184,8 @@
}
// A first pass to count the number of elements
-int LogTimeEntry::FilterFirstPass(const LogBufferElement *element, void *obj) {
- LogTimeEntry *me = reinterpret_cast<LogTimeEntry *>(obj);
+int LogTimeEntry::FilterFirstPass(const LogBufferElement* element, void* obj) {
+ LogTimeEntry* me = reinterpret_cast<LogTimeEntry*>(obj);
LogTimeEntry::lock();
@@ -201,8 +201,8 @@
me->mStart = element->getSequence();
}
- if ((!me->mPid || (me->mPid == element->getPid()))
- && (me->isWatching(element->getLogId()))) {
+ if ((!me->mPid || (me->mPid == element->getPid())) &&
+ (me->isWatching(element->getLogId()))) {
++me->mCount;
}
@@ -212,8 +212,8 @@
}
// A second pass to send the selected elements
-int LogTimeEntry::FilterSecondPass(const LogBufferElement *element, void *obj) {
- LogTimeEntry *me = reinterpret_cast<LogTimeEntry *>(obj);
+int LogTimeEntry::FilterSecondPass(const LogBufferElement* element, void* obj) {
+ LogTimeEntry* me = reinterpret_cast<LogTimeEntry*>(obj);
LogTimeEntry::lock();
@@ -267,7 +267,7 @@
LogTimeEntry::unlock();
return true;
}
- // FALLTHRU
+// FALLTHRU
skip:
LogTimeEntry::unlock();
@@ -279,7 +279,7 @@
}
void LogTimeEntry::cleanSkip_Locked(void) {
- for (log_id_t i = LOG_ID_MIN; i < LOG_ID_MAX; i = (log_id_t) (i + 1)) {
+ for (log_id_t i = LOG_ID_MIN; i < LOG_ID_MAX; i = (log_id_t)(i + 1)) {
skipAhead[i] = 0;
}
}