Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 1 | Upstream-Status: Backport |
| 2 | Signed-off-by: Ross Burton <ross.burton@intel.com> |
| 3 | |
| 4 | From 227b8a762fea1458547be2cdf0e6e4aac0079730 Mon Sep 17 00:00:00 2001 |
| 5 | From: Michael Olbrich <m.olbrich@pengutronix.de> |
| 6 | Date: Mon, 26 Mar 2018 17:34:53 +0200 |
| 7 | Subject: [PATCH] core: don't include libmount.h in a header file (#8580) |
| 8 | |
| 9 | linux/fs.h sys/mount.h, libmount.h and missing.h all include MS_* |
| 10 | definitions. |
| 11 | |
| 12 | To avoid problems, only one of linux/fs.h, sys/mount.h and libmount.h |
| 13 | should be included. And missing.h must be included last. |
| 14 | |
| 15 | Without this, building systemd may fail with: |
| 16 | |
| 17 | In file included from [...]/libmount/libmount.h:31:0, |
| 18 | from ../systemd-238/src/core/manager.h:23, |
| 19 | from ../systemd-238/src/core/emergency-action.h:37, |
| 20 | from ../systemd-238/src/core/unit.h:34, |
| 21 | from ../systemd-238/src/core/dbus-timer.h:25, |
| 22 | from ../systemd-238/src/core/timer.c:26: |
| 23 | [...]/sys/mount.h:57:2: error: expected identifier before numeric constant |
| 24 | --- |
| 25 | src/core/dbus-execute.c | 1 + |
| 26 | src/core/manager.h | 3 ++- |
| 27 | src/core/mount.c | 2 ++ |
| 28 | 3 files changed, 5 insertions(+), 1 deletion(-) |
| 29 | |
| 30 | diff --git a/src/core/dbus-execute.c b/src/core/dbus-execute.c |
| 31 | index 7344623ebf6..c342093bca4 100644 |
| 32 | --- a/src/core/dbus-execute.c |
| 33 | +++ b/src/core/dbus-execute.c |
| 34 | @@ -18,6 +18,7 @@ |
| 35 | along with systemd; If not, see <http://www.gnu.org/licenses/>. |
| 36 | ***/ |
| 37 | |
| 38 | +#include <sys/mount.h> |
| 39 | #include <sys/prctl.h> |
| 40 | #include <stdio_ext.h> |
| 41 | |
| 42 | diff --git a/src/core/manager.h b/src/core/manager.h |
| 43 | index 28c5da225b1..e09e0cdf5e9 100644 |
| 44 | --- a/src/core/manager.h |
| 45 | +++ b/src/core/manager.h |
| 46 | @@ -20,7 +20,6 @@ |
| 47 | along with systemd; If not, see <http://www.gnu.org/licenses/>. |
| 48 | ***/ |
| 49 | |
| 50 | -#include <libmount.h> |
| 51 | #include <stdbool.h> |
| 52 | #include <stdio.h> |
| 53 | |
| 54 | @@ -34,6 +33,8 @@ |
| 55 | #include "list.h" |
| 56 | #include "ratelimit.h" |
| 57 | |
| 58 | +struct libmnt_monitor; |
| 59 | + |
| 60 | /* Enforce upper limit how many names we allow */ |
| 61 | #define MANAGER_MAX_NAMES 131072 /* 128K */ |
| 62 | |
| 63 | diff --git a/src/core/mount.c b/src/core/mount.c |
| 64 | index 0e755da5c02..0154ebda5d6 100644 |
| 65 | --- a/src/core/mount.c |
| 66 | +++ b/src/core/mount.c |
| 67 | @@ -23,6 +23,8 @@ |
| 68 | #include <stdio.h> |
| 69 | #include <sys/epoll.h> |
| 70 | |
| 71 | +#include <libmount.h> |
| 72 | + |
| 73 | #include "sd-messages.h" |
| 74 | |
| 75 | #include "alloc-util.h" |