Lines Matching refs:params
15 static const char* DumpCgptAddParams(const CgptAddParams *params) { in DumpCgptAddParams() argument
20 snprintf(tmp, sizeof(tmp), "-i %d ", params->partition); in DumpCgptAddParams()
22 if (params->label) { in DumpCgptAddParams()
23 snprintf(tmp, sizeof(tmp), "-l %s ", params->label); in DumpCgptAddParams()
26 if (params->set_begin) { in DumpCgptAddParams()
27 snprintf(tmp, sizeof(tmp), "-b %llu ", (unsigned long long)params->begin); in DumpCgptAddParams()
30 if (params->set_size) { in DumpCgptAddParams()
31 snprintf(tmp, sizeof(tmp), "-s %llu ", (unsigned long long)params->size); in DumpCgptAddParams()
34 if (params->set_type) { in DumpCgptAddParams()
35 GuidToStr(¶ms->type_guid, tmp, sizeof(tmp)); in DumpCgptAddParams()
40 if (params->set_unique) { in DumpCgptAddParams()
41 GuidToStr(¶ms->unique_guid, tmp, sizeof(tmp)); in DumpCgptAddParams()
46 if (params->set_successful) { in DumpCgptAddParams()
47 snprintf(tmp, sizeof(tmp), "-S %d ", params->successful); in DumpCgptAddParams()
50 if (params->set_tries) { in DumpCgptAddParams()
51 snprintf(tmp, sizeof(tmp), "-T %d ", params->tries); in DumpCgptAddParams()
54 if (params->set_priority) { in DumpCgptAddParams()
55 snprintf(tmp, sizeof(tmp), "-P %d ", params->priority); in DumpCgptAddParams()
58 if (params->set_raw) { in DumpCgptAddParams()
59 snprintf(tmp, sizeof(tmp), "-A 0x%x ", params->raw_value); in DumpCgptAddParams()
70 CgptAddParams *params) { in GptSetEntryAttributes() argument
74 if (params->set_begin) in GptSetEntryAttributes()
75 entry->starting_lba = params->begin; in GptSetEntryAttributes()
76 if (params->set_size) in GptSetEntryAttributes()
77 entry->ending_lba = entry->starting_lba + params->size - 1; in GptSetEntryAttributes()
78 if (params->set_unique) { in GptSetEntryAttributes()
79 memcpy(&entry->unique, ¶ms->unique_guid, sizeof(Guid)); in GptSetEntryAttributes()
86 if (params->set_type) in GptSetEntryAttributes()
87 memcpy(&entry->type, ¶ms->type_guid, sizeof(Guid)); in GptSetEntryAttributes()
88 if (params->label) { in GptSetEntryAttributes()
89 if (CGPT_OK != UTF8ToUTF16((uint8_t *)params->label, entry->name, in GptSetEntryAttributes()
102 CgptAddParams *params) { in SetEntryAttributes() argument
103 if (params->set_raw) { in SetEntryAttributes()
104 SetRaw(drive, PRIMARY, index, params->raw_value); in SetEntryAttributes()
106 if (params->set_successful) in SetEntryAttributes()
107 SetSuccessful(drive, PRIMARY, index, params->successful); in SetEntryAttributes()
108 if (params->set_tries) in SetEntryAttributes()
109 SetTries(drive, PRIMARY, index, params->tries); in SetEntryAttributes()
110 if (params->set_priority) in SetEntryAttributes()
111 SetPriority(drive, PRIMARY, index, params->priority); in SetEntryAttributes()
116 if (!params->set_begin || !params->set_size || !params->set_type) { in SetEntryAttributes()
120 if (GuidIsZero(¶ms->type_guid)) { in SetEntryAttributes()
148 CgptAddParams *params) { in CgptGetUnusedPartition() argument
151 if (params->partition) { in CgptGetUnusedPartition()
152 if (params->partition > max_part) { in CgptGetUnusedPartition()
153 Error("invalid partition number: %d\n", params->partition); in CgptGetUnusedPartition()
156 *index = params->partition - 1; in CgptGetUnusedPartition()
162 params->partition = i + 1; in CgptGetUnusedPartition()
172 int CgptSetAttributes(CgptAddParams *params) { in CgptSetAttributes() argument
175 if (params == NULL) in CgptSetAttributes()
178 if (CGPT_OK != DriveOpen(params->drive_name, &drive, O_RDWR, in CgptSetAttributes()
179 params->drive_size)) in CgptSetAttributes()
186 if (params->partition == 0 || in CgptSetAttributes()
187 params->partition >= GetNumberOfEntries(&drive)) { in CgptSetAttributes()
188 Error("invalid partition number: %d\n", params->partition); in CgptSetAttributes()
192 SetEntryAttributes(&drive, params->partition - 1, params); in CgptSetAttributes()
208 int CgptGetPartitionDetails(CgptAddParams *params) { in CgptGetPartitionDetails() argument
213 if (params == NULL) in CgptGetPartitionDetails()
216 if (CGPT_OK != DriveOpen(params->drive_name, &drive, O_RDWR, in CgptGetPartitionDetails()
217 params->drive_size)) in CgptGetPartitionDetails()
225 if (params->partition > 0) { in CgptGetPartitionDetails()
226 if (params->partition >= max_part) { in CgptGetPartitionDetails()
227 Error("invalid partition number: %d\n", params->partition); in CgptGetPartitionDetails()
231 if (!params->set_unique) { in CgptGetPartitionDetails()
237 if (GuidEqual(&entry->unique, ¶ms->unique_guid)) { in CgptGetPartitionDetails()
238 params->partition = index + 1; in CgptGetPartitionDetails()
247 index = params->partition - 1; in CgptGetPartitionDetails()
251 params->begin = entry->starting_lba; in CgptGetPartitionDetails()
252 params->size = entry->ending_lba - entry->starting_lba + 1; in CgptGetPartitionDetails()
253 memcpy(¶ms->type_guid, &entry->type, sizeof(Guid)); in CgptGetPartitionDetails()
254 memcpy(¶ms->unique_guid, &entry->unique, sizeof(Guid)); in CgptGetPartitionDetails()
255 params->raw_value = entry->attrs.fields.gpt_att; in CgptGetPartitionDetails()
257 params->successful = GetSuccessful(&drive, PRIMARY, index); in CgptGetPartitionDetails()
258 params->tries = GetTries(&drive, PRIMARY, index); in CgptGetPartitionDetails()
259 params->priority = GetPriority(&drive, PRIMARY, index); in CgptGetPartitionDetails()
267 static int GptAdd(struct drive *drive, CgptAddParams *params, uint32_t index) { in GptAdd() argument
274 if (SetEntryAttributes(drive, index, params) || in GptAdd()
275 GptSetEntryAttributes(drive, index, params)) { in GptAdd()
289 Error(DumpCgptAddParams(params)); in GptAdd()
296 int CgptAdd(CgptAddParams *params) { in CgptAdd() argument
300 if (params == NULL) in CgptAdd()
303 if (CGPT_OK != DriveOpen(params->drive_name, &drive, O_RDWR, in CgptAdd()
304 params->drive_size)) in CgptAdd()
311 if (CgptGetUnusedPartition(&drive, &index, params)) { in CgptAdd()
315 if (GptAdd(&drive, params, index)) in CgptAdd()