From c4c73eae4cfd698be614b79cf0662290154df8cb Mon Sep 17 00:00:00 2001 From: Lars Kruse Date: Fri, 9 Mar 2018 03:55:41 +0100 Subject: [PATCH] zfs_usage_: explain the slash/underscore substitutions see 608a2a5ad7068f9bc2e392dac87ea3c9eb0ce090 --- plugins/zfs/zfs_usage_ | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/plugins/zfs/zfs_usage_ b/plugins/zfs/zfs_usage_ index fdd5b3a9..e44caf12 100755 --- a/plugins/zfs/zfs_usage_ +++ b/plugins/zfs/zfs_usage_ @@ -160,6 +160,9 @@ sub do_collect { foreach my $line (split(/\n/, `$fsget` )) { my ($name, $key, $value, undef ) = (split(/\t/,$line)); + # try to preserve underscores: + # * duplicate existing ones + # * afterwards replace slashs with single ones ($name =~ s/_/__/g); ($name =~ s/\//_/g); $filesystems->{$name}->{$key}=$value; @@ -170,6 +173,9 @@ sub do_collect { sub do_config_fs { my ($fs) = @_; my $fs_slash = ($fs); + # try to restore underscores (see "do_collect" for the reverse operation): + # * substitute all underscores with slashs + # * afterwards transform *double* slashs back into a single underscore ($fs_slash =~ s/_/\//g); ($fs_slash =~ s/\/\//_/g);