Lines Matching refs:offs
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()
245 int lnum, int offs, int quiet, int must_chk_crc) in ubifs_check_node() argument
251 ubifs_assert(c, lnum >= 0 && lnum < c->leb_cnt && offs >= 0); in ubifs_check_node()
252 ubifs_assert(c, !(offs & 7) && offs < c->leb_size); in ubifs_check_node()
273 if (node_len + offs > c->leb_size) in ubifs_check_node()
305 ubifs_err(c, "bad node at LEB %d:%d", lnum, offs); in ubifs_check_node()
569 wbuf->lnum, wbuf->offs, wbuf->used, dbg_jhead(wbuf->jhead)); in ubifs_wbuf_sync_nolock()
571 ubifs_assert(c, wbuf->offs + wbuf->size <= c->leb_size); in ubifs_wbuf_sync_nolock()
576 if (c->leb_size - wbuf->offs >= c->max_write_size) in ubifs_wbuf_sync_nolock()
577 ubifs_assert(c, !((wbuf->offs + wbuf->size) % c->max_write_size)); in ubifs_wbuf_sync_nolock()
590 err = ubifs_leb_write(c, wbuf->lnum, wbuf->buf, wbuf->offs, sync_len); in ubifs_wbuf_sync_nolock()
595 wbuf->offs += sync_len; in ubifs_wbuf_sync_nolock()
606 if (c->leb_size - wbuf->offs < c->max_write_size) in ubifs_wbuf_sync_nolock()
607 wbuf->size = c->leb_size - wbuf->offs; in ubifs_wbuf_sync_nolock()
608 else if (wbuf->offs & (c->max_write_size - 1)) in ubifs_wbuf_sync_nolock()
609 wbuf->size = ALIGN(wbuf->offs, c->max_write_size) - wbuf->offs; in ubifs_wbuf_sync_nolock()
619 c->leb_size - wbuf->offs, dirt); in ubifs_wbuf_sync_nolock()
633 int ubifs_wbuf_seek_nolock(struct ubifs_wbuf *wbuf, int lnum, int offs) in ubifs_wbuf_seek_nolock() argument
637 dbg_io("LEB %d:%d, jhead %s", lnum, offs, dbg_jhead(wbuf->jhead)); in ubifs_wbuf_seek_nolock()
639 ubifs_assert(c, offs >= 0 && offs <= c->leb_size); in ubifs_wbuf_seek_nolock()
640 ubifs_assert(c, offs % c->min_io_size == 0 && !(offs & 7)); in ubifs_wbuf_seek_nolock()
646 wbuf->offs = offs; in ubifs_wbuf_seek_nolock()
647 if (c->leb_size - wbuf->offs < c->max_write_size) in ubifs_wbuf_seek_nolock()
648 wbuf->size = c->leb_size - wbuf->offs; in ubifs_wbuf_seek_nolock()
649 else if (wbuf->offs & (c->max_write_size - 1)) in ubifs_wbuf_seek_nolock()
650 wbuf->size = ALIGN(wbuf->offs, c->max_write_size) - wbuf->offs; in ubifs_wbuf_seek_nolock()
747 dbg_jhead(wbuf->jhead), wbuf->lnum, wbuf->offs + wbuf->used); in ubifs_wbuf_write_nolock()
749 ubifs_assert(c, wbuf->offs >= 0 && wbuf->offs % c->min_io_size == 0); in ubifs_wbuf_write_nolock()
750 ubifs_assert(c, !(wbuf->offs & 7) && wbuf->offs <= c->leb_size); in ubifs_wbuf_write_nolock()
758 if (c->leb_size - wbuf->offs >= c->max_write_size) in ubifs_wbuf_write_nolock()
759 ubifs_assert(c, !((wbuf->offs + wbuf->size) % c->max_write_size)); in ubifs_wbuf_write_nolock()
761 if (c->leb_size - wbuf->offs - wbuf->used < aligned_len) { in ubifs_wbuf_write_nolock()
784 dbg_jhead(wbuf->jhead), wbuf->lnum, wbuf->offs); in ubifs_wbuf_write_nolock()
786 wbuf->offs, wbuf->size); in ubifs_wbuf_write_nolock()
791 wbuf->offs += wbuf->size; in ubifs_wbuf_write_nolock()
792 if (c->leb_size - wbuf->offs >= c->max_write_size) in ubifs_wbuf_write_nolock()
795 wbuf->size = c->leb_size - wbuf->offs; in ubifs_wbuf_write_nolock()
817 dbg_jhead(wbuf->jhead), wbuf->lnum, wbuf->offs); in ubifs_wbuf_write_nolock()
819 err = ubifs_leb_write(c, wbuf->lnum, wbuf->buf, wbuf->offs, in ubifs_wbuf_write_nolock()
824 wbuf->offs += wbuf->size; in ubifs_wbuf_write_nolock()
828 } else if (wbuf->offs & (c->max_write_size - 1)) { in ubifs_wbuf_write_nolock()
837 wbuf->size, wbuf->lnum, wbuf->offs); in ubifs_wbuf_write_nolock()
838 err = ubifs_leb_write(c, wbuf->lnum, buf, wbuf->offs, in ubifs_wbuf_write_nolock()
843 wbuf->offs += wbuf->size; in ubifs_wbuf_write_nolock()
860 wbuf->offs); in ubifs_wbuf_write_nolock()
866 wbuf->offs, m); in ubifs_wbuf_write_nolock()
869 wbuf->offs += m; in ubifs_wbuf_write_nolock()
887 err = ubifs_leb_write(c, wbuf->lnum, wbuf->buf, wbuf->offs, n); in ubifs_wbuf_write_nolock()
890 wbuf->offs += n; in ubifs_wbuf_write_nolock()
910 if (c->leb_size - wbuf->offs >= c->max_write_size) in ubifs_wbuf_write_nolock()
913 wbuf->size = c->leb_size - wbuf->offs; in ubifs_wbuf_write_nolock()
921 int free = c->leb_size - wbuf->offs - wbuf->used; in ubifs_wbuf_write_nolock()
935 len, wbuf->lnum, wbuf->offs, err); in ubifs_wbuf_write_nolock()
958 int offs, int hmac_offs) in ubifs_write_node_hmac() argument
963 lnum, offs, dbg_ntype(((struct ubifs_ch *)buf)->node_type), len, in ubifs_write_node_hmac()
965 ubifs_assert(c, lnum >= 0 && lnum < c->leb_cnt && offs >= 0); in ubifs_write_node_hmac()
966 ubifs_assert(c, offs % c->min_io_size == 0 && offs < c->leb_size); in ubifs_write_node_hmac()
977 err = ubifs_leb_write(c, lnum, buf, offs, buf_len); in ubifs_write_node_hmac()
999 int offs) in ubifs_write_node() argument
1001 return ubifs_write_node_hmac(c, buf, len, lnum, offs, -1); in ubifs_write_node()
1020 int lnum, int offs) in ubifs_read_node_wbuf() argument
1026 dbg_io("LEB %d:%d, %s, length %d, jhead %s", lnum, offs, in ubifs_read_node_wbuf()
1028 ubifs_assert(c, wbuf && lnum >= 0 && lnum < c->leb_cnt && offs >= 0); in ubifs_read_node_wbuf()
1029 ubifs_assert(c, !(offs & 7) && offs < c->leb_size); in ubifs_read_node_wbuf()
1033 overlap = (lnum == wbuf->lnum && offs + len > wbuf->offs); in ubifs_read_node_wbuf()
1037 return ubifs_read_node(c, buf, type, len, lnum, offs); in ubifs_read_node_wbuf()
1041 rlen = wbuf->offs - offs; in ubifs_read_node_wbuf()
1046 memcpy(buf + rlen, wbuf->buf + offs + rlen - wbuf->offs, len - rlen); in ubifs_read_node_wbuf()
1051 err = ubifs_leb_read(c, lnum, buf, offs, rlen, 0); in ubifs_read_node_wbuf()
1062 err = ubifs_check_node(c, buf, len, lnum, offs, 0, 0); in ubifs_read_node_wbuf()
1077 ubifs_err(c, "bad node at LEB %d:%d", lnum, offs); in ubifs_read_node_wbuf()
1097 int lnum, int offs) in ubifs_read_node() argument
1102 dbg_io("LEB %d:%d, %s, length %d", lnum, offs, dbg_ntype(type), len); in ubifs_read_node()
1103 ubifs_assert(c, lnum >= 0 && lnum < c->leb_cnt && offs >= 0); in ubifs_read_node()
1104 ubifs_assert(c, len >= UBIFS_CH_SZ && offs + len <= c->leb_size); in ubifs_read_node()
1105 ubifs_assert(c, !(offs & 7) && offs < c->leb_size); in ubifs_read_node()
1108 err = ubifs_leb_read(c, lnum, buf, offs, len, 0); in ubifs_read_node()
1118 err = ubifs_check_node(c, buf, len, lnum, offs, 0, 0); in ubifs_read_node()
1134 offs, ubi_is_mapped(c->ubi, lnum)); in ubifs_read_node()
1167 wbuf->lnum = wbuf->offs = -1; in ubifs_wbuf_init()