diff options
author | Marc Espie <espie@cvs.openbsd.org> | 2010-01-02 14:53:05 +0000 |
---|---|---|
committer | Marc Espie <espie@cvs.openbsd.org> | 2010-01-02 14:53:05 +0000 |
commit | 57ba16f7736ffaade1dfd055e91481bcb2ddcaef (patch) | |
tree | 0e3faa12a477d1a060763f379dbfab4285c5dffd /usr.sbin/pkg_add/OpenBSD | |
parent | be43c32274f786fb681ceba49cc40911e56419ac (diff) |
stacked vfs entries. I should be able to recover from overflows and
collisions now.
Diffstat (limited to 'usr.sbin/pkg_add/OpenBSD')
-rw-r--r-- | usr.sbin/pkg_add/OpenBSD/Vstat.pm | 32 |
1 files changed, 28 insertions, 4 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/Vstat.pm b/usr.sbin/pkg_add/OpenBSD/Vstat.pm index 963fe36d2b7..67ffa077112 100644 --- a/usr.sbin/pkg_add/OpenBSD/Vstat.pm +++ b/usr.sbin/pkg_add/OpenBSD/Vstat.pm @@ -1,5 +1,5 @@ # ex:ts=8 sw=4: -# $OpenBSD: Vstat.pm,v 1.50 2010/01/02 14:45:40 espie Exp $ +# $OpenBSD: Vstat.pm,v 1.51 2010/01/02 14:53:04 espie Exp $ # # Copyright (c) 2003-2007 Marc Espie <espie@openbsd.org> # @@ -79,14 +79,38 @@ sub exists sub synchronize { - my ($self) = @_; + my $self = shift; + for my $v (values %{$self->{p}}) { $v->{used} += $v->{delayed}; $v->{delayed} = 0; $v->{real}->{used} = $v->{used}; } - return if $self->{state}->{not}; - $self->{v} = [{}]; + if ($self->{state}->{not}) { + # this is the actual stacking case: in pretend mode, + # I have to put a second vfs on top + if (@{$self->{v}} == 2) { + my $top = shift @{$self->{v}}; + while (my ($k, $v) = each %$top) { + $self->{v}[0]{$k} = $v; + } + } + unshift(@{$self->{v}}, {}); + } else { + $self->{v} = [{}]; + } +} + +sub drop_changes +{ + my $self = shift; + + for my $v (values %{$self->{p}}) { + $v->{used} = $v->{real}->{used}; + $v->{delayed} = 0; + } + # drop the top layer + $self->{v}[0] = {}; } sub add |