liblog: replace "frontend" with "transport"

We still do not have any users of the 'frontend' interface, let's
right a wrong and rename it to 'transport' as it makes more sense.
Renames android_log_set_frontend, android_log_get_frontend and
include/log/log_frontend.h.

SideEffects: None
Test: gTest liblog-unit-tests
Bug: 27405083
Change-Id: I7c1c0f3dfdc7cf047285403e306edbd16ad1324d
diff --git a/liblog/README b/liblog/README
index 40a39ad..5a845be 100644
--- a/liblog/README
+++ b/liblog/README
@@ -108,10 +108,10 @@
 
        int android_log_destroy(android_log_context *ctx)
 
-       #include <log/log_frontend.h>
+       #include <log/log_transport.h>
 
-       int android_set_log_frontend(int frontend_flag)
-       int android_get_log_frontend()
+       int android_set_log_transport(int transport_flag)
+       int android_get_log_transport()
 
        Link with -llog
 
@@ -167,12 +167,12 @@
        when  opening  the  sub-log.    It  is  recommended  to  open  the  log
        ANDROID_LOG_RDONLY in these cases.
 
-       android_set_log_frontend() selects frontend filters. Argument is either
-       LOGGER_DEFAULT, LOGGER_LOGD, LOGGER_NULL or LOGGER_LOCAL. Log to logger
-       daemon for default or logd,  drop contents on floor,  or log into local
-       memory   respectively.          Both   android_set_log_frontend()   and
-       android_get_log_frontend()  return  the  current  frontend mask,   or a
-       negative errno for any problems.
+       android_set_log_transport()  selects  transport  filters.  Argument  is
+       either LOGGER_DEFAULT, LOGGER_LOGD, LOGGER_NULL or LOGGER_LOCAL. Log to
+       logger daemon for default or logd, drop contents on floor,  or log into
+       local   memory   respectively.       Both   android_set_log_transport()
+       and android_get_log_transport() return the current  transport mask,  or
+       a negative errno for any problems.
 
 ERRORS
        If messages fail, a negative error code will be returned to the caller.
diff --git a/liblog/config_read.c b/liblog/config_read.c
index 718b779..ca80c80 100644
--- a/liblog/config_read.c
+++ b/liblog/config_read.c
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-#include <log/log_frontend.h>
+#include <log/log_transport.h>
 
 #include "config_read.h"
 #include "logger.h"
@@ -55,15 +55,15 @@
 }
 
 LIBLOG_HIDDEN void __android_log_config_read() {
-  if (__android_log_frontend & LOGGER_LOCAL) {
+  if (__android_log_transport & LOGGER_LOCAL) {
     extern struct android_log_transport_read localLoggerRead;
 
     __android_log_add_transport(&__android_log_transport_read, &localLoggerRead);
   }
 
 #if (FAKE_LOG_DEVICE == 0)
-  if ((__android_log_frontend == LOGGER_DEFAULT) ||
-      (__android_log_frontend & LOGGER_LOGD)) {
+  if ((__android_log_transport == LOGGER_DEFAULT) ||
+      (__android_log_transport & LOGGER_LOGD)) {
     extern struct android_log_transport_read logdLoggerRead;
     extern struct android_log_transport_read pmsgLoggerRead;
 
diff --git a/liblog/config_write.c b/liblog/config_write.c
index 2257070..0a8b52f 100644
--- a/liblog/config_write.c
+++ b/liblog/config_write.c
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-#include <log/log_frontend.h>
+#include <log/log_transport.h>
 
 #include "config_write.h"
 #include "logger.h"
@@ -55,15 +55,15 @@
 }
 
 LIBLOG_HIDDEN void __android_log_config_write() {
-  if (__android_log_frontend & LOGGER_LOCAL) {
+  if (__android_log_transport & LOGGER_LOCAL) {
     extern struct android_log_transport_write localLoggerWrite;
 
     __android_log_add_transport(&__android_log_transport_write,
                                 &localLoggerWrite);
   }
 
-  if ((__android_log_frontend == LOGGER_DEFAULT) ||
-      (__android_log_frontend & LOGGER_LOGD)) {
+  if ((__android_log_transport == LOGGER_DEFAULT) ||
+      (__android_log_transport & LOGGER_LOGD)) {
 #if (FAKE_LOG_DEVICE == 0)
     extern struct android_log_transport_write logdLoggerWrite;
     extern struct android_log_transport_write pmsgLoggerWrite;
@@ -79,7 +79,7 @@
 #endif
   }
 
-  if (__android_log_frontend & LOGGER_STDERR) {
+  if (__android_log_transport & LOGGER_STDERR) {
     extern struct android_log_transport_write stderrLoggerWrite;
 
     /*
diff --git a/liblog/include/log/log_frontend.h b/liblog/include/log/log_transport.h
similarity index 66%
rename from liblog/include/log/log_frontend.h
rename to liblog/include/log/log_transport.h
index 8a69f5e..80b30db 100644
--- a/liblog/include/log/log_frontend.h
+++ b/liblog/include/log/log_transport.h
@@ -7,15 +7,15 @@
 ** General Public License.
 */
 
-#ifndef _LIBS_LOG_FRONTEND_H
-#define _LIBS_LOG_FRONTEND_H
+#ifndef _LIBS_LOG_TRANSPORT_H
+#define _LIBS_LOG_TRANSPORT_H
 
 #ifdef __cplusplus
 extern "C" {
 #endif
 
 /*
- * Logging frontends, bit mask to select features. Function returns selection.
+ * Logging transports, bit mask to select features. Function returns selection.
  */
 /* clang-format off */
 #define LOGGER_DEFAULT 0x00
@@ -26,12 +26,12 @@
 #define LOGGER_STDERR  0x10 /* logs sent to stderr */
 /* clang-format on */
 
-/* Both return the selected frontend flag mask, or negative errno */
-int android_set_log_frontend(int frontend_flag);
-int android_get_log_frontend();
+/* Both return the selected transport flag mask, or negative errno */
+int android_set_log_transport(int transport_flag);
+int android_get_log_transport();
 
 #ifdef __cplusplus
 }
 #endif
 
-#endif /* _LIBS_LOG_FRONTEND_H */
+#endif /* _LIBS_LOG_TRANSPORT_H */
diff --git a/liblog/local_logger.c b/liblog/local_logger.c
index 9906eb7..522867d 100644
--- a/liblog/local_logger.c
+++ b/liblog/local_logger.c
@@ -27,7 +27,7 @@
 #include <sys/types.h>
 
 #include <cutils/list.h> /* template, no library dependency */
-#include <log/log_frontend.h>
+#include <log/log_transport.h>
 #include <private/android_filesystem_config.h>
 #include <private/android_logger.h>
 #include <system/thread_defs.h>
@@ -273,7 +273,7 @@
 
 /* Android hard coded permitted, system goes to logd */
 #if !defined(__MINGW32__)
-  if (__android_log_frontend == LOGGER_DEFAULT) {
+  if (__android_log_transport == LOGGER_DEFAULT) {
     uid = __android_log_uid();
     if ((uid < AID_APP) && (getpwuid(uid) != NULL)) {
       return -EPERM;
diff --git a/liblog/logger.h b/liblog/logger.h
index 1a39ec0..246b33c 100644
--- a/liblog/logger.h
+++ b/liblog/logger.h
@@ -193,7 +193,7 @@
 LIBLOG_HIDDEN int __android_log_trylock();
 LIBLOG_HIDDEN void __android_log_unlock();
 
-LIBLOG_HIDDEN int __android_log_frontend;
+LIBLOG_HIDDEN int __android_log_transport;
 
 __END_DECLS
 
diff --git a/liblog/logger_write.c b/liblog/logger_write.c
index 79de6ce..d322c0f 100644
--- a/liblog/logger_write.c
+++ b/liblog/logger_write.c
@@ -25,7 +25,7 @@
 #endif
 
 #include <log/event_tag_map.h>
-#include <log/log_frontend.h>
+#include <log/log_transport.h>
 #include <private/android_filesystem_config.h>
 #include <private/android_logger.h>
 
@@ -609,12 +609,12 @@
 
 /* Following functions need access to our internal write_to_log status */
 
-LIBLOG_HIDDEN int __android_log_frontend;
+LIBLOG_HIDDEN int __android_log_transport;
 
-LIBLOG_ABI_PUBLIC int android_set_log_frontend(int frontend_flag) {
+LIBLOG_ABI_PUBLIC int android_set_log_transport(int transport_flag) {
   int retval;
 
-  if (frontend_flag < 0) {
+  if (transport_flag < 0) {
     return -EINVAL;
   }
 
@@ -622,7 +622,7 @@
 
   __android_log_lock();
 
-  if (frontend_flag & LOGGER_NULL) {
+  if (transport_flag & LOGGER_NULL) {
     write_to_log = __write_to_log_null;
 
     __android_log_unlock();
@@ -630,12 +630,12 @@
     return retval;
   }
 
-  __android_log_frontend &= LOGGER_LOCAL | LOGGER_LOGD | LOGGER_STDERR;
+  __android_log_transport &= LOGGER_LOCAL | LOGGER_LOGD | LOGGER_STDERR;
 
-  frontend_flag &= LOGGER_LOCAL | LOGGER_LOGD | LOGGER_STDERR;
+  transport_flag &= LOGGER_LOCAL | LOGGER_LOGD | LOGGER_STDERR;
 
-  if (__android_log_frontend != frontend_flag) {
-    __android_log_frontend = frontend_flag;
+  if (__android_log_transport != transport_flag) {
+    __android_log_transport = transport_flag;
     __android_log_config_write_close();
     __android_log_config_read_close();
 
@@ -646,22 +646,22 @@
     write_to_log = __write_to_log_init;
   }
 
-  retval = __android_log_frontend;
+  retval = __android_log_transport;
 
   __android_log_unlock();
 
   return retval;
 }
 
-LIBLOG_ABI_PUBLIC int android_get_log_frontend() {
+LIBLOG_ABI_PUBLIC int android_get_log_transport() {
   int ret = LOGGER_DEFAULT;
 
   __android_log_lock();
   if (write_to_log == __write_to_log_null) {
     ret = LOGGER_NULL;
   } else {
-    __android_log_frontend &= LOGGER_LOCAL | LOGGER_LOGD | LOGGER_STDERR;
-    ret = __android_log_frontend;
+    __android_log_transport &= LOGGER_LOCAL | LOGGER_LOGD | LOGGER_STDERR;
+    ret = __android_log_transport;
     if ((write_to_log != __write_to_log_init) &&
         (write_to_log != __write_to_log_daemon)) {
       ret = -EINVAL;
diff --git a/liblog/tests/liblog_benchmark.cpp b/liblog/tests/liblog_benchmark.cpp
index 5ce9804..3f79552 100644
--- a/liblog/tests/liblog_benchmark.cpp
+++ b/liblog/tests/liblog_benchmark.cpp
@@ -27,7 +27,7 @@
 #include <android-base/file.h>
 #include <cutils/sockets.h>
 #include <log/event_tag_map.h>
-#include <log/log_frontend.h>
+#include <log/log_transport.h>
 #include <private/android_logger.h>
 
 #include "benchmark.h"
@@ -80,11 +80,11 @@
 BENCHMARK(BM_log_maximum);
 
 static void set_log_null() {
-  android_set_log_frontend(LOGGER_NULL);
+  android_set_log_transport(LOGGER_NULL);
 }
 
 static void set_log_default() {
-  android_set_log_frontend(LOGGER_DEFAULT);
+  android_set_log_transport(LOGGER_DEFAULT);
 }
 
 static void BM_log_maximum_null(int iters) {
diff --git a/liblog/tests/liblog_test.cpp b/liblog/tests/liblog_test.cpp
index cb8c7c6..d68ca46 100644
--- a/liblog/tests/liblog_test.cpp
+++ b/liblog/tests/liblog_test.cpp
@@ -36,7 +36,7 @@
 #endif
 #include <gtest/gtest.h>
 #include <log/log_event_list.h>
-#include <log/log_frontend.h>
+#include <log/log_transport.h>
 #include <log/logprint.h>
 #include <private/android_filesystem_config.h>
 #include <private/android_logger.h>
@@ -255,7 +255,7 @@
 }
 
 #if (defined(__ANDROID__) || defined(USING_LOGGER_LOCAL))
-static void print_frontend(const char* prefix, int logger) {
+static void print_transport(const char* prefix, int logger) {
   static const char orstr[] = " | ";
 
   if (!prefix) {
@@ -305,21 +305,21 @@
 // This test makes little sense standalone, and requires the tests ahead
 // and behind us, to make us whole.  We could incorporate a prefix and
 // suffix test to make this standalone, but opted to not complicate this.
-TEST(liblog, android_set_log_frontend) {
+TEST(liblog, android_set_log_transport) {
 #if (defined(__ANDROID__) || defined(USING_LOGGER_LOCAL))
 #ifdef TEST_PREFIX
   TEST_PREFIX
 #endif
 
-  int logger = android_get_log_frontend();
-  print_frontend("android_get_log_frontend = ", logger);
+  int logger = android_get_log_transport();
+  print_transport("android_get_log_transport = ", logger);
   EXPECT_NE(LOGGER_NULL, logger);
 
   int ret;
-  EXPECT_EQ(LOGGER_NULL, ret = android_set_log_frontend(LOGGER_NULL));
-  print_frontend("android_set_log_frontend = ", ret);
-  EXPECT_EQ(LOGGER_NULL, ret = android_get_log_frontend());
-  print_frontend("android_get_log_frontend = ", ret);
+  EXPECT_EQ(LOGGER_NULL, ret = android_set_log_transport(LOGGER_NULL));
+  print_transport("android_set_log_transport = ", ret);
+  EXPECT_EQ(LOGGER_NULL, ret = android_get_log_transport());
+  print_transport("android_get_log_transport = ", ret);
 
   pid_t pid = getpid();
 
@@ -364,10 +364,10 @@
 
   android_logger_list_close(logger_list);
 
-  EXPECT_EQ(logger, ret = android_set_log_frontend(logger));
-  print_frontend("android_set_log_frontend = ", ret);
-  EXPECT_EQ(logger, ret = android_get_log_frontend());
-  print_frontend("android_get_log_frontend = ", ret);
+  EXPECT_EQ(logger, ret = android_set_log_transport(logger));
+  print_transport("android_set_log_transport = ", ret);
+  EXPECT_EQ(logger, ret = android_get_log_transport());
+  print_transport("android_get_log_transport = ", ret);
 
   // False negative if liblog.__android_log_btwrite__android_logger_list_read
   // fails above, so we will likely succeed. But we will have so many
diff --git a/liblog/tests/liblog_test_default.cpp b/liblog/tests/liblog_test_default.cpp
index 079ba07..cbd0d25 100644
--- a/liblog/tests/liblog_test_default.cpp
+++ b/liblog/tests/liblog_test_default.cpp
@@ -1,5 +1,5 @@
 #ifdef __ANDROID__
-#include <log/log_frontend.h>
-#define TEST_PREFIX android_set_log_frontend(LOGGER_DEFAULT);
+#include <log/log_transport.h>
+#define TEST_PREFIX android_set_log_transport(LOGGER_DEFAULT);
 #endif
 #include "liblog_test.cpp"
diff --git a/liblog/tests/liblog_test_local.cpp b/liblog/tests/liblog_test_local.cpp
index 5f7f645..9d7b3d7 100644
--- a/liblog/tests/liblog_test_local.cpp
+++ b/liblog/tests/liblog_test_local.cpp
@@ -1,4 +1,4 @@
-#include <log/log_frontend.h>
+#include <log/log_transport.h>
 #define liblog liblog_local
-#define TEST_PREFIX android_set_log_frontend(LOGGER_LOCAL);
+#define TEST_PREFIX android_set_log_transport(LOGGER_LOCAL);
 #include "liblog_test.cpp"
diff --git a/liblog/tests/liblog_test_stderr.cpp b/liblog/tests/liblog_test_stderr.cpp
index f0cb192..f9e4e1f 100644
--- a/liblog/tests/liblog_test_stderr.cpp
+++ b/liblog/tests/liblog_test_stderr.cpp
@@ -1,5 +1,5 @@
-#include <log/log_frontend.h>
+#include <log/log_transport.h>
 #define liblog liblog_stderr
-#define TEST_PREFIX android_set_log_frontend(LOGGER_STDERR);
+#define TEST_PREFIX android_set_log_transport(LOGGER_STDERR);
 #define USING_LOGGER_STDERR
 #include "liblog_test.cpp"
diff --git a/liblog/tests/liblog_test_stderr_local.cpp b/liblog/tests/liblog_test_stderr_local.cpp
index 1555b4e..21406ca 100644
--- a/liblog/tests/liblog_test_stderr_local.cpp
+++ b/liblog/tests/liblog_test_stderr_local.cpp
@@ -1,4 +1,4 @@
-#include <log/log_frontend.h>
+#include <log/log_transport.h>
 #define liblog liblog_stderr_local
-#define TEST_PREFIX android_set_log_frontend(LOGGER_LOCAL | LOGGER_STDERR);
+#define TEST_PREFIX android_set_log_transport(LOGGER_LOCAL | LOGGER_STDERR);
 #include "liblog_test.cpp"