]> xenbits.xensource.com Git - osstest.git/commitdiff
cr-ensure-disk-space: Make main loop body into a subroutine
authorIan Jackson <ian.jackson@eu.citrix.com>
Fri, 3 Jul 2015 16:50:46 +0000 (17:50 +0100)
committerIan Jackson <Ian.Jackson@eu.citrix.com>
Fri, 18 Sep 2015 11:37:30 +0000 (12:37 +0100)
No functional change.

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
cr-ensure-disk-space

index 0314e7a0d4f093288cb99dde5a95e760362d5166..8c5a708f334f894a1b48571c12f33725105a0069 100755 (executable)
@@ -67,7 +67,7 @@ END
 our @flights;
 our %latestref;
 
-for (;;) {
+sub iteration_continue () {
     open P, "-|", onloghost "df --block-size=1M -P $logdir" or die $!;
     $_= <P>;
     m/^filesystem/i or die "$_ ?";
@@ -76,7 +76,7 @@ for (;;) {
     $!=0; $?=0; close P or die "$! $?";
     my $space= $1;
     printf "space: %8d, wanted: %8d ", $space, logcfg('MinSpaceMby');
-    last if $space >= logcfg('MinSpaceMby');
+    return 0 if $space >= logcfg('MinSpaceMby');
 
     if (!@flights) {
        %latestref = ();
@@ -141,6 +141,13 @@ for (;;) {
 END
 
     printf "done.\n";
+
+    return 1;
+}
+
+for (;;) {
+    iteration_continue()
+       or last;
 }
 
 printf "ok.\n";