Lines Matching defs:av

107 	struct ubi_ainf_volume *av;
113 av = rb_entry(parent, struct ubi_ainf_volume, rb);
115 if (vol_id == av->vol_id) {
121 return av;
124 if (vol_id > av->vol_id)
134 av = kzalloc(sizeof(*av), GFP_KERNEL);
135 if (!av)
138 av->vol_id = vol_id;
143 rb_link_node(&av->rb, parent, p);
144 rb_insert_color(&av->rb, &ai->volumes);
148 return av;
319 * @av: information about the volume this logical eraseblock belongs to
332 const struct ubi_ainf_volume *av, int pnum)
339 if (av->leb_count != 0) {
348 if (vol_id != av->vol_id) {
353 if (av->vol_type == UBI_STATIC_VOLUME)
363 if (used_ebs != av->used_ebs) {
368 if (data_pad != av->data_pad) {
379 ubi_dump_av(av);
393 * to the allocated "av" object in case of success and a negative error code in
400 struct ubi_ainf_volume *av;
405 av = ubi_find_or_add_av(ai, vol_id, &created);
406 if (IS_ERR(av) || !created)
407 return av;
409 av->used_ebs = be32_to_cpu(vid_hdr->used_ebs);
410 av->data_pad = be32_to_cpu(vid_hdr->data_pad);
411 av->compat = vid_hdr->compat;
412 av->vol_type = vid_hdr->vol_type == UBI_VID_DYNAMIC ? UBI_DYNAMIC_VOLUME
415 return av;
568 struct ubi_ainf_volume *av;
579 av = add_volume(ai, vol_id, pnum, vid_hdr);
580 if (IS_ERR(av))
581 return PTR_ERR(av);
590 p = &av->root.rb_node;
646 err = validate_vid_hdr(ubi, vid_hdr, av, pnum);
664 if (av->highest_lnum == lnum)
665 av->last_data_size =
684 err = validate_vid_hdr(ubi, vid_hdr, av, pnum);
698 if (av->highest_lnum <= lnum) {
699 av->highest_lnum = lnum;
700 av->last_data_size = be32_to_cpu(vid_hdr->data_size);
703 av->leb_count += 1;
705 rb_insert_color(&aeb->u.rb, &av->root);
741 static void destroy_av(struct ubi_attach_info *ai, struct ubi_ainf_volume *av,
747 * @av: the volume attaching information to delete
749 void ubi_remove_av(struct ubi_attach_info *ai, struct ubi_ainf_volume *av)
751 dbg_bld("remove attaching information about volume %d", av->vol_id);
753 rb_erase(&av->rb, &ai->volumes);
754 destroy_av(ai, av, &ai->erase);
1271 * @av: volume attaching information
1277 static void destroy_av(struct ubi_attach_info *ai, struct ubi_ainf_volume *av,
1281 struct rb_node *this = av->root.rb_node;
1304 kfree(av);
1314 struct ubi_ainf_volume *av;
1346 av = rb_entry(rb, struct ubi_ainf_volume, rb);
1350 if (rb->rb_left == &av->rb)
1356 destroy_av(ai, av, NULL);
1379 struct ubi_ainf_volume *av;
1415 ubi_rb_for_each_entry(rb1, av, &ai->volumes, rb) {
1416 ubi_rb_for_each_entry(rb2, aeb, &av->root, u.rb)
1664 struct ubi_ainf_volume *av;
1674 ubi_rb_for_each_entry(rb1, av, &ai->volumes, rb) {
1686 if (av->vol_id < 0 || av->highest_lnum < 0 ||
1687 av->leb_count < 0 || av->vol_type < 0 || av->used_ebs < 0 ||
1688 av->data_pad < 0 || av->last_data_size < 0) {
1693 if (av->vol_id >= UBI_MAX_VOLUMES &&
1694 av->vol_id < UBI_INTERNAL_VOL_START) {
1699 if (av->vol_id > ai->highest_vol_id) {
1701 ai->highest_vol_id, av->vol_id);
1705 if (av->vol_type != UBI_DYNAMIC_VOLUME &&
1706 av->vol_type != UBI_STATIC_VOLUME) {
1711 if (av->data_pad > ubi->leb_size / 2) {
1717 ubi_rb_for_each_entry(rb2, aeb, &av->root, u.rb) {
1746 if (av->vol_type == UBI_STATIC_VOLUME) {
1747 if (aeb->lnum >= av->used_ebs) {
1752 if (av->used_ebs != 0) {
1758 if (aeb->lnum > av->highest_lnum) {
1764 if (av->leb_count != leb_count) {
1775 if (aeb->lnum != av->highest_lnum) {
1788 ubi_rb_for_each_entry(rb1, av, &ai->volumes, rb) {
1790 ubi_rb_for_each_entry(rb2, aeb, &av->root, u.rb) {
1808 if (av->vol_type != vol_type) {
1818 if (av->vol_id != be32_to_cpu(vidh->vol_id)) {
1819 ubi_err(ubi, "bad vol_id %d", av->vol_id);
1823 if (av->compat != vidh->compat) {
1833 if (av->used_ebs != be32_to_cpu(vidh->used_ebs)) {
1834 ubi_err(ubi, "bad used_ebs %d", av->used_ebs);
1838 if (av->data_pad != be32_to_cpu(vidh->data_pad)) {
1839 ubi_err(ubi, "bad data_pad %d", av->data_pad);
1847 if (av->highest_lnum != be32_to_cpu(vidh->lnum)) {
1848 ubi_err(ubi, "bad highest_lnum %d", av->highest_lnum);
1852 if (av->last_data_size != be32_to_cpu(vidh->data_size)) {
1854 av->last_data_size);
1876 ubi_rb_for_each_entry(rb1, av, &ai->volumes, rb)
1877 ubi_rb_for_each_entry(rb2, aeb, &av->root, u.rb)
1907 ubi_dump_av(av);
1911 ubi_err(ubi, "bad attaching information about volume %d", av->vol_id);
1912 ubi_dump_av(av);
1916 ubi_err(ubi, "bad attaching information about volume %d", av->vol_id);
1917 ubi_dump_av(av);