Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Bug 853502 - Add df output to sutagent device info; r=jmaher DONTBUILD

  • Loading branch information...
commit e473ef89417eacf4ca5d5e8ee93d02ccae2172d2 1 parent 50ad417
@gbrownmozilla gbrownmozilla authored
Showing with 22 additions and 6 deletions.
  1. +22 −6 build/mobile/sutagent/android/DoCommand.java
View
28 build/mobile/sutagent/android/DoCommand.java
@@ -441,6 +441,12 @@ public String processCommand(String theCmdLine, PrintWriter out, BufferedInputSt
strReturn += GetProcessInfo();
strReturn += "\n";
strReturn += GetSutUserInfo();
+ strReturn += "\n";
+ strReturn += GetDiskInfo("/data");
+ strReturn += "\n";
+ strReturn += GetDiskInfo("/system");
+ strReturn += "\n";
+ strReturn += GetDiskInfo("/mnt/sdcard");
}
else
{
@@ -495,6 +501,15 @@ public String processCommand(String theCmdLine, PrintWriter out, BufferedInputSt
strReturn += GetTemperatureInfo();
break;
+ case DISK:
+ strReturn += "\n";
+ strReturn += GetDiskInfo("/data");
+ strReturn += "\n";
+ strReturn += GetDiskInfo("/system");
+ strReturn += "\n";
+ strReturn += GetDiskInfo("/mnt/sdcard");
+ break;
+
default:
break;
}
@@ -2670,18 +2685,19 @@ public String GetTemperatureInfo()
return "Temperature: " + sTempVal;
}
- // todo
public String GetDiskInfo(String sPath)
{
String sRet = "";
StatFs statFS = new StatFs(sPath);
- int nBlockCount = statFS.getBlockCount();
- int nBlockSize = statFS.getBlockSize();
- int nBlocksAvail = statFS.getAvailableBlocks();
- int nBlocksFree = statFS.getFreeBlocks();
+ long nBlockCount = statFS.getBlockCount();
+ long nBlockSize = statFS.getBlockSize();
+ long nBlocksAvail = statFS.getAvailableBlocks();
+ // Free is often the same as Available, but can include reserved
+ // blocks that are not available to normal applications.
+ // long nBlocksFree = statFS.getFreeBlocks();
- sRet = "total: " + (nBlockCount * nBlockSize) + "\nfree: " + (nBlocksFree * nBlockSize) + "\navailable: " + (nBlocksAvail * nBlockSize);
+ sRet = sPath + ": " + (nBlockCount * nBlockSize) + " total, " + (nBlocksAvail * nBlockSize) + " available";
return (sRet);
}
Please sign in to comment.
Something went wrong with that request. Please try again.