Lines Matching full:av

176  * @av: information about the volume this logical eraseblock belongs to
189 const struct ubi_ainf_volume *av, int pnum) in validate_vid_hdr() argument
196 if (av->leb_count != 0) { in validate_vid_hdr()
205 if (vol_id != av->vol_id) { in validate_vid_hdr()
210 if (av->vol_type == UBI_STATIC_VOLUME) in validate_vid_hdr()
220 if (used_ebs != av->used_ebs) { in validate_vid_hdr()
225 if (data_pad != av->data_pad) { in validate_vid_hdr()
236 ubi_dump_av(av); in validate_vid_hdr()
250 * to the allocated "av" object in case of success and a negative error code in
257 struct ubi_ainf_volume *av; in add_volume() local
265 av = rb_entry(parent, struct ubi_ainf_volume, rb); in add_volume()
267 if (vol_id == av->vol_id) in add_volume()
268 return av; in add_volume()
270 if (vol_id > av->vol_id) in add_volume()
277 av = kmalloc(sizeof(struct ubi_ainf_volume), GFP_KERNEL); in add_volume()
278 if (!av) in add_volume()
281 av->highest_lnum = av->leb_count = 0; in add_volume()
282 av->vol_id = vol_id; in add_volume()
283 av->root = RB_ROOT; in add_volume()
284 av->used_ebs = be32_to_cpu(vid_hdr->used_ebs); in add_volume()
285 av->data_pad = be32_to_cpu(vid_hdr->data_pad); in add_volume()
286 av->compat = vid_hdr->compat; in add_volume()
287 av->vol_type = vid_hdr->vol_type == UBI_VID_DYNAMIC ? UBI_DYNAMIC_VOLUME in add_volume()
292 rb_link_node(&av->rb, parent, p); in add_volume()
293 rb_insert_color(&av->rb, &ai->volumes); in add_volume()
296 return av; in add_volume()
449 struct ubi_ainf_volume *av; in ubi_add_to_av() local
460 av = add_volume(ai, vol_id, pnum, vid_hdr); in ubi_add_to_av()
461 if (IS_ERR(av)) in ubi_add_to_av()
462 return PTR_ERR(av); in ubi_add_to_av()
471 p = &av->root.rb_node; in ubi_add_to_av()
527 err = validate_vid_hdr(ubi, vid_hdr, av, pnum); in ubi_add_to_av()
545 if (av->highest_lnum == lnum) in ubi_add_to_av()
546 av->last_data_size = in ubi_add_to_av()
565 err = validate_vid_hdr(ubi, vid_hdr, av, pnum); in ubi_add_to_av()
581 if (av->highest_lnum <= lnum) { in ubi_add_to_av()
582 av->highest_lnum = lnum; in ubi_add_to_av()
583 av->last_data_size = be32_to_cpu(vid_hdr->data_size); in ubi_add_to_av()
586 av->leb_count += 1; in ubi_add_to_av()
588 rb_insert_color(&aeb->u.rb, &av->root); in ubi_add_to_av()
603 struct ubi_ainf_volume *av; in ubi_find_av() local
607 av = rb_entry(p, struct ubi_ainf_volume, rb); in ubi_find_av()
609 if (vol_id == av->vol_id) in ubi_find_av()
610 return av; in ubi_find_av()
612 if (vol_id > av->vol_id) in ubi_find_av()
624 * @av: the volume attaching information to delete
626 void ubi_remove_av(struct ubi_attach_info *ai, struct ubi_ainf_volume *av) in ubi_remove_av() argument
631 dbg_bld("remove attaching information about volume %d", av->vol_id); in ubi_remove_av()
633 while ((rb = rb_first(&av->root))) { in ubi_remove_av()
635 rb_erase(&aeb->u.rb, &av->root); in ubi_remove_av()
639 rb_erase(&av->rb, &ai->volumes); in ubi_remove_av()
640 kfree(av); in ubi_remove_av()
1127 * @av: volume attaching information
1132 static void destroy_av(struct ubi_attach_info *ai, struct ubi_ainf_volume *av) in destroy_av() argument
1135 struct rb_node *this = av->root.rb_node; in destroy_av()
1155 kfree(av); in destroy_av()
1165 struct ubi_ainf_volume *av; in destroy_ai() local
1193 av = rb_entry(rb, struct ubi_ainf_volume, rb); in destroy_ai()
1197 if (rb->rb_left == &av->rb) in destroy_ai()
1203 destroy_av(ai, av); in destroy_ai()
1227 struct ubi_ainf_volume *av; in scan_all() local
1263 ubi_rb_for_each_entry(rb1, av, &ai->volumes, rb) { in scan_all()
1264 ubi_rb_for_each_entry(rb2, aeb, &av->root, u.rb) in scan_all()
1503 struct ubi_ainf_volume *av; in self_check_ai() local
1513 ubi_rb_for_each_entry(rb1, av, &ai->volumes, rb) { in self_check_ai()
1525 if (av->vol_id < 0 || av->highest_lnum < 0 || in self_check_ai()
1526 av->leb_count < 0 || av->vol_type < 0 || av->used_ebs < 0 || in self_check_ai()
1527 av->data_pad < 0 || av->last_data_size < 0) { in self_check_ai()
1532 if (av->vol_id >= UBI_MAX_VOLUMES && in self_check_ai()
1533 av->vol_id < UBI_INTERNAL_VOL_START) { in self_check_ai()
1538 if (av->vol_id > ai->highest_vol_id) { in self_check_ai()
1540 ai->highest_vol_id, av->vol_id); in self_check_ai()
1544 if (av->vol_type != UBI_DYNAMIC_VOLUME && in self_check_ai()
1545 av->vol_type != UBI_STATIC_VOLUME) { in self_check_ai()
1550 if (av->data_pad > ubi->leb_size / 2) { in self_check_ai()
1556 ubi_rb_for_each_entry(rb2, aeb, &av->root, u.rb) { in self_check_ai()
1585 if (av->vol_type == UBI_STATIC_VOLUME) { in self_check_ai()
1586 if (aeb->lnum >= av->used_ebs) { in self_check_ai()
1591 if (av->used_ebs != 0) { in self_check_ai()
1597 if (aeb->lnum > av->highest_lnum) { in self_check_ai()
1603 if (av->leb_count != leb_count) { in self_check_ai()
1614 if (aeb->lnum != av->highest_lnum) { in self_check_ai()
1627 ubi_rb_for_each_entry(rb1, av, &ai->volumes, rb) { in self_check_ai()
1629 ubi_rb_for_each_entry(rb2, aeb, &av->root, u.rb) { in self_check_ai()
1647 if (av->vol_type != vol_type) { in self_check_ai()
1657 if (av->vol_id != be32_to_cpu(vidh->vol_id)) { in self_check_ai()
1658 ubi_err(ubi, "bad vol_id %d", av->vol_id); in self_check_ai()
1662 if (av->compat != vidh->compat) { in self_check_ai()
1672 if (av->used_ebs != be32_to_cpu(vidh->used_ebs)) { in self_check_ai()
1673 ubi_err(ubi, "bad used_ebs %d", av->used_ebs); in self_check_ai()
1677 if (av->data_pad != be32_to_cpu(vidh->data_pad)) { in self_check_ai()
1678 ubi_err(ubi, "bad data_pad %d", av->data_pad); in self_check_ai()
1686 if (av->highest_lnum != be32_to_cpu(vidh->lnum)) { in self_check_ai()
1687 ubi_err(ubi, "bad highest_lnum %d", av->highest_lnum); in self_check_ai()
1691 if (av->last_data_size != be32_to_cpu(vidh->data_size)) { in self_check_ai()
1693 av->last_data_size); in self_check_ai()
1715 ubi_rb_for_each_entry(rb1, av, &ai->volumes, rb) in self_check_ai()
1716 ubi_rb_for_each_entry(rb2, aeb, &av->root, u.rb) in self_check_ai()
1746 ubi_dump_av(av); in self_check_ai()
1750 ubi_err(ubi, "bad attaching information about volume %d", av->vol_id); in self_check_ai()
1751 ubi_dump_av(av); in self_check_ai()
1755 ubi_err(ubi, "bad attaching information about volume %d", av->vol_id); in self_check_ai()
1756 ubi_dump_av(av); in self_check_ai()