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 * Utility for ChromeOS-specific GPT partitions, Please see corresponding .c | 5 * Utility for ChromeOS-specific GPT partitions, Please see corresponding .c |
6 * files for more details. | 6 * files for more details. |
7 */ | 7 */ |
8 #include "cgpt.h" | 8 #include "cgpt.h" |
9 #include <errno.h> | 9 #include <errno.h> |
10 #include <fcntl.h> | 10 #include <fcntl.h> |
(...skipping 13 matching lines...) Expand all Loading... |
24 const char* progname; | 24 const char* progname; |
25 | 25 |
26 /* Lists all command here. */ | 26 /* Lists all command here. */ |
27 struct { | 27 struct { |
28 const char *name; | 28 const char *name; |
29 int (*fp)(int argc, char *argv[]); | 29 int (*fp)(int argc, char *argv[]); |
30 const char *comment; | 30 const char *comment; |
31 } cmds[] = { | 31 } cmds[] = { |
32 {"attribute", CgptAttribute, "Update GPT attribute bits " | 32 {"attribute", CgptAttribute, "Update GPT attribute bits " |
33 "(for ChromeOS kernel entry only)"}, | 33 "(for ChromeOS kernel entry only)"}, |
| 34 {"repair", CgptRepair, "Repair primary and secondary headers and tables"}, |
34 {"show", CgptShow, "Show partition details"}, | 35 {"show", CgptShow, "Show partition details"}, |
35 }; | 36 }; |
36 | 37 |
37 /* Shows main menu. If 'message' is non-NULL, shows it as header. Then, this | 38 /* Shows main menu. If 'message' is non-NULL, shows it as header. Then, this |
38 * traverses cmds[] and shows supported commands and their comments. */ | 39 * traverses cmds[] and shows supported commands and their comments. */ |
39 void Usage(const char *message) { | 40 void Usage(const char *message) { |
40 int i; | 41 int i; |
41 | 42 |
42 if (message) printf("%s\n", message); | 43 if (message) printf("%s\n", message); |
43 printf("Usage: %s COMMAND [OPTIONS]\n\n" | 44 printf("Usage: %s COMMAND [OPTIONS]\n\n" |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
237 progname = argv[0]; | 238 progname = argv[0]; |
238 cmd = argv[optind++]; | 239 cmd = argv[optind++]; |
239 for (i = 0; i < sizeof(cmds)/sizeof(cmds[0]); ++i) { | 240 for (i = 0; i < sizeof(cmds)/sizeof(cmds[0]); ++i) { |
240 if (cmd && !strcmp(cmds[i].name, cmd)) | 241 if (cmd && !strcmp(cmds[i].name, cmd)) |
241 return cmds[i].fp(argc, argv); | 242 return cmds[i].fp(argc, argv); |
242 } | 243 } |
243 | 244 |
244 Usage(0); | 245 Usage(0); |
245 return CGPT_FAILED; | 246 return CGPT_FAILED; |
246 } | 247 } |
OLD | NEW |