Lines Matching refs:lnum
87 int ubifs_leb_read(const struct ubifs_info *c, int lnum, void *buf, int offs, in ubifs_leb_read() argument
92 err = ubi_read(c->ubi, lnum, buf, offs, len); in ubifs_leb_read()
99 len, lnum, offs, err); in ubifs_leb_read()
105 int ubifs_leb_write(struct ubifs_info *c, int lnum, const void *buf, int offs, in ubifs_leb_write() argument
114 err = ubi_leb_write(c->ubi, lnum, buf, offs, len); in ubifs_leb_write()
116 err = dbg_leb_write(c, lnum, buf, offs, len); in ubifs_leb_write()
119 len, lnum, offs, err); in ubifs_leb_write()
126 int ubifs_leb_change(struct ubifs_info *c, int lnum, const void *buf, int len) in ubifs_leb_change() argument
134 err = ubi_leb_change(c->ubi, lnum, buf, len); in ubifs_leb_change()
136 err = dbg_leb_change(c, lnum, buf, len); in ubifs_leb_change()
139 len, lnum, err); in ubifs_leb_change()
146 int ubifs_leb_unmap(struct ubifs_info *c, int lnum) in ubifs_leb_unmap() argument
154 err = ubi_leb_unmap(c->ubi, lnum); in ubifs_leb_unmap()
156 err = dbg_leb_unmap(c, lnum); in ubifs_leb_unmap()
158 ubifs_err(c, "unmap LEB %d failed, error %d", lnum, err); in ubifs_leb_unmap()
165 int ubifs_leb_map(struct ubifs_info *c, int lnum) in ubifs_leb_map() argument
173 err = ubi_leb_map(c->ubi, lnum); in ubifs_leb_map()
175 err = dbg_leb_map(c, lnum); in ubifs_leb_map()
177 ubifs_err(c, "mapping LEB %d failed, error %d", lnum, err); in ubifs_leb_map()
184 int ubifs_is_mapped(const struct ubifs_info *c, int lnum) in ubifs_is_mapped() argument
188 err = ubi_is_mapped(c->ubi, lnum); in ubifs_is_mapped()
191 lnum, err); in ubifs_is_mapped()
227 int lnum, int offs, int quiet, int must_chk_crc) in ubifs_check_node() argument
233 ubifs_assert(c, lnum >= 0 && lnum < c->leb_cnt && offs >= 0); in ubifs_check_node()
284 ubifs_err(c, "bad node at LEB %d:%d", lnum, offs); in ubifs_check_node()
543 if (!wbuf->used || wbuf->lnum == -1) in ubifs_wbuf_sync_nolock()
548 wbuf->lnum, wbuf->offs, wbuf->used, dbg_jhead(wbuf->jhead)); in ubifs_wbuf_sync_nolock()
569 err = ubifs_leb_write(c, wbuf->lnum, wbuf->buf, wbuf->offs, sync_len); in ubifs_wbuf_sync_nolock()
597 err = wbuf->sync_callback(c, wbuf->lnum, in ubifs_wbuf_sync_nolock()
612 int ubifs_wbuf_seek_nolock(struct ubifs_wbuf *wbuf, int lnum, int offs) in ubifs_wbuf_seek_nolock() argument
616 dbg_io("LEB %d:%d, jhead %s", lnum, offs, dbg_jhead(wbuf->jhead)); in ubifs_wbuf_seek_nolock()
617 ubifs_assert(c, lnum >= 0 && lnum < c->leb_cnt); in ubifs_wbuf_seek_nolock()
620 ubifs_assert(c, lnum != wbuf->lnum); in ubifs_wbuf_seek_nolock()
624 wbuf->lnum = lnum; in ubifs_wbuf_seek_nolock()
726 dbg_jhead(wbuf->jhead), wbuf->lnum, wbuf->offs + wbuf->used); in ubifs_wbuf_write_nolock()
727 ubifs_assert(c, len > 0 && wbuf->lnum >= 0 && wbuf->lnum < c->leb_cnt); in ubifs_wbuf_write_nolock()
763 dbg_jhead(wbuf->jhead), wbuf->lnum, wbuf->offs); in ubifs_wbuf_write_nolock()
764 err = ubifs_leb_write(c, wbuf->lnum, wbuf->buf, in ubifs_wbuf_write_nolock()
796 dbg_jhead(wbuf->jhead), wbuf->lnum, wbuf->offs); in ubifs_wbuf_write_nolock()
798 err = ubifs_leb_write(c, wbuf->lnum, wbuf->buf, wbuf->offs, in ubifs_wbuf_write_nolock()
816 wbuf->size, wbuf->lnum, wbuf->offs); in ubifs_wbuf_write_nolock()
817 err = ubifs_leb_write(c, wbuf->lnum, buf, wbuf->offs, in ubifs_wbuf_write_nolock()
837 dbg_io("write %d bytes to LEB %d:%d", n, wbuf->lnum, in ubifs_wbuf_write_nolock()
839 err = ubifs_leb_write(c, wbuf->lnum, buf + written, in ubifs_wbuf_write_nolock()
876 err = wbuf->sync_callback(c, wbuf->lnum, free, 0); in ubifs_wbuf_write_nolock()
888 len, wbuf->lnum, wbuf->offs, err); in ubifs_wbuf_write_nolock()
891 ubifs_dump_leb(c, wbuf->lnum); in ubifs_wbuf_write_nolock()
910 int ubifs_write_node_hmac(struct ubifs_info *c, void *buf, int len, int lnum, in ubifs_write_node_hmac() argument
916 lnum, offs, dbg_ntype(((struct ubifs_ch *)buf)->node_type), len, in ubifs_write_node_hmac()
918 ubifs_assert(c, lnum >= 0 && lnum < c->leb_cnt && offs >= 0); in ubifs_write_node_hmac()
930 err = ubifs_leb_write(c, lnum, buf, offs, buf_len); in ubifs_write_node_hmac()
951 int ubifs_write_node(struct ubifs_info *c, void *buf, int len, int lnum, in ubifs_write_node() argument
954 return ubifs_write_node_hmac(c, buf, len, lnum, offs, -1); in ubifs_write_node()
973 int lnum, int offs) in ubifs_read_node_wbuf() argument
979 dbg_io("LEB %d:%d, %s, length %d, jhead %s", lnum, offs, in ubifs_read_node_wbuf()
981 ubifs_assert(c, wbuf && lnum >= 0 && lnum < c->leb_cnt && offs >= 0); in ubifs_read_node_wbuf()
986 overlap = (lnum == wbuf->lnum && offs + len > wbuf->offs); in ubifs_read_node_wbuf()
990 return ubifs_read_node(c, buf, type, len, lnum, offs); in ubifs_read_node_wbuf()
1004 err = ubifs_leb_read(c, lnum, buf, offs, rlen, 0); in ubifs_read_node_wbuf()
1015 err = ubifs_check_node(c, buf, len, lnum, offs, 0, 0); in ubifs_read_node_wbuf()
1030 ubifs_err(c, "bad node at LEB %d:%d", lnum, offs); in ubifs_read_node_wbuf()
1050 int lnum, int offs) in ubifs_read_node() argument
1055 dbg_io("LEB %d:%d, %s, length %d", lnum, offs, dbg_ntype(type), len); in ubifs_read_node()
1056 ubifs_assert(c, lnum >= 0 && lnum < c->leb_cnt && offs >= 0); in ubifs_read_node()
1061 err = ubifs_leb_read(c, lnum, buf, offs, len, 0); in ubifs_read_node()
1071 err = ubifs_check_node(c, buf, len, lnum, offs, 0, 0); in ubifs_read_node()
1086 ubifs_errc(c, "bad node at LEB %d:%d, LEB mapping status %d", lnum, in ubifs_read_node()
1087 offs, ubi_is_mapped(c->ubi, lnum)); in ubifs_read_node()
1120 wbuf->lnum = wbuf->offs = -1; in ubifs_wbuf_init()