summaryrefslogtreecommitdiff
path: root/usr.sbin
diff options
context:
space:
mode:
authorMarc Espie <espie@cvs.openbsd.org>2010-01-02 12:59:46 +0000
committerMarc Espie <espie@cvs.openbsd.org>2010-01-02 12:59:46 +0000
commit4852423daf69b1a38e53f13046306243d008d3b7 (patch)
tree2f94bc2e3a7663e66d63b2924a7a7e73121b0e81 /usr.sbin
parent4893a508cc75d4392470e57f63263db944fc2c8e (diff)
fully encapsulate dev objects from vstat so I can change the internals
completely.
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/pkg_add/OpenBSD/Add.pm12
-rw-r--r--usr.sbin/pkg_add/OpenBSD/Delete.pm8
-rw-r--r--usr.sbin/pkg_add/OpenBSD/Vstat.pm26
3 files changed, 35 insertions, 11 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/Add.pm b/usr.sbin/pkg_add/OpenBSD/Add.pm
index c599aa40c96..da5cc21425e 100644
--- a/usr.sbin/pkg_add/OpenBSD/Add.pm
+++ b/usr.sbin/pkg_add/OpenBSD/Add.pm
@@ -1,5 +1,5 @@
# ex:ts=8 sw=4:
-# $OpenBSD: Add.pm,v 1.101 2009/12/20 22:38:45 espie Exp $
+# $OpenBSD: Add.pm,v 1.102 2010/01/02 12:59:45 espie Exp $
#
# Copyright (c) 2003-2007 Marc Espie <espie@openbsd.org>
#
@@ -371,7 +371,7 @@ sub prepare_for_addition
}
my $s = $state->vstat->add($fname, $self->{size}, \$pkgname);
return unless defined $s;
- if ($s->{ro}) {
+ if ($s->ro) {
$s->report_ro($state, $fname);
}
if ($s->avail < 0) {
@@ -490,7 +490,7 @@ sub prepare_for_addition
my $size = $self->{copyfrom}->{size};
my $s = $state->vstat->add($fname, $size, \$pkgname);
return unless defined $s;
- if ($s->{ro}) {
+ if ($s->ro) {
$s->report_ro($state, $fname);
}
if ($s->avail < 0) {
@@ -668,16 +668,16 @@ sub prepare_for_addition
}
if ($self->exec_on_add) {
my $s2 = $state->vstat->stat($cname);
- if (defined $s2 && $s2->{noexec}) {
+ if (defined $s2 && $s2->noexec) {
$s2->report_noexec($state, $cname);
}
}
my $s = $state->vstat->add($fname, $self->{size}, \$pkgname);
return unless defined $s;
- if ($s->{ro}) {
+ if ($s->ro) {
$s->report_ro($state, $fname);
}
- if ($s->{noexec} && $self->exec_on_delete) {
+ if ($s->noexec && $self->exec_on_delete) {
$s->report_noexec($state, $fname);
}
if ($s->avail < 0) {
diff --git a/usr.sbin/pkg_add/OpenBSD/Delete.pm b/usr.sbin/pkg_add/OpenBSD/Delete.pm
index f66b5176a8d..86320fccb58 100644
--- a/usr.sbin/pkg_add/OpenBSD/Delete.pm
+++ b/usr.sbin/pkg_add/OpenBSD/Delete.pm
@@ -1,5 +1,5 @@
# ex:ts=8 sw=4:
-# $OpenBSD: Delete.pm,v 1.95 2009/12/28 21:28:00 espie Exp $
+# $OpenBSD: Delete.pm,v 1.96 2010/01/02 12:59:45 espie Exp $
#
# Copyright (c) 2003-2007 Marc Espie <espie@openbsd.org>
#
@@ -373,7 +373,7 @@ sub prepare_for_deletion
my $fname = $state->{destdir}.$self->fullname;
my $s = $state->vstat->remove($fname, $self->{size});
return unless defined $s;
- if ($s->{ro}) {
+ if ($s->ro) {
$s->report_ro($state, $fname);
}
}
@@ -464,10 +464,10 @@ sub prepare_for_deletetion
}
my $s = $state->vstat->remove($fname, $self->{size});
return unless defined $s;
- if ($s->{ro}) {
+ if ($s->ro) {
$s->report_ro($state, $fname);
}
- if ($s->{noexec} && $self->exec_on_delete) {
+ if ($s->noexec && $self->exec_on_delete) {
$s->report_noexec($state, $fname);
}
}
diff --git a/usr.sbin/pkg_add/OpenBSD/Vstat.pm b/usr.sbin/pkg_add/OpenBSD/Vstat.pm
index 58334efac3f..109fc56b38f 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.46 2009/12/21 13:24:57 espie Exp $
+# $OpenBSD: Vstat.pm,v 1.47 2010/01/02 12:59:45 espie Exp $
#
# Copyright (c) 2003-2007 Marc Espie <espie@openbsd.org>
#
@@ -203,6 +203,30 @@ sub avail
return $self->{avail} - $self->{used}/$self->{blocksize};
}
+sub ro
+{
+ my $self = shift;
+ return $self->{ro};
+}
+
+sub noexec
+{
+ my $self = shift;
+ return $self->{noexec};
+}
+
+sub nosuid
+{
+ my $self = shift;
+ return $self->{nosuid};
+}
+
+sub nodev
+{
+ my $self = shift;
+ return $self->{nodev};
+}
+
sub report_ro
{
my ($s, $state, $fname) = @_;