Skip to content

Commit

Permalink
Write more inline docs to follow easy the logic
Browse files Browse the repository at this point in the history
  • Loading branch information
Ángel Guzmán Maeso committed Feb 21, 2012
1 parent 89c1b33 commit a14b80f
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions hypervm/httpdocs/lib/vps/driver/vps__xenlib.php
Original file line number Diff line number Diff line change
Expand Up @@ -338,12 +338,15 @@ public static function getDiskUsage($disk, $root)
$global_dontlogshell = false;

$res = explode(PHP_EOL, $res);

// Get the Block size line (on bytes) from dumpe2fs output
foreach($res as $r) {
if (csb($r, 'Block size:')) {
$blocksize = trim(strfrom($r, 'Block size:')) /1024;
$blocksize = trim(strfrom($r, 'Block size:')) / 1024; // Convert total bytes to KBytes
}
}

// Get the Block count line from dumpe2fs output
foreach($res as $r) {
if (csb($r, 'Block count:')) {
$total = trim(strfrom($r, 'Block count:')) * $blocksize;
Expand All @@ -354,7 +357,7 @@ public static function getDiskUsage($disk, $root)
}

$ret['total'] = round($total / 1024, 2);
$ret['used'] = round(($total - $free)/1024, 2);
$ret['used'] = round(($total - $free) / 1024, 2);

return $ret;
}
Expand Down

0 comments on commit a14b80f

Please sign in to comment.