From d7b8eec7dc7fe307d3a08b32cf1a9ad4276ce6d5 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Sat, 27 Dec 2014 18:46:36 +0100 Subject: tmpfiles: add new line type 'v' for creating btrfs subvolumes --- src/shared/btrfs-util.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'src/shared/btrfs-util.c') 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; -- cgit v1.2.3-54-g00ecf