summaryrefslogtreecommitdiffstats
path: root/src/shared
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2021-09-28 23:24:57 +0200
committerLennart Poettering <lennart@poettering.net>2021-11-25 12:10:34 +0100
commit4dc07c3a9a1f9d0eb339baceed7bac3acef1c0ac (patch)
tree8ab11eb4f9207c12b086a145fab41b8bd0b3b404 /src/shared
parentlist: add LIST_POP() helper that pops the first item off a linked list (diff)
downloadsystemd-4dc07c3a9a1f9d0eb339baceed7bac3acef1c0ac.tar.xz
systemd-4dc07c3a9a1f9d0eb339baceed7bac3acef1c0ac.zip
repart,homed: split out disk cleanup macros into generic header
Diffstat (limited to 'src/shared')
-rw-r--r--src/shared/fdisk-util.h15
-rw-r--r--src/shared/meson.build1
2 files changed, 16 insertions, 0 deletions
diff --git a/src/shared/fdisk-util.h b/src/shared/fdisk-util.h
new file mode 100644
index 0000000000..64c0c2f324
--- /dev/null
+++ b/src/shared/fdisk-util.h
@@ -0,0 +1,15 @@
+/* SPDX-License-Identifier: LGPL-2.1-or-later */
+#pragma once
+
+#if HAVE_LIBFDISK
+
+#include <libfdisk.h>
+
+#include "macro.h"
+
+DEFINE_TRIVIAL_CLEANUP_FUNC_FULL(struct fdisk_context*, fdisk_unref_context, NULL);
+DEFINE_TRIVIAL_CLEANUP_FUNC_FULL(struct fdisk_partition*, fdisk_unref_partition, NULL);
+DEFINE_TRIVIAL_CLEANUP_FUNC_FULL(struct fdisk_parttype*, fdisk_unref_parttype, NULL);
+DEFINE_TRIVIAL_CLEANUP_FUNC_FULL(struct fdisk_table*, fdisk_unref_table, NULL);
+
+#endif
diff --git a/src/shared/meson.build b/src/shared/meson.build
index 00485e6543..130c03ec99 100644
--- a/src/shared/meson.build
+++ b/src/shared/meson.build
@@ -118,6 +118,7 @@ shared_sources = files('''
exit-status.h
extension-release.c
extension-release.h
+ fdisk-util.h
fdset.c
fdset.h
fileio-label.c