summaryrefslogtreecommitdiff
path: root/utils.h
diff options
context:
space:
mode:
authorAlex Deymo <deymo@chromium.org>2014-03-25 17:53:56 -0700
committerchrome-internal-fetch <chrome-internal-fetch@google.com>2014-03-26 05:34:44 +0000
commit032e772f76a6cd0b4caf1af7bd02dd81af2dc7dd (patch)
tree73f75c03ae5c589e8bfe2781c4e4faa8b4701113 /utils.h
parent04f2b380d4707a3903098a7459443c9509745943 (diff)
Log the file format of cros_install on postinstall action
This patch adds a new function to utils which determines the format of a file based on magic constants on the header and returns a human-readable description of it. This currently only supports ELF files and is used to log the file format of the cros_install binary on post-install. BUG=chromium:356187 TEST=Unittests. Change-Id: Ie6e91c3f5fa398c39894704db9071489560a8ff7 Reviewed-on: https://chromium-review.googlesource.com/191609 Tested-by: Alex Deymo <deymo@chromium.org> Reviewed-by: Don Garrett <dgarrett@chromium.org> Commit-Queue: Alex Deymo <deymo@chromium.org>
Diffstat (limited to 'utils.h')
-rw-r--r--utils.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/utils.h b/utils.h
index f4046535..e129cbee 100644
--- a/utils.h
+++ b/utils.h
@@ -193,6 +193,11 @@ bool GetFilesystemSizeFromFD(int fd,
int* out_block_count,
int* out_block_size);
+
+// Returns a human-readable string with the file format based on magic constants
+// on the header of the file.
+std::string GetFileFormat(const std::string& path);
+
// Returns the string representation of the given UTC time.
// such as "11/14/2011 14:05:30 GMT".
std::string ToString(const base::Time utc_time);