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

Side by Side Diff: src/platform/vboot_reference/utility/cgpt/cgpt_add_modify_delete.c

Issue 2614002: Enable attributes to display and set properly. (Closed) Base URL: ssh://git@chromiumos-git/chromeos
Patch Set: 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
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 * Update GPT attribute bits. 5 * Update GPT attribute bits.
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 "cgpt.h" 10 #include "cgpt.h"
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 if (size_lba != NOT_INITED) { 235 if (size_lba != NOT_INITED) {
236 entry->ending_lba = entry->starting_lba + size_lba - 1; 236 entry->ending_lba = entry->starting_lba + size_lba - 1;
237 ++dirty; 237 ++dirty;
238 } 238 }
239 if (name[0]) { 239 if (name[0]) {
240 UTF8ToUTF16((uint8_t*)name, entry->name); 240 UTF8ToUTF16((uint8_t*)name, entry->name);
241 ++dirty; 241 ++dirty;
242 } 242 }
243 243
244 if (command == DELETE) { 244 if (command == DELETE) {
245 Guid unused = GPT_ENT_TYPE_UNUSED; 245 Memcpy(&entry->type, &guid_unused, sizeof(Guid));
246 Memcpy(&entry->type, &unused, sizeof(Guid));
247 } 246 }
248 247
249 if (dirty) { 248 if (dirty) {
250 uint32_t valid_entries; 249 uint32_t valid_entries;
251 250
252 valid_entries = drive.gpt.valid_entries; 251 valid_entries = drive.gpt.valid_entries;
253 if ((valid_entries != CheckValidEntries(&drive.gpt)) || 252 if ((valid_entries != CheckValidEntries(&drive.gpt)) ||
254 (valid_entries != CheckOverlappedPartition(&drive.gpt))) { 253 (valid_entries != CheckOverlappedPartition(&drive.gpt))) {
255 printf("\n[ERROR] Your change makes GPT invalid (or worse). " 254 printf("\n[ERROR] Your change makes GPT invalid (or worse). "
256 "Please check your arguments.\n\n"); 255 "Please check your arguments.\n\n");
(...skipping 11 matching lines...) Expand all
268 GPT_MODIFIED_HEADER2 | GPT_MODIFIED_ENTRIES2); 267 GPT_MODIFIED_HEADER2 | GPT_MODIFIED_ENTRIES2);
269 UpdateCrc(&drive.gpt); 268 UpdateCrc(&drive.gpt);
270 } 269 }
271 DriveClose(&drive); 270 DriveClose(&drive);
272 return CGPT_OK; 271 return CGPT_OK;
273 272
274 error_close: 273 error_close:
275 DriveClose(&drive); 274 DriveClose(&drive);
276 return CGPT_FAILED; 275 return CGPT_FAILED;
277 } 276 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698