From 317bfb923c12af688d18fc9a3580dff201b2482b Mon Sep 17 00:00:00 2001 From: Mark Salyzyn Date: Tue, 23 Feb 2016 08:55:43 -0800 Subject: [PATCH] logd: Allow (some) headers to be individually importable (cherry pick from commit 2ad0bd0a9b594bbe2560b405b0008b7bc742cfca) LogReader.h needs to be individually importable. Fix a few others, drop includes of local includes, let them be included in source instead and allow headers to be included alphabetically. Was not a complete audit since goal was to separate LogReader.h out from the pack. Bug: 27242723 Change-Id: Ic7759ef90995e5bd285810706af33550c73cf5b5 --- logd/FlushCommand.cpp | 3 +++ logd/LogAudit.cpp | 5 +++++ logd/LogAudit.h | 5 ++++- logd/LogBufferElement.cpp | 2 ++ logd/LogKlog.cpp | 3 +++ logd/LogKlog.h | 4 +++- logd/LogListener.cpp | 1 + logd/LogReader.cpp | 5 ++++- logd/LogReader.h | 4 ++-- logd/LogTimes.h | 1 + 10 files changed, 28 insertions(+), 5 deletions(-) diff --git a/logd/FlushCommand.cpp b/logd/FlushCommand.cpp index fd45c4a0a..6a26d00f3 100644 --- a/logd/FlushCommand.cpp +++ b/logd/FlushCommand.cpp @@ -16,7 +16,10 @@ #include +#include + #include "FlushCommand.h" +#include "LogBuffer.h" #include "LogBufferElement.h" #include "LogCommand.h" #include "LogReader.h" diff --git a/logd/LogAudit.cpp b/logd/LogAudit.cpp index fffc9ba96..230dd1125 100644 --- a/logd/LogAudit.cpp +++ b/logd/LogAudit.cpp @@ -20,10 +20,13 @@ #include #include #include +#include #include #include #include +#include + #include #include #include @@ -31,7 +34,9 @@ #include "libaudit.h" #include "LogAudit.h" +#include "LogBuffer.h" #include "LogKlog.h" +#include "LogReader.h" #ifndef AUDITD_ENFORCE_INTEGRITY #define AUDITD_ENFORCE_INTEGRITY false diff --git a/logd/LogAudit.h b/logd/LogAudit.h index 455ed58c0..3a84541a7 100644 --- a/logd/LogAudit.h +++ b/logd/LogAudit.h @@ -18,7 +18,10 @@ #define _LOGD_LOG_AUDIT_H__ #include -#include "LogReader.h" + +#include "LogBuffer.h" + +class LogReader; class LogAudit : public SocketListener { LogBuffer *logbuf; diff --git a/logd/LogBufferElement.cpp b/logd/LogBufferElement.cpp index fde9ad7e3..eb5194c6f 100644 --- a/logd/LogBufferElement.cpp +++ b/logd/LogBufferElement.cpp @@ -25,9 +25,11 @@ #include #include +#include "LogBuffer.h" #include "LogBufferElement.h" #include "LogCommand.h" #include "LogReader.h" +#include "LogUtils.h" const uint64_t LogBufferElement::FLUSH_ERROR(0); atomic_int_fast64_t LogBufferElement::sequence(1); diff --git a/logd/LogKlog.cpp b/logd/LogKlog.cpp index 9690489ce..ac2b12895 100644 --- a/logd/LogKlog.cpp +++ b/logd/LogKlog.cpp @@ -20,13 +20,16 @@ #include #include #include +#include #include #include #include #include +#include "LogBuffer.h" #include "LogKlog.h" +#include "LogReader.h" #define KMSG_PRIORITY(PRI) \ '<', \ diff --git a/logd/LogKlog.h b/logd/LogKlog.h index 3c8cc8789..ee73b7187 100644 --- a/logd/LogKlog.h +++ b/logd/LogKlog.h @@ -19,10 +19,12 @@ #include #include -#include "LogReader.h" char *log_strntok_r(char *s, size_t *len, char **saveptr, size_t *sublen); +class LogBuffer; +class LogReader; + class LogKlog : public SocketListener { LogBuffer *logbuf; LogReader *reader; diff --git a/logd/LogListener.cpp b/logd/LogListener.cpp index 846dd7c41..39dd2272a 100644 --- a/logd/LogListener.cpp +++ b/logd/LogListener.cpp @@ -27,6 +27,7 @@ #include #include +#include "LogBuffer.h" #include "LogListener.h" #include "LogUtils.h" diff --git a/logd/LogReader.cpp b/logd/LogReader.cpp index 667a3f249..16362379c 100644 --- a/logd/LogReader.cpp +++ b/logd/LogReader.cpp @@ -21,8 +21,11 @@ #include -#include "LogReader.h" #include "FlushCommand.h" +#include "LogBuffer.h" +#include "LogBufferElement.h" +#include "LogReader.h" +#include "LogUtils.h" LogReader::LogReader(LogBuffer *logbuf) : SocketListener(getLogSocket(), true), diff --git a/logd/LogReader.h b/logd/LogReader.h index 91559a335..174ee651d 100644 --- a/logd/LogReader.h +++ b/logd/LogReader.h @@ -18,8 +18,8 @@ #define _LOGD_LOG_WRITER_H__ #include -#include "LogBuffer.h" -#include "LogTimes.h" + +class LogBuffer; class LogReader : public SocketListener { LogBuffer &mLogbuf; diff --git a/logd/LogTimes.h b/logd/LogTimes.h index 1117088e5..f5969df35 100644 --- a/logd/LogTimes.h +++ b/logd/LogTimes.h @@ -27,6 +27,7 @@ #include class LogReader; +class LogBufferElement; class LogTimeEntry { static pthread_mutex_t timesLock;