summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2017-12-19 14:33:11 +0100
committerSven Eden <yamakuzure@gmx.net>2018-05-30 07:49:40 +0200
commit2e26218217c36b88b6a24b528c9607247e06a495 (patch)
treeab07df9dc7be416fb9cd601802e55faf2ec79df8 /src
parent6985e33602941a1da54772a0a522700284131d65 (diff)
Move selinux-related stuff from btrfs-util.c to label.c
In preparation for future changes.
Diffstat (limited to 'src')
-rw-r--r--src/basic/label.c19
-rw-r--r--src/basic/label.h2
2 files changed, 21 insertions, 0 deletions
diff --git a/src/basic/label.c b/src/basic/label.c
index 17857de1b..8a2d87818 100644
--- a/src/basic/label.c
+++ b/src/basic/label.c
@@ -22,6 +22,7 @@
#include <sys/stat.h>
#include <unistd.h>
+//#include "btrfs-util.h"
#include "label.h"
#include "macro.h"
#include "selinux-util.h"
@@ -83,3 +84,21 @@ int symlink_label(const char *old_path, const char *new_path) {
return mac_smack_fix(new_path, false, false);
}
#endif // 0
+
+int btrfs_subvol_make_label(const char *path) {
+ int r;
+
+ assert(path);
+
+ r = mac_selinux_create_file_prepare(path, S_IFDIR);
+ if (r < 0)
+ return r;
+
+ r = btrfs_subvol_make(path);
+ mac_selinux_create_file_clear();
+
+ if (r < 0)
+ return r;
+
+ return mac_smack_fix(path, false, false);
+}
diff --git a/src/basic/label.h b/src/basic/label.h
index fa49c2e20..df25d8baf 100644
--- a/src/basic/label.h
+++ b/src/basic/label.h
@@ -29,3 +29,5 @@ int mkdir_label(const char *path, mode_t mode);
#if 0 /// UNNEEDED by elogind
int symlink_label(const char *old_path, const char *new_path);
#endif // 0
+
+int btrfs_subvol_make_label(const char *path);