Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(336)

Unified Diff: host/include/host_misc.h

Issue 6780008: Refactor crossystem to move x86-specific implementation to its own file. (Closed) Base URL: ssh://gitrw.chromium.org:9222/vboot_reference.git@master
Patch Set: post-pull Created 9 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « host/include/crossystem_arch.h ('k') | host/lib/crossystem.c » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: host/include/host_misc.h
diff --git a/host/include/host_misc.h b/host/include/host_misc.h
index cbf9eaffab98cee6e6b85ba4dd48edd7497d5247..22b314150e3fa372bc348d2b899a29d0d58e5a2b 100644
--- a/host/include/host_misc.h
+++ b/host/include/host_misc.h
@@ -11,6 +11,10 @@
#include "utility.h"
#include "vboot_struct.h"
+/* Copy up to dest_size-1 characters from src to dest, ensuring null
+ termination (which strncpy() doesn't do). Returns the destination
+ string. */
+char* StrCopy(char* dest, const char* src, int dest_size);
/* Read data from [filename]. Store the size of returned data in [size].
*
@@ -18,6 +22,21 @@
* error. */
uint8_t* ReadFile(const char* filename, uint64_t* size);
+/* Read a string from a file. Passed the destination, dest size, and
+ * filename to read.
+ *
+ * Returns the destination, or NULL if error. */
+char* ReadFileString(char* dest, int size, const char* filename);
+
+/* Read an integer from a file.
+ *
+ * Returns the parsed integer, or -1 if error. */
+int ReadFileInt(const char* filename);
+
+/* Check if a bit is set in a file which contains an integer.
+ *
+ * Returns 1 if the bit is set, 0 if clear, or -1 if error. */
+int ReadFileBit(const char* filename, int bitmask);
/* Writes [size] bytes of [data] to [filename].
*
« no previous file with comments | « host/include/crossystem_arch.h ('k') | host/lib/crossystem.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698