AU: Add a utility routine to get the filesystem size from a device.
BUG=7678
TEST=unit tests
Change-Id: I177e95014e09c64844fa7ecc6efb91c0997cb9bd
Review URL: http://codereview.chromium.org/3706006
diff --git a/utils.h b/utils.h
index bfe7378..9beae04 100644
--- a/utils.h
+++ b/utils.h
@@ -115,6 +115,17 @@
unsigned long flags);
bool UnmountFilesystem(const std::string& mountpoint);
+// Returns the block count and the block byte size of the ext3 file system on
+// |device| (which may be a real device or a path to a filesystem image) or on
+// an opened file descriptor |fd|. The actual file-system size is |block_count|
+// * |block_size| bytes. Returns true on success, false otherwise.
+bool GetFilesystemSize(const std::string& device,
+ int* out_block_count,
+ int* out_block_size);
+bool GetFilesystemSizeFromFD(int fd,
+ int* out_block_count,
+ int* out_block_size);
+
enum BootLoader {
BootLoader_SYSLINUX = 0,
BootLoader_CHROME_FIRMWARE = 1