diff options
author | Maarten Vanraes <alien@mageia.org> | 2016-08-06 13:59:38 +0200 |
---|---|---|
committer | Maarten Vanraes <alien@mageia.org> | 2016-08-06 13:59:38 +0200 |
commit | 4ee9e61cc2c698897af40d56df5344b8797f31c3 (patch) | |
tree | 356778d604c4503cee0329b729557e9ec9eb3301 /lib/ManaTools/Shared/disk_backend/Plugin/Btrfs.pm | |
parent | 47c08e9dbae7dba4fc23da097a82dee2b3503348 (diff) | |
download | manatools-4ee9e61cc2c698897af40d56df5344b8797f31c3.tar manatools-4ee9e61cc2c698897af40d56df5344b8797f31c3.tar.gz manatools-4ee9e61cc2c698897af40d56df5344b8797f31c3.tar.bz2 manatools-4ee9e61cc2c698897af40d56df5344b8797f31c3.tar.xz manatools-4ee9e61cc2c698897af40d56df5344b8797f31c3.zip |
Mountable: allow to find the mount path
Diffstat (limited to 'lib/ManaTools/Shared/disk_backend/Plugin/Btrfs.pm')
-rw-r--r-- | lib/ManaTools/Shared/disk_backend/Plugin/Btrfs.pm | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/lib/ManaTools/Shared/disk_backend/Plugin/Btrfs.pm b/lib/ManaTools/Shared/disk_backend/Plugin/Btrfs.pm index 4c7cb707..508a298d 100644 --- a/lib/ManaTools/Shared/disk_backend/Plugin/Btrfs.pm +++ b/lib/ManaTools/Shared/disk_backend/Plugin/Btrfs.pm @@ -288,5 +288,24 @@ class_has '+restrictions' => ( } ); +around('find_path', sub { + my $orig = shift; + my $self = shift; + my $partstate = shift; + + # first try the standard method + my $path = $self->$orig($partstate); + return $path if (defined $path); + + # subvolumes can check parent subvolumes and add the relative path + my @parents = $self->find_parts($partstate, 'parent'); + for my $parent (@parents) { + if ($parent->isa('ManaTools::Shared::disk_backend::Part::BtrfsVol')) { + $path = $parent->find_path($partstate); + return $path . substr($self->prop('label'), length($parent->prop('label'))) if defined($path); + } + } + return undef; +}); 1; |