summaryrefslogtreecommitdiff
path: root/src/shared/btrfs-util.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2014-12-27 18:46:36 +0100
committerLennart Poettering <lennart@poettering.net>2014-12-28 02:08:40 +0100
commitd7b8eec7dc7fe307d3a08b32cf1a9ad4276ce6d5 (patch)
treebb72bb696e949844b8bed240b061a4bed4f8fb8b /src/shared/btrfs-util.c
parentebd93cb684806ac0f352139e69ac8f53eb49f5e4 (diff)
tmpfiles: add new line type 'v' for creating btrfs subvolumes
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;