btrbk: add vinfo_realpath

pull/542/head
Axel Burri 2023-03-26 13:19:11 +02:00
parent 544d95e094
commit 30b22d49d2
1 changed files with 10 additions and 1 deletions

11
btrbk
View File

@ -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;