From 8eb2aad55f9bff2b50b5655baa43ac985d1b5011 Mon Sep 17 00:00:00 2001 From: Stefan Schantl Date: Sun, 5 May 2024 16:50:24 +0200 Subject: [PATCH] filesystem-functions.pl: Add btrfs_subvolume_list() function Function which calls the btrfs binary and returns an array of it's output. Signed-off-by: Stefan Schantl --- config/cfgroot/filesystem-functions.pl | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/config/cfgroot/filesystem-functions.pl b/config/cfgroot/filesystem-functions.pl index 58bacfea2..02c2e146f 100644 --- a/config/cfgroot/filesystem-functions.pl +++ b/config/cfgroot/filesystem-functions.pl @@ -564,4 +564,21 @@ sub btrfs_filesystem_usage($$) { return @output; } +# +## Function which simply calls subvolume list of the btrfs tool and returns it's output +## as array. +# +sub btrfs_subvolume_list ($) { + my ($volume, $type) = @_; + + # Defaults to "/" if no volume detail has been given. + $volume //= "/"; + + # Call the btrfs binary to get the known subvolumes of the given volume. + my @output = &General::system_output("$btrfs_bin", "subvolume", "list", "$volume"); + + # Return the grabbed output. + return @output; +} + 1; -- 2.39.5