Michal Schmidt e43452
From 24954dcfd60261600c04ffdfc9cd0b1980a4b7d3 Mon Sep 17 00:00:00 2001
Michal Schmidt e43452
From: Lennart Poettering <lennart@poettering.net>
Michal Schmidt e43452
Date: Tue, 3 Jan 2012 20:34:09 +0100
Michal Schmidt f1996e
Subject: [PATCH] readahead: bring export definition of sd-readahead in line
Michal Schmidt f1996e
 with sd-daemon (cherry picked from commit
Michal Schmidt e43452
 4f3656e1cec7fe3d7d3537e23a406cb88d734502)
Michal Schmidt e43452
Michal Schmidt e43452
---
Michal Schmidt e43452
 src/sd-readahead.c |   14 +++++++++++++-
Michal Schmidt e43452
 src/sd-readahead.h |   10 +---------
Michal Schmidt e43452
 2 files changed, 14 insertions(+), 10 deletions(-)
Michal Schmidt e43452
Michal Schmidt e43452
diff --git a/src/sd-readahead.c b/src/sd-readahead.c
Michal Schmidt e43452
index c5cfe67..a334066 100644
Michal Schmidt e43452
--- a/src/sd-readahead.c
Michal Schmidt e43452
+++ b/src/sd-readahead.c
Michal Schmidt e43452
@@ -37,6 +37,18 @@
Michal Schmidt e43452
 
Michal Schmidt e43452
 #include "sd-readahead.h"
Michal Schmidt e43452
 
Michal Schmidt e43452
+#if (__GNUC__ >= 4)
Michal Schmidt e43452
+#ifdef SD_EXPORT_SYMBOLS
Michal Schmidt e43452
+/* Export symbols */
Michal Schmidt e43452
+#define _sd_export_ __attribute__ ((visibility("default")))
Michal Schmidt e43452
+#else
Michal Schmidt e43452
+/* Don't export the symbols */
Michal Schmidt e43452
+#define _sd_export_ __attribute__ ((visibility("hidden")))
Michal Schmidt e43452
+#endif
Michal Schmidt e43452
+#else
Michal Schmidt e43452
+#define _sd_export_
Michal Schmidt e43452
+#endif
Michal Schmidt e43452
+
Michal Schmidt e43452
 static int touch(const char *path) {
Michal Schmidt e43452
 
Michal Schmidt e43452
 #if !defined(DISABLE_SYSTEMD) && defined(__linux__)
Michal Schmidt e43452
@@ -60,7 +72,7 @@ static int touch(const char *path) {
Michal Schmidt e43452
         return 0;
Michal Schmidt e43452
 }
Michal Schmidt e43452
 
Michal Schmidt e43452
-int sd_readahead(const char *action) {
Michal Schmidt e43452
+_sd_export_ int sd_readahead(const char *action) {
Michal Schmidt e43452
 
Michal Schmidt e43452
         if (!action)
Michal Schmidt e43452
                 return -EINVAL;
Michal Schmidt e43452
diff --git a/src/sd-readahead.h b/src/sd-readahead.h
Michal Schmidt e43452
index 5bf975a..ee7e306 100644
Michal Schmidt e43452
--- a/src/sd-readahead.h
Michal Schmidt e43452
+++ b/src/sd-readahead.h
Michal Schmidt e43452
@@ -56,14 +56,6 @@ extern "C" {
Michal Schmidt e43452
   See sd-readahead(7) for more information.
Michal Schmidt e43452
 */
Michal Schmidt e43452
 
Michal Schmidt e43452
-#ifndef _sd_hidden_
Michal Schmidt e43452
-#if (__GNUC__ >= 4) && !defined(SD_EXPORT_SYMBOLS)
Michal Schmidt e43452
-#define _sd_hidden_ __attribute__ ((visibility("hidden")))
Michal Schmidt e43452
-#else
Michal Schmidt e43452
-#define _sd_hidden_
Michal Schmidt e43452
-#endif
Michal Schmidt e43452
-#endif
Michal Schmidt e43452
-
Michal Schmidt e43452
 /*
Michal Schmidt e43452
   Controls ongoing disk read-ahead operations during boot-up. The argument
Michal Schmidt e43452
   must be a string, and either "cancel", "done" or "noreplay".
Michal Schmidt e43452
@@ -72,7 +64,7 @@ extern "C" {
Michal Schmidt e43452
   done = terminate read-ahead data collection, keep collected information
Michal Schmidt e43452
   noreplay = terminate read-ahead replay
Michal Schmidt e43452
 */
Michal Schmidt e43452
-int sd_readahead(const char *action) _sd_hidden_;
Michal Schmidt e43452
+int sd_readahead(const char *action);
Michal Schmidt e43452
 
Michal Schmidt e43452
 #ifdef __cplusplus
Michal Schmidt e43452
 }