[MERGED] libosmocore[master]: disable various code if building for bare-iron embedded

Harald Welte gerrit-no-reply at lists.osmocom.org
Mon Jan 23 12:20:34 UTC 2017


Harald Welte has submitted this change and it was merged.

Change subject: disable various code if building for bare-iron embedded
......................................................................


disable various code if building for bare-iron embedded

We don't have file-based I/O nor ethernet devices with mac addresses
when building for OsmocomBB.

Change-Id: I01a9e6d8dbe885dbeac2769b84931a4d44f7a3a5
---
M src/logging.c
M src/macaddr.c
2 files changed, 12 insertions(+), 0 deletions(-)

Approvals:
  Jenkins Builder: Verified
  Holger Freyther: Looks good to me, approved



diff --git a/src/logging.c b/src/logging.c
index b0bca54..9b7d6f4 100644
--- a/src/logging.c
+++ b/src/logging.c
@@ -584,12 +584,14 @@
 	target->categories[category].loglevel = level;
 }
 
+#if (!EMBEDDED)
 static void _file_output(struct log_target *target, unsigned int level,
 			 const char *log)
 {
 	fprintf(target->tgt_file.out, "%s", log);
 	fflush(target->tgt_file.out);
 }
+#endif
 
 /*! \brief Create a new log target skeleton
  *  \returns dynamically-allocated log target
@@ -654,6 +656,7 @@
 #endif /* stderr */
 }
 
+#if (!EMBEDDED)
 /*! \brief Create a new file-based log target
  *  \param[in] fname File name of the new log file
  *  \returns Log target in case of success, NULL otherwise
@@ -677,6 +680,7 @@
 
 	return target;
 }
+#endif
 
 /*! \brief Find a registered log target
  *  \param[in] type Log target type
@@ -707,6 +711,7 @@
 	/* just in case, to make sure we don't have any references */
 	log_del_target(target);
 
+#if (!EMBEDDED)
 	if (target->output == &_file_output) {
 /* since C89/C99 says stderr is a macro, we can safely do this! */
 #ifdef stderr
@@ -718,6 +723,7 @@
 			target->tgt_file.out = NULL;
 		}
 	}
+#endif
 
 	talloc_free(target);
 }
diff --git a/src/macaddr.c b/src/macaddr.c
index f83e054..ceb1e0a 100644
--- a/src/macaddr.c
+++ b/src/macaddr.c
@@ -26,6 +26,8 @@
 
 /*! \file loggingrb.c */
 
+#include "config.h"
+
 #include <stdint.h>
 #include <string.h>
 #include <stdlib.h>
@@ -103,6 +105,8 @@
 
 #else
 
+#if (!EMBEDDED)
+
 #include <sys/ioctl.h>
 #include <net/if.h>
 #include <netinet/in.h>
@@ -134,6 +138,8 @@
 
 	return 0;
 }
+#endif /* !EMBEDDED */
+
 #endif
 
 /*! @} */

-- 
To view, visit https://gerrit.osmocom.org/1608
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I01a9e6d8dbe885dbeac2769b84931a4d44f7a3a5
Gerrit-PatchSet: 3
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Holger Freyther <holger at freyther.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Max <msuraev at sysmocom.de>


More information about the gerrit-log mailing list