| OLD | NEW |
| 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 * Exports the kernel commandline from a given partition/image. | 5 * Exports the kernel commandline from a given partition/image. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 #include <inttypes.h> /* For uint64_t */ | 8 #include <inttypes.h> /* For uint64_t */ |
| 9 #include <stdio.h> | 9 #include <stdio.h> |
| 10 #include <stdlib.h> | 10 #include <stdlib.h> |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 return (uint8_t *)(blob + offset); | 68 return (uint8_t *)(blob + offset); |
| 69 } | 69 } |
| 70 | 70 |
| 71 static void* MapFile(const char *filename, size_t *size) { | 71 static void* MapFile(const char *filename, size_t *size) { |
| 72 FILE* f; | 72 FILE* f; |
| 73 uint8_t* buf; | 73 uint8_t* buf; |
| 74 long file_size = 0; | 74 long file_size = 0; |
| 75 | 75 |
| 76 f = fopen(filename, "rb"); | 76 f = fopen(filename, "rb"); |
| 77 if (!f) { | 77 if (!f) { |
| 78 debug("Unable to open file %s\n", filename); | 78 VBDEBUG(("Unable to open file %s\n", filename)); |
| 79 return NULL; | 79 return NULL; |
| 80 } | 80 } |
| 81 | 81 |
| 82 fseek(f, 0, SEEK_END); | 82 fseek(f, 0, SEEK_END); |
| 83 file_size = ftell(f); | 83 file_size = ftell(f); |
| 84 rewind(f); | 84 rewind(f); |
| 85 | 85 |
| 86 if (file_size <= 0) { | 86 if (file_size <= 0) { |
| 87 fclose(f); | 87 fclose(f); |
| 88 return NULL; | 88 return NULL; |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 if (!config) { | 126 if (!config) { |
| 127 error("Error parsing input file\n"); | 127 error("Error parsing input file\n"); |
| 128 munmap(blob, blob_size); | 128 munmap(blob, blob_size); |
| 129 return 1; | 129 return 1; |
| 130 } | 130 } |
| 131 | 131 |
| 132 printf("%.*s", CROS_CONFIG_SIZE, config); | 132 printf("%.*s", CROS_CONFIG_SIZE, config); |
| 133 munmap(blob, blob_size); | 133 munmap(blob, blob_size); |
| 134 return 0; | 134 return 0; |
| 135 } | 135 } |
| OLD | NEW |