summaryrefslogtreecommitdiffstats
path: root/src/basic/label.c
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-10 20:49:52 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-10 20:49:52 +0000
commit55944e5e40b1be2afc4855d8d2baf4b73d1876b5 (patch)
tree33f869f55a1b149e9b7c2b7e201867ca5dd52992 /src/basic/label.c
parentInitial commit. (diff)
downloadsystemd-55944e5e40b1be2afc4855d8d2baf4b73d1876b5.tar.xz
systemd-55944e5e40b1be2afc4855d8d2baf4b73d1876b5.zip
Adding upstream version 255.4.upstream/255.4
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/basic/label.c')
-rw-r--r--src/basic/label.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/basic/label.c b/src/basic/label.c
new file mode 100644
index 0000000..f134e77
--- /dev/null
+++ b/src/basic/label.c
@@ -0,0 +1,30 @@
+/* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+#include <errno.h>
+#include <stddef.h>
+
+#include "label.h"
+
+static const LabelOps *label_ops = NULL;
+
+int label_ops_set(const LabelOps *ops) {
+ if (label_ops)
+ return -EBUSY;
+
+ label_ops = ops;
+ return 0;
+}
+
+int label_ops_pre(int dir_fd, const char *path, mode_t mode) {
+ if (!label_ops || !label_ops->pre)
+ return 0;
+
+ return label_ops->pre(dir_fd, path, mode);
+}
+
+int label_ops_post(int dir_fd, const char *path) {
+ if (!label_ops || !label_ops->post)
+ return 0;
+
+ return label_ops->post(dir_fd, path);
+}