chiark / gitweb /
Move selinux-related stuff from btrfs-util.c to label.c
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Tue, 19 Dec 2017 13:33:11 +0000 (14:33 +0100)
committerSven Eden <yamakuzure@gmx.net>
Wed, 30 May 2018 05:49:40 +0000 (07:49 +0200)
In preparation for future changes.

src/basic/label.c
src/basic/label.h

index 17857de1b2e9916a1a01afde987550239e4d5a1a..8a2d87818befb0a3c895371fff7113bed2136d63 100644 (file)
@@ -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);
+}
index fa49c2e201fe7f7e282b75fece2b3d3440793dd8..df25d8bafe42ed7aaae4bc9d65737a8c857012ea 100644 (file)
@@ -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);