Lines Matching refs:lnum
368 static int leb_read_sanity_check(struct ubi_volume_desc *desc, int lnum, in leb_read_sanity_check() argument
375 if (vol_id < 0 || vol_id >= ubi->vtbl_slots || lnum < 0 || in leb_read_sanity_check()
376 lnum >= vol->used_ebs || offset < 0 || len < 0 || in leb_read_sanity_check()
384 if (lnum == vol->used_ebs - 1 && in leb_read_sanity_check()
422 int ubi_leb_read(struct ubi_volume_desc *desc, int lnum, char *buf, int offset, in ubi_leb_read() argument
429 dbg_gen("read %d bytes from LEB %d:%d:%d", len, vol_id, lnum, offset); in ubi_leb_read()
431 err = leb_read_sanity_check(desc, lnum, offset, len); in ubi_leb_read()
438 err = ubi_eba_read_leb(ubi, vol, lnum, buf, offset, len, check); in ubi_leb_read()
462 int ubi_leb_read_sg(struct ubi_volume_desc *desc, int lnum, struct ubi_sgl *sgl, in ubi_leb_read_sg() argument
469 dbg_gen("read %d bytes from LEB %d:%d:%d", len, vol_id, lnum, offset); in ubi_leb_read_sg()
471 err = leb_read_sanity_check(desc, lnum, offset, len); in ubi_leb_read_sg()
478 err = ubi_eba_read_leb_sg(ubi, vol, sgl, lnum, offset, len, check); in ubi_leb_read_sg()
513 int ubi_leb_write(struct ubi_volume_desc *desc, int lnum, const void *buf, in ubi_leb_write() argument
520 dbg_gen("write %d bytes to LEB %d:%d:%d", len, vol_id, lnum, offset); in ubi_leb_write()
528 if (!ubi_leb_valid(vol, lnum) || offset < 0 || len < 0 || in ubi_leb_write()
539 return ubi_eba_write_leb(ubi, vol, lnum, buf, offset, len); in ubi_leb_write()
558 int ubi_leb_change(struct ubi_volume_desc *desc, int lnum, const void *buf, in ubi_leb_change() argument
565 dbg_gen("atomically write %d bytes to LEB %d:%d", len, vol_id, lnum); in ubi_leb_change()
573 if (!ubi_leb_valid(vol, lnum) || len < 0 || in ubi_leb_change()
583 return ubi_eba_atomic_leb_change(ubi, vol, lnum, buf, len); in ubi_leb_change()
599 int ubi_leb_erase(struct ubi_volume_desc *desc, int lnum) in ubi_leb_erase() argument
605 dbg_gen("erase LEB %d:%d", vol->vol_id, lnum); in ubi_leb_erase()
610 if (!ubi_leb_valid(vol, lnum)) in ubi_leb_erase()
616 err = ubi_eba_unmap_leb(ubi, vol, lnum); in ubi_leb_erase()
620 return ubi_wl_flush(ubi, vol->vol_id, lnum); in ubi_leb_erase()
660 int ubi_leb_unmap(struct ubi_volume_desc *desc, int lnum) in ubi_leb_unmap() argument
665 dbg_gen("unmap LEB %d:%d", vol->vol_id, lnum); in ubi_leb_unmap()
670 if (!ubi_leb_valid(vol, lnum)) in ubi_leb_unmap()
676 return ubi_eba_unmap_leb(ubi, vol, lnum); in ubi_leb_unmap()
696 int ubi_leb_map(struct ubi_volume_desc *desc, int lnum) in ubi_leb_map() argument
701 dbg_gen("map LEB %d:%d", vol->vol_id, lnum); in ubi_leb_map()
706 if (!ubi_leb_valid(vol, lnum)) in ubi_leb_map()
712 if (ubi_eba_is_mapped(vol, lnum)) in ubi_leb_map()
715 return ubi_eba_write_leb(ubi, vol, lnum, NULL, 0, 0); in ubi_leb_map()
735 int ubi_is_mapped(struct ubi_volume_desc *desc, int lnum) in ubi_is_mapped() argument
739 dbg_gen("test LEB %d:%d", vol->vol_id, lnum); in ubi_is_mapped()
741 if (!ubi_leb_valid(vol, lnum)) in ubi_is_mapped()
747 return ubi_eba_is_mapped(vol, lnum); in ubi_is_mapped()
785 int ubi_flush(int ubi_num, int vol_id, int lnum) in ubi_flush() argument
794 err = ubi_wl_flush(ubi, vol_id, lnum); in ubi_flush()