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

Side by Side Diff: cgpt/cmd_add.c

Issue 2799019: Modify the size of the attributes field to comply with msc limitations. (Closed) Base URL: ssh://git@chromiumos-git/vboot_reference.git
Patch Set: Fix the attribute field to allow compilation in the BIOS environment. Created 10 years, 6 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
« no previous file with comments | « cgpt/cgpt_common.c ('k') | cgpt/cmd_show.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 #include "cgpt.h" 5 #include "cgpt.h"
6 6
7 #include <getopt.h> 7 #include <getopt.h>
8 #include <stdio.h> 8 #include <stdio.h>
9 #include <stdlib.h> 9 #include <stdlib.h>
10 #include <string.h> 10 #include <string.h>
(...skipping 27 matching lines...) Expand all
38 struct drive drive; 38 struct drive drive;
39 int partition = 0; 39 int partition = 0;
40 uint64_t begin = 0; 40 uint64_t begin = 0;
41 uint64_t size = 0; 41 uint64_t size = 0;
42 Guid type_guid; 42 Guid type_guid;
43 Guid unique_guid; 43 Guid unique_guid;
44 char *label = 0; 44 char *label = 0;
45 int successful = 0; 45 int successful = 0;
46 int tries = 0; 46 int tries = 0;
47 int priority = 0; 47 int priority = 0;
48 uint64_t raw_value = 0; 48 uint16_t raw_value = 0;
49 int set_begin = 0; 49 int set_begin = 0;
50 int set_size = 0; 50 int set_size = 0;
51 int set_type = 0; 51 int set_type = 0;
52 int set_unique = 0; 52 int set_unique = 0;
53 int set_successful = 0; 53 int set_successful = 0;
54 int set_tries = 0; 54 int set_tries = 0;
55 int set_priority = 0; 55 int set_priority = 0;
56 int set_raw = 0; 56 int set_raw = 0;
57 57
58 int gpt_retval; 58 int gpt_retval;
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
242 if (set_type) 242 if (set_type)
243 memcpy(&entry->type, &type_guid, sizeof(Guid)); 243 memcpy(&entry->type, &type_guid, sizeof(Guid));
244 if (set_unique) 244 if (set_unique)
245 memcpy(&entry->unique, &unique_guid, sizeof(Guid)); 245 memcpy(&entry->unique, &unique_guid, sizeof(Guid));
246 if (label) { 246 if (label) {
247 uint16_t buf[128]; 247 uint16_t buf[128];
248 UTF8ToUTF16((uint8_t *)label, buf); 248 UTF8ToUTF16((uint8_t *)label, buf);
249 memcpy(entry->name, buf, sizeof(entry->name)); 249 memcpy(entry->name, buf, sizeof(entry->name));
250 } 250 }
251 if (set_raw) { 251 if (set_raw) {
252 entry->attributes = raw_value; 252 entry->attrs.fields.gpt_att = raw_value;
253 } else { 253 } else {
254 if (set_successful) 254 if (set_successful)
255 SetSuccessful(&drive.gpt, PRIMARY, index, successful); 255 SetSuccessful(&drive.gpt, PRIMARY, index, successful);
256 if (set_tries) 256 if (set_tries)
257 SetTries(&drive.gpt, PRIMARY, index, tries); 257 SetTries(&drive.gpt, PRIMARY, index, tries);
258 if (set_priority) 258 if (set_priority)
259 SetPriority(&drive.gpt, PRIMARY, index, priority); 259 SetPriority(&drive.gpt, PRIMARY, index, priority);
260 } 260 }
261 261
262 RepairEntries(&drive.gpt, MASK_PRIMARY); 262 RepairEntries(&drive.gpt, MASK_PRIMARY);
263 RepairHeader(&drive.gpt, MASK_PRIMARY); 263 RepairHeader(&drive.gpt, MASK_PRIMARY);
264 264
265 drive.gpt.modified |= (GPT_MODIFIED_HEADER1 | GPT_MODIFIED_ENTRIES1 | 265 drive.gpt.modified |= (GPT_MODIFIED_HEADER1 | GPT_MODIFIED_ENTRIES1 |
266 GPT_MODIFIED_HEADER2 | GPT_MODIFIED_ENTRIES2); 266 GPT_MODIFIED_HEADER2 | GPT_MODIFIED_ENTRIES2);
267 UpdateCrc(&drive.gpt); 267 UpdateCrc(&drive.gpt);
268 268
269 269
270 // Write it all out 270 // Write it all out
271 return DriveClose(&drive, 1); 271 return DriveClose(&drive, 1);
272 272
273 bad: 273 bad:
274 (void) DriveClose(&drive, 0); 274 (void) DriveClose(&drive, 0);
275 return CGPT_FAILED; 275 return CGPT_FAILED;
276 } 276 }
OLDNEW
« no previous file with comments | « cgpt/cgpt_common.c ('k') | cgpt/cmd_show.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698