Lines Matching refs:dinfo
92 load_partitions(cnode *root, struct disk_info *dinfo) in load_partitions() argument
96 dinfo->num_parts = 0; in load_partitions()
98 struct part_info *pinfo = &dinfo->part_lst[dinfo->num_parts]; in load_partitions()
132 ++dinfo->num_parts; in load_partitions()
141 struct disk_info *dinfo; in load_diskconfig() local
147 if (!(dinfo = malloc(sizeof(struct disk_info)))) { in load_diskconfig()
151 memset(dinfo, 0, sizeof(struct disk_info)); in load_diskconfig()
153 if (!(dinfo->part_lst = malloc(MAX_NUM_PARTS * sizeof(struct part_info)))) { in load_diskconfig()
157 memset(dinfo->part_lst, 0, in load_diskconfig()
176 dinfo->device = strdup(tmp); in load_diskconfig()
183 dinfo->scheme = PART_SCHEME_MBR; in load_diskconfig()
194 dinfo->sect_size = strtol(tmp, NULL, 0); in load_diskconfig()
195 if (!dinfo->sect_size) { in load_diskconfig()
206 if (!(dinfo->skip_lba = strtol(tmp, NULL, 0))) { in load_diskconfig()
216 dinfo->num_lba = strtoul(tmp, NULL, 0); in load_diskconfig()
223 if (load_partitions(partnode, dinfo)) in load_diskconfig()
226 return dinfo; in load_diskconfig()
229 if (dinfo->part_lst) in load_diskconfig()
230 free(dinfo->part_lst); in load_diskconfig()
231 if (dinfo->device) in load_diskconfig()
232 free(dinfo->device); in load_diskconfig()
233 free(dinfo); in load_diskconfig()
270 validate(struct disk_info *dinfo) in validate() argument
279 if (!dinfo) in validate()
282 if ((fd = open(dinfo->device, O_RDWR)) < 0) { in validate()
283 ALOGE("Cannot open device '%s' (errno=%d)", dinfo->device, errno); in validate()
288 ALOGE("Cannot stat file '%s', errno=%d.", dinfo->device, errno); in validate()
305 if (!sect_sz || sect_sz != dinfo->sect_size) { in validate()
311 if (!dinfo->num_lba) { in validate()
317 dinfo->num_lba = (uint32_t)(disk_size / (uint64_t)dinfo->sect_size); in validate()
319 disk_size = (uint64_t)dinfo->num_lba * (uint64_t)dinfo->sect_size; in validate()
322 if (!dinfo->sect_size) { in validate()
326 if (dinfo->num_lba) in validate()
327 disk_size = (uint64_t)dinfo->num_lba * (uint64_t)dinfo->sect_size; in validate()
329 dinfo->num_lba = (uint32_t)(stat.st_size / dinfo->sect_size); in validate()
339 dinfo->device, disk_size, dinfo->num_lba, dinfo->sect_size); in validate()
344 total_size = dinfo->skip_lba * dinfo->sect_size; in validate()
347 for (cnt = 0; cnt < dinfo->num_parts; ++cnt) { in validate()
348 struct part_info *part = &dinfo->part_lst[cnt]; in validate()
356 if (cnt + 1 != dinfo->num_parts) { in validate()
386 validate_and_config(struct disk_info *dinfo, int *fd, struct write_list **lst) in validate_and_config() argument
391 if ((*fd = validate(dinfo)) < 0) in validate_and_config()
394 switch (dinfo->scheme) { in validate_and_config()
396 *lst = config_mbr(dinfo); in validate_and_config()
418 process_disk_config(struct disk_info *dinfo) in process_disk_config() argument
423 if (validate_and_config(dinfo, &fd, &lst) != 0) in process_disk_config()
433 apply_disk_config(struct disk_info *dinfo, int test) in apply_disk_config() argument
439 if (validate_and_config(dinfo, &fd, &wr_lst) != 0) { in apply_disk_config()
459 dump_disk_config(struct disk_info *dinfo) in dump_disk_config() argument
464 printf("Device: %s\n", dinfo->device); in dump_disk_config()
466 switch (dinfo->scheme) { in dump_disk_config()
479 printf("Sector size: %d\n", dinfo->sect_size); in dump_disk_config()
480 printf("Skip leading LBAs: %u\n", dinfo->skip_lba); in dump_disk_config()
481 printf("Number of LBAs: %u\n", dinfo->num_lba); in dump_disk_config()
484 for (cnt = 0; cnt < dinfo->num_parts; ++cnt) { in dump_disk_config()
485 part = &dinfo->part_lst[cnt]; in dump_disk_config()
503 find_part(struct disk_info *dinfo, const char *name) in find_part() argument
508 for (cnt = 0; cnt < dinfo->num_parts; ++cnt) { in find_part()
509 pinfo = &dinfo->part_lst[cnt]; in find_part()
519 find_part_device(struct disk_info *dinfo, const char *name) in find_part_device() argument
521 switch (dinfo->scheme) { in find_part_device()
523 return find_mbr_part(dinfo, name); in find_part_device()