Use a trivial header file to share mnt_free_tablep and mnt_free_iterp.
It would be nicer put this in mount-util.h, but libmount.h is not in the
default include path, and the build system would have to be adjusted to pass
pkg-config include path in various places, and it's just not worth the trouble.
A separate header file works nicely.
#include <stdio.h>
#include <sys/epoll.h>
-#include <libmount.h>
-
#include "sd-messages.h"
#include "alloc-util.h"
#include "exit-status.h"
#include "format-util.h"
#include "fstab-util.h"
+#include "libmount-util.h"
#include "log.h"
#include "manager.h"
#include "mkdir.h"
#define RETRY_UMOUNT_MAX 32
-DEFINE_TRIVIAL_CLEANUP_FUNC(struct libmnt_table*, mnt_free_table);
-DEFINE_TRIVIAL_CLEANUP_FUNC(struct libmnt_iter*, mnt_free_iter);
-
static const UnitActiveState state_translation_table[_MOUNT_STATE_MAX] = {
[MOUNT_DEAD] = UNIT_INACTIVE,
[MOUNT_MOUNTING] = UNIT_ACTIVATING,
--- /dev/null
+/* SPDX-License-Identifier: LGPL-2.1+ */
+#pragma once
+
+/* This needs to be after sys/mount.h */
+#include <libmount.h>
+
+#include "macro.h"
+
+DEFINE_TRIVIAL_CLEANUP_FUNC(struct libmnt_table*, mnt_free_table);
+DEFINE_TRIVIAL_CLEANUP_FUNC(struct libmnt_iter*, mnt_free_iter);
json-internal.h
json.c
json.h
+ libmount-util.h
lockfile-util.c
lockfile-util.h
log-link.h
#include <sys/types.h>
#include <unistd.h>
-/* This needs to be after sys/mount.h :( */
-#include <libmount.h>
-
#include "sd-device.h"
#include "alloc-util.h"
#include "escape.h"
#include "fd-util.h"
#include "fstab-util.h"
+#include "libmount-util.h"
#include "linux-3.13/dm-ioctl.h"
#include "mount-setup.h"
#include "mount-util.h"
#include "util.h"
#include "virt.h"
-DEFINE_TRIVIAL_CLEANUP_FUNC(struct libmnt_table*, mnt_free_table);
-DEFINE_TRIVIAL_CLEANUP_FUNC(struct libmnt_iter*, mnt_free_iter);
-
static void mount_point_free(MountPoint **head, MountPoint *m) {
assert(head);
assert(m);