| 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 | 5 |
| 6 #include "cgptlib.h" | 6 #include "cgptlib.h" |
| 7 #include "cgptlib_internal.h" | 7 #include "cgptlib_internal.h" |
| 8 #include "crc32.h" | 8 #include "crc32.h" |
| 9 #include "gpt.h" | 9 #include "gpt.h" |
| 10 #include "utility.h" | 10 #include "utility.h" |
| (...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 302 else if (MASK_SECONDARY == gpt->valid_entries) { | 302 else if (MASK_SECONDARY == gpt->valid_entries) { |
| 303 /* Secondary is good, primary is bad */ | 303 /* Secondary is good, primary is bad */ |
| 304 Memcpy(entries1, entries2, entries_size); | 304 Memcpy(entries1, entries2, entries_size); |
| 305 gpt->modified |= GPT_MODIFIED_ENTRIES1; | 305 gpt->modified |= GPT_MODIFIED_ENTRIES1; |
| 306 } | 306 } |
| 307 gpt->valid_entries = MASK_BOTH; | 307 gpt->valid_entries = MASK_BOTH; |
| 308 } | 308 } |
| 309 | 309 |
| 310 | 310 |
| 311 int GetEntrySuccessful(const GptEntry* e) { | 311 int GetEntrySuccessful(const GptEntry* e) { |
| 312 return (e->attributes & CGPT_ATTRIBUTE_SUCCESSFUL_MASK) >> | 312 return (e->attrs.fields.gpt_att & CGPT_ATTRIBUTE_SUCCESSFUL_MASK) >> |
| 313 CGPT_ATTRIBUTE_SUCCESSFUL_OFFSET; | 313 CGPT_ATTRIBUTE_SUCCESSFUL_OFFSET; |
| 314 } | 314 } |
| 315 | 315 |
| 316 | 316 |
| 317 int GetEntryPriority(const GptEntry* e) { | 317 int GetEntryPriority(const GptEntry* e) { |
| 318 return (e->attributes & CGPT_ATTRIBUTE_PRIORITY_MASK) >> | 318 return (e->attrs.fields.gpt_att & CGPT_ATTRIBUTE_PRIORITY_MASK) >> |
| 319 CGPT_ATTRIBUTE_PRIORITY_OFFSET; | 319 CGPT_ATTRIBUTE_PRIORITY_OFFSET; |
| 320 } | 320 } |
| 321 | 321 |
| 322 | 322 |
| 323 int GetEntryTries(const GptEntry* e) { | 323 int GetEntryTries(const GptEntry* e) { |
| 324 return (e->attributes & CGPT_ATTRIBUTE_TRIES_MASK) >> | 324 return (e->attrs.fields.gpt_att & CGPT_ATTRIBUTE_TRIES_MASK) >> |
| 325 CGPT_ATTRIBUTE_TRIES_OFFSET; | 325 CGPT_ATTRIBUTE_TRIES_OFFSET; |
| 326 } | 326 } |
| 327 | 327 |
| 328 | 328 |
| 329 void SetEntrySuccessful(GptEntry* e, int successful) { | 329 void SetEntrySuccessful(GptEntry* e, int successful) { |
| 330 if (successful) | 330 if (successful) |
| 331 e->attributes |= CGPT_ATTRIBUTE_SUCCESSFUL_MASK; | 331 e->attrs.fields.gpt_att |= CGPT_ATTRIBUTE_SUCCESSFUL_MASK; |
| 332 else | 332 else |
| 333 e->attributes &= ~CGPT_ATTRIBUTE_SUCCESSFUL_MASK; | 333 e->attrs.fields.gpt_att &= ~CGPT_ATTRIBUTE_SUCCESSFUL_MASK; |
| 334 } | 334 } |
| 335 | 335 |
| 336 | 336 |
| 337 void SetEntryPriority(GptEntry* e, int priority) { | 337 void SetEntryPriority(GptEntry* e, int priority) { |
| 338 e->attributes &= ~CGPT_ATTRIBUTE_PRIORITY_MASK; | 338 e->attrs.fields.gpt_att &= ~CGPT_ATTRIBUTE_PRIORITY_MASK; |
| 339 e->attributes |= ((uint64_t)priority << CGPT_ATTRIBUTE_PRIORITY_OFFSET) & | 339 e->attrs.fields.gpt_att |= (priority << CGPT_ATTRIBUTE_PRIORITY_OFFSET) & |
| 340 CGPT_ATTRIBUTE_PRIORITY_MASK; | 340 CGPT_ATTRIBUTE_PRIORITY_MASK; |
| 341 } | 341 } |
| 342 | 342 |
| 343 | 343 |
| 344 void SetEntryTries(GptEntry* e, int tries) { | 344 void SetEntryTries(GptEntry* e, int tries) { |
| 345 e->attributes &= ~CGPT_ATTRIBUTE_TRIES_MASK; | 345 e->attrs.fields.gpt_att &= ~CGPT_ATTRIBUTE_TRIES_MASK; |
| 346 e->attributes |= ((uint64_t)tries << CGPT_ATTRIBUTE_TRIES_OFFSET) & | 346 e->attrs.fields.gpt_att |= (tries << CGPT_ATTRIBUTE_TRIES_OFFSET) & |
| 347 CGPT_ATTRIBUTE_TRIES_MASK; | 347 CGPT_ATTRIBUTE_TRIES_MASK; |
| 348 } | 348 } |
| OLD | NEW |