From 30b22d49d2d0049c82ed615c75fc5bffac476160 Mon Sep 17 00:00:00 2001 From: Axel Burri Date: Sun, 26 Mar 2023 13:19:11 +0200 Subject: [PATCH] btrbk: add vinfo_realpath --- btrbk | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/btrbk b/btrbk index 41bb72e..f345eac 100755 --- a/btrbk +++ b/btrbk @@ -355,7 +355,7 @@ my %raw_url_cache; # map URL to (fake) btr_tree node my %mountinfo_cache; # map MACHINE_ID to mount points (sorted descending by file length) my %mount_source_cache; # map URL_PREFIX:mount_source (aka device) to btr_tree node my %uuid_cache; # map UUID to btr_tree node -my %realpath_cache; # map URL to realpath (symlink target). empty string denotes an error. +my %realpath_cache; # map URL to realpath (symlink target). undef denotes an error. my $tree_inject_id = 0; # fake subvolume id for injected nodes (negative) my $fake_uuid_prefix = 'XXXXXXXX-XXXX-XXXX-XXXX-'; # plus 0-padded inject_id: XXXXXXXX-XXXX-XXXX-XXXX-000000000000 @@ -2900,6 +2900,15 @@ sub mountinfo_tree($) } +sub vinfo_realpath($@) +{ + my $vol = shift // die; + my $url = $vol->{URL} // die; + return $realpath_cache{$url} if(exists($realpath_cache{$url})); + return $realpath_cache{$url} = system_realpath($vol); +} + + sub vinfo_mountpoint { my $vol = shift // die;