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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « host/include/crossystem_arch.h ('k') | host/lib/crossystem.c » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* Copyright (c) 2010 The Chromium OS Authors. All rights reserved. 1 /* Copyright (c) 2010 The Chromium OS Authors. All rights reserved.
2 * Use of this source code is governed by a BSD-style license that can be 2 * Use of this source code is governed by a BSD-style license that can be
3 * found in the LICENSE file. 3 * found in the LICENSE file.
4 * 4 *
5 * Host-side misc functions for verified boot. 5 * Host-side misc functions for verified boot.
6 */ 6 */
7 7
8 #ifndef VBOOT_REFERENCE_HOST_MISC_H_ 8 #ifndef VBOOT_REFERENCE_HOST_MISC_H_
9 #define VBOOT_REFERENCE_HOST_MISC_H_ 9 #define VBOOT_REFERENCE_HOST_MISC_H_
10 10
11 #include "utility.h" 11 #include "utility.h"
12 #include "vboot_struct.h" 12 #include "vboot_struct.h"
13 13
14 /* Copy up to dest_size-1 characters from src to dest, ensuring null
15 termination (which strncpy() doesn't do). Returns the destination
16 string. */
17 char* StrCopy(char* dest, const char* src, int dest_size);
14 18
15 /* Read data from [filename]. Store the size of returned data in [size]. 19 /* Read data from [filename]. Store the size of returned data in [size].
16 * 20 *
17 * Returns the data buffer, which the caller must Free(), or NULL if 21 * Returns the data buffer, which the caller must Free(), or NULL if
18 * error. */ 22 * error. */
19 uint8_t* ReadFile(const char* filename, uint64_t* size); 23 uint8_t* ReadFile(const char* filename, uint64_t* size);
20 24
25 /* Read a string from a file. Passed the destination, dest size, and
26 * filename to read.
27 *
28 * Returns the destination, or NULL if error. */
29 char* ReadFileString(char* dest, int size, const char* filename);
30
31 /* Read an integer from a file.
32 *
33 * Returns the parsed integer, or -1 if error. */
34 int ReadFileInt(const char* filename);
35
36 /* Check if a bit is set in a file which contains an integer.
37 *
38 * Returns 1 if the bit is set, 0 if clear, or -1 if error. */
39 int ReadFileBit(const char* filename, int bitmask);
21 40
22 /* Writes [size] bytes of [data] to [filename]. 41 /* Writes [size] bytes of [data] to [filename].
23 * 42 *
24 * Returns 0 if success, 1 if error. */ 43 * Returns 0 if success, 1 if error. */
25 int WriteFile(const char* filename, const void *data, uint64_t size); 44 int WriteFile(const char* filename, const void *data, uint64_t size);
26 45
27 /* Prints the sha1sum of the given VbPublicKey to stdout. */ 46 /* Prints the sha1sum of the given VbPublicKey to stdout. */
28 void PrintPubKeySha1Sum(VbPublicKey* key); 47 void PrintPubKeySha1Sum(VbPublicKey* key);
29 48
30 #endif /* VBOOT_REFERENCE_HOST_MISC_H_ */ 49 #endif /* VBOOT_REFERENCE_HOST_MISC_H_ */
OLDNEW
« 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