Lines Matching refs:part
140 extern void jffs2_free_cache(struct part_info *part);
229 struct part_info *part; in index_partitions() local
248 part = mtd_part_info(current_mtd_dev, current_mtd_partnum); in index_partitions()
249 if (part) { in index_partitions()
250 env_set("mtddevname", part->name); in index_partitions()
252 debug("=> mtddevname %s\n", part->name); in index_partitions()
325 static int part_validate_eraseblock(struct mtdids *id, struct part_info *part) in part_validate_eraseblock() argument
335 part->sector_size = mtd->erasesize; in part_validate_eraseblock()
342 offset = part->offset; in part_validate_eraseblock()
346 MTD_DEV_TYPE(id->type), id->num, part->name); in part_validate_eraseblock()
350 size = part->size; in part_validate_eraseblock()
353 MTD_DEV_TYPE(id->type), id->num, part->name); in part_validate_eraseblock()
366 if (part->offset == start) in part_validate_eraseblock()
373 MTD_DEV_TYPE(id->type), id->num, part->name); in part_validate_eraseblock()
382 if ((part->offset + part->size) == start) in part_validate_eraseblock()
388 if ((part->offset + part->size) == start) in part_validate_eraseblock()
392 MTD_DEV_TYPE(id->type), id->num, part->name); in part_validate_eraseblock()
412 static int part_validate(struct mtdids *id, struct part_info *part) in part_validate() argument
414 if (part->size == SIZE_REMAINING) in part_validate()
415 part->size = id->size - part->offset; in part_validate()
417 if (part->offset > id->size) { in part_validate()
419 id->mtd_id, part->offset, id->size); in part_validate()
423 if ((part->offset + part->size) <= part->offset) { in part_validate()
425 MTD_DEV_TYPE(id->type), id->num, part->name); in part_validate()
429 if (part->offset + part->size > id->size) { in part_validate()
438 return part_validate_eraseblock(id, part); in part_validate()
448 static int part_del(struct mtd_device *dev, struct part_info *part) in part_del() argument
465 if (curr_pi == part) { in part_del()
468 } else if (part->offset <= curr_pi->offset) { in part_del()
475 list_del(&part->link); in part_del()
476 free(part); in part_del()
513 static int part_sort_add(struct mtd_device *dev, struct part_info *part) in part_sort_add() argument
519 part->dev = dev; in part_sort_add()
523 list_add(&part->link, &dev->parts); in part_sort_add()
529 new_pi = list_entry(&part->link, struct part_info, link); in part_sort_add()
548 list_add_tail(&part->link, entry); in part_sort_add()
563 list_add_tail(&part->link, &dev->parts); in part_sort_add()
576 static int part_add(struct mtd_device *dev, struct part_info *part) in part_add() argument
579 if (part_validate(dev->id, part) != 0) in part_add()
583 if (part_sort_add(dev, part) != 0) in part_add()
600 struct part_info *part; in part_parse() local
676 part = (struct part_info *)malloc(sizeof(struct part_info) + name_len); in part_parse()
677 if (!part) { in part_parse()
681 memset(part, 0, sizeof(struct part_info) + name_len); in part_parse()
682 part->size = size; in part_parse()
683 part->offset = offset; in part_parse()
684 part->mask_flags = mask_flags; in part_parse()
685 part->name = (char *)(part + 1); in part_parse()
689 strncpy(part->name, name, name_len - 1); in part_parse()
690 part->auto_name = 0; in part_parse()
693 sprintf(part->name, "0x%08llx@0x%08llx", size, offset); in part_parse()
694 part->auto_name = 1; in part_parse()
697 part->name[name_len - 1] = '\0'; in part_parse()
698 INIT_LIST_HEAD(&part->link); in part_parse()
701 part->name, part->size, in part_parse()
702 part->offset, part->mask_flags); in part_parse()
704 *retpart = part; in part_parse()
840 struct part_info *part; in device_parse() local
887 part = list_entry(dev->parts.prev, struct part_info, link); in device_parse()
888 offset = part->offset + part->size; in device_parse()
893 if ((part_parse(p, &p, &part) != 0) || (!part)) in device_parse()
897 if (part->offset == OFFSET_NOT_SPECIFIED) in device_parse()
898 part->offset = offset; in device_parse()
900 offset = part->offset; in device_parse()
903 if (part_validate(id, part) != 0) in device_parse()
906 offset += part->size; in device_parse()
909 list_add_tail(&part->link, &tmp_list); in device_parse()
949 part = list_entry(entry, struct part_info, link); in device_parse()
951 if (part_sort_add(dev, part) != 0) { in device_parse()
1082 struct part_info *part, *prev_part; in generate_mtdparts() local
1115 part = list_entry(pentry, struct part_info, link); in generate_mtdparts()
1116 size = part->size; in generate_mtdparts()
1117 offset = part->offset; in generate_mtdparts()
1133 (prev_part && ((prev_part->offset + prev_part->size) != part->offset))) { in generate_mtdparts()
1146 if(!part->auto_name) { in generate_mtdparts()
1147 len = strlen(part->name) + 2; in generate_mtdparts()
1152 memcpy(p, part->name, len - 2); in generate_mtdparts()
1159 if (part->mask_flags && MTD_WRITEABLE_CMD) { in generate_mtdparts()
1176 prev_part = part; in generate_mtdparts()
1228 static uint64_t net_part_size(struct mtd_info *mtd, struct part_info *part) in net_part_size() argument
1233 return part->size; in net_part_size()
1235 for (i = 0; i < part->size; i += mtd->erasesize) { in net_part_size()
1236 if (!mtd->block_isbad(mtd, part->offset + i)) in net_part_size()
1247 struct part_info *part; local
1270 part = list_entry(pentry, struct part_info, link);
1271 net_size = net_part_size(mtd, part);
1272 size_note = part->size == net_size ? " " : " (!)";
1274 part_num, part->name, part->size,
1275 net_size, size_note, part->offset,
1276 part->mask_flags);
1284 part = list_entry(pentry, struct part_info, link);
1286 part_num, part->name, part->size,
1287 part->offset, part->mask_flags);
1303 struct part_info *part; local
1310 part = mtd_part_info(current_mtd_dev, current_mtd_partnum);
1311 if (part) {
1315 part->name, part->size, part->offset);
1345 u8 *part_num, struct part_info **part) argument
1357 *part = list_entry(pentry, struct part_info, link);
1358 if (strcmp((*part)->name, id) == 0)
1366 *part = NULL;
1387 if ((*part = mtd_part_info(*dev, pnum)) == NULL) {
1408 struct part_info *part; local
1410 if (find_dev_and_part(id, &dev, &pnum, &part) == 0) {
1414 part->name, part->size, part->offset);
1416 if (part_del(dev, part) != 0)
1441 static void spread_partition(struct mtd_info *mtd, struct part_info *part, argument
1447 mtd_get_len_incl_bad(mtd, part->offset, part->size, &net_size,
1456 mtd_get_len_incl_bad(mtd, part->offset + net_size,
1465 printf("truncated partition %s to %lld bytes\n", part->name,
1469 part->size = net_size + padding_size;
1470 *next_offset = part->offset + part->size;
1484 struct part_info *part; local
1498 part = list_entry(pentry, struct part_info, link);
1503 part_num, part->name, part->size,
1504 part->offset);
1506 if (cur_offs > part->offset)
1507 part->offset = cur_offs;
1509 spread_partition(mtd, part, &cur_offs);
1872 struct part_info *part; local
1892 part = list_entry(entry, struct part_info, link);
1895 return part;
1920 struct part_info *part; local
1931 if (find_dev_and_part(argv[1], &dev, &pnum, &part) != 0)