1 /* Copyright 2013 The ChromiumOS Authors 2 * Use of this source code is governed by a BSD-style license that can be 3 * found in the LICENSE file. 4 */ 5 6 #ifndef VBOOT_REFERENCE_CGPT_PARAMS_H_ 7 #define VBOOT_REFERENCE_CGPT_PARAMS_H_ 8 9 #include <stdint.h> 10 11 #include "gpt.h" 12 13 #ifdef __cplusplus 14 extern "C" { 15 #endif /* __cplusplus */ 16 17 enum { 18 CGPT_OK = 0, 19 CGPT_FAILED, 20 }; 21 22 typedef struct CgptCreateParams { 23 const char *drive_name; 24 uint64_t drive_size; 25 int zap; 26 uint64_t padding; 27 } CgptCreateParams; 28 29 typedef struct CgptAddParams { 30 const char *drive_name; 31 uint64_t drive_size; 32 uint32_t partition; 33 uint64_t begin; 34 uint64_t size; 35 Guid type_guid; 36 Guid unique_guid; 37 const char *label; 38 int error_counter; 39 int successful; 40 int tries; 41 int priority; 42 int required; 43 int legacy_boot; 44 uint32_t raw_value; 45 int set_begin; 46 int set_size; 47 int set_type; 48 int set_unique; 49 int set_error_counter; 50 int set_successful; 51 int set_tries; 52 int set_priority; 53 int set_required; 54 int set_legacy_boot; 55 int set_raw; 56 } CgptAddParams; 57 58 typedef struct CgptEditParams { 59 const char *drive_name; 60 uint64_t drive_size; 61 Guid unique_guid; 62 int set_unique; 63 } CgptEditParams; 64 65 typedef struct CgptShowParams { 66 const char *drive_name; 67 uint64_t drive_size; 68 int numeric; 69 int verbose; 70 int quick; 71 uint32_t partition; 72 int single_item; 73 int debug; 74 int num_partitions; 75 } CgptShowParams; 76 77 typedef struct CgptRepairParams { 78 const char *drive_name; 79 uint64_t drive_size; 80 int verbose; 81 } CgptRepairParams; 82 83 typedef struct CgptBootParams { 84 const char *drive_name; 85 uint64_t drive_size; 86 uint32_t partition; 87 const char *bootfile; 88 int create_pmbr; 89 } CgptBootParams; 90 91 typedef struct CgptPrioritizeParams { 92 const char *drive_name; 93 uint64_t drive_size; 94 uint32_t set_partition; 95 int set_friends; 96 int max_priority; 97 int orig_priority; 98 } CgptPrioritizeParams; 99 100 struct CgptFindParams; 101 typedef void (*CgptFindShowFn)(struct CgptFindParams *params, 102 const char *filename, int partnum, 103 GptEntry *entry); 104 typedef struct CgptFindParams { 105 const char *drive_name; 106 uint64_t drive_size; 107 int verbose; 108 int set_unique; 109 int set_type; 110 int set_label; 111 int oneonly; 112 int numeric; 113 uint8_t *matchbuf; 114 uint64_t matchlen; 115 uint64_t matchoffset; 116 uint8_t *comparebuf; 117 Guid unique_guid; 118 Guid type_guid; 119 const char *label; 120 int hits; 121 int match_partnum; /* 1-based; 0 means no match */ 122 /* when working with MTD, we actually work on a temp file, but we still 123 * need to print the device name. so this parameter is here to properly 124 * show the correct device name in that special case. */ 125 CgptFindShowFn show_fn; 126 } CgptFindParams; 127 128 enum { 129 CGPT_LEGACY_MODE_LEGACY = 0, 130 CGPT_LEGACY_MODE_EFIPART, 131 CGPT_LEGACY_MODE_IGNORE_PRIMARY, 132 }; 133 134 typedef struct CgptLegacyParams { 135 const char *drive_name; 136 uint64_t drive_size; 137 int mode; 138 } CgptLegacyParams; 139 140 #ifdef __cplusplus 141 } 142 #endif /* __cplusplus */ 143 144 #endif /* VBOOT_REFERENCE_CGPT_PARAMS_H_ */ 145