Commit eb27ad00 authored by Mikhail Karpenko's avatar Mikhail Karpenko

Filter mountpoints in camogmgui

parent 47834f84
...@@ -349,6 +349,8 @@ else ...@@ -349,6 +349,8 @@ else
case "listdevices": case "listdevices":
exec ("cat /proc/partitions", $arr1); exec ("cat /proc/partitions", $arr1);
exec ("cat /proc/mounts", $arr2); exec ("cat /proc/mounts", $arr2);
$ret = get_mnt_dev();
$mnt_dev = $ret["devices"];
$j = 0; $j = 0;
// first two lines are header and empty line separator, skip them // first two lines are header and empty line separator, skip them
$i = 2; $i = 2;
...@@ -372,6 +374,12 @@ else ...@@ -372,6 +374,12 @@ else
} }
$j = 0; $j = 0;
foreach ($partitions as $partition) { foreach ($partitions as $partition) {
$include = false;
foreach ($mnt_dev as $dev) {
if (strpos($dev, $partition))
$include = true;
}
if ($include) {
echo "<item>"; echo "<item>";
echo "<partition>/dev/".$partition."</partition>"; echo "<partition>/dev/".$partition."</partition>";
echo "<size>".round($size[$j]/1024/1024, 2) ." GB</size>"; echo "<size>".round($size[$j]/1024/1024, 2) ." GB</size>";
...@@ -400,6 +408,7 @@ else ...@@ -400,6 +408,7 @@ else
} }
echo "</item>"; echo "</item>";
} }
}
break; break;
case "list_raw_devices": case "list_raw_devices":
$devices = get_raw_dev(); $devices = get_raw_dev();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment