summaryrefslogtreecommitdiff
path: root/src/shared/btrfs-util.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/shared/btrfs-util.c')
-rw-r--r--src/shared/btrfs-util.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/shared/btrfs-util.c b/src/shared/btrfs-util.c
index 84c81106fa..9b47330a6f 100644
--- a/src/shared/btrfs-util.c
+++ b/src/shared/btrfs-util.c
@@ -33,6 +33,8 @@
#include "macro.h"
#include "strv.h"
#include "copy.h"
+#include "selinux-util.h"
+#include "smack-util.h"
#include "btrfs-ctree.h"
#include "btrfs-util.h"
@@ -184,6 +186,24 @@ int btrfs_subvol_make(const char *path) {
return 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);
+}
+
int btrfs_subvol_remove(const char *path) {
struct btrfs_ioctl_vol_args args = {};
_cleanup_close_ int fd = -1;