From: Stefan Schantl Date: Sun, 5 May 2024 14:50:24 +0000 (+0200) Subject: filesystem-functions.pl: Add btrfs_subvolume_list() function X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=8eb2aad55f9bff2b50b5655baa43ac985d1b5011;p=people%2Fstevee%2Fipfire-2.x.git 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 --- 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;