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

Side by Side Diff: cgpt/cgpt.h

Issue 5352005: Add 'prioritize' command to cgpt tool. (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/vboot_reference.git@master
Patch Set: Created 10 years 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 | « cgpt/Makefile ('k') | cgpt/cgpt.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 #ifndef VBOOT_REFERENCE_UTILITY_CGPT_CGPT_H_ 5 #ifndef VBOOT_REFERENCE_UTILITY_CGPT_CGPT_H_
6 #define VBOOT_REFERENCE_UTILITY_CGPT_CGPT_H_ 6 #define VBOOT_REFERENCE_UTILITY_CGPT_CGPT_H_
7 7
8 #define _GNU_SOURCE 8 #define _GNU_SOURCE
9 #define _FILE_OFFSET_BITS 64 9 #define _FILE_OFFSET_BITS 64
10 #include <features.h> 10 #include <features.h>
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 /* GUID conversion functions. Accepted format: 65 /* GUID conversion functions. Accepted format:
66 * 66 *
67 * "C12A7328-F81F-11D2-BA4B-00A0C93EC93B" 67 * "C12A7328-F81F-11D2-BA4B-00A0C93EC93B"
68 * 68 *
69 * At least GUID_STRLEN bytes should be reserved in 'str' (included the tailing 69 * At least GUID_STRLEN bytes should be reserved in 'str' (included the tailing
70 * '\0'). 70 * '\0').
71 */ 71 */
72 #define GUID_STRLEN 37 72 #define GUID_STRLEN 37
73 int StrToGuid(const char *str, Guid *guid); 73 int StrToGuid(const char *str, Guid *guid);
74 void GuidToStr(const Guid *guid, char *str, unsigned int buflen); 74 void GuidToStr(const Guid *guid, char *str, unsigned int buflen);
75 int GuidEqual(const Guid *guid1, const Guid *guid2);
75 int IsZero(const Guid *guid); 76 int IsZero(const Guid *guid);
76 77
78 /* Constant global type values to compare against */
79 extern const Guid guid_chromeos_kernel;
80 extern const Guid guid_chromeos_rootfs;
81 extern const Guid guid_linux_data;
82 extern const Guid guid_chromeos_reserved;
83 extern const Guid guid_efi;
84 extern const Guid guid_unused;
77 85
78 int ReadPMBR(struct drive *drive); 86 int ReadPMBR(struct drive *drive);
79 int WritePMBR(struct drive *drive); 87 int WritePMBR(struct drive *drive);
80 88
81
82 /* Convert possibly unterminated UTF16 string to UTF8. 89 /* Convert possibly unterminated UTF16 string to UTF8.
83 * Caller must prepare enough space for UTF8, which could be up to 90 * Caller must prepare enough space for UTF8, which could be up to
84 * twice the byte length of UTF16 string plus the terminating '\0'. 91 * twice the byte length of UTF16 string plus the terminating '\0'.
85 * 92 *
86 * Return: CGPT_OK --- all character are converted successfully. 93 * Return: CGPT_OK --- all character are converted successfully.
87 * CGPT_FAILED --- convert error, i.e. output buffer is too short. 94 * CGPT_FAILED --- convert error, i.e. output buffer is too short.
88 */ 95 */
89 int UTF16ToUTF8(const uint16_t *utf16, unsigned int maxinput, 96 int UTF16ToUTF8(const uint16_t *utf16, unsigned int maxinput,
90 uint8_t *utf8, unsigned int maxoutput); 97 uint8_t *utf8, unsigned int maxoutput);
91 98
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 void Error(const char *format, ...); 133 void Error(const char *format, ...);
127 134
128 135
129 // Command functions. 136 // Command functions.
130 int cmd_show(int argc, char *argv[]); 137 int cmd_show(int argc, char *argv[]);
131 int cmd_repair(int argc, char *argv[]); 138 int cmd_repair(int argc, char *argv[]);
132 int cmd_create(int argc, char *argv[]); 139 int cmd_create(int argc, char *argv[]);
133 int cmd_add(int argc, char *argv[]); 140 int cmd_add(int argc, char *argv[]);
134 int cmd_boot(int argc, char *argv[]); 141 int cmd_boot(int argc, char *argv[]);
135 int cmd_find(int argc, char *argv[]); 142 int cmd_find(int argc, char *argv[]);
143 int cmd_prioritize(int argc, char *argv[]);
136 144
137 #define ARRAY_COUNT(array) (sizeof(array)/sizeof((array)[0])) 145 #define ARRAY_COUNT(array) (sizeof(array)/sizeof((array)[0]))
138 const char *GptError(int errnum); 146 const char *GptError(int errnum);
139 147
140 // Size in chars of the GPT Entry's PartitionName field 148 // Size in chars of the GPT Entry's PartitionName field
141 #define GPT_PARTNAME_LEN 72 149 #define GPT_PARTNAME_LEN 72
142 150
143 /* The standard "assert" macro goes away when NDEBUG is defined. This doesn't. 151 /* The standard "assert" macro goes away when NDEBUG is defined. This doesn't.
144 */ 152 */
145 #define require(A) do { \ 153 #define require(A) do { \
146 if (!(A)) { \ 154 if (!(A)) { \
147 fprintf(stderr, "condition (%s) failed at %s:%d\n", \ 155 fprintf(stderr, "condition (%s) failed at %s:%d\n", \
148 #A, __FILE__, __LINE__); \ 156 #A, __FILE__, __LINE__); \
149 exit(1); } \ 157 exit(1); } \
150 } while (0) 158 } while (0)
151 159
152 #endif // VBOOT_REFERENCE_UTILITY_CGPT_CGPT_H_ 160 #endif // VBOOT_REFERENCE_UTILITY_CGPT_CGPT_H_
OLDNEW
« no previous file with comments | « cgpt/Makefile ('k') | cgpt/cgpt.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698