Lines Matching refs:offs

96 int ubifs_leb_read(const struct ubifs_info *c, int lnum, void *buf, int offs,  in ubifs_leb_read()  argument
101 err = ubi_read(c->ubi, lnum, buf, offs, len); in ubifs_leb_read()
108 len, lnum, offs, err); in ubifs_leb_read()
114 int ubifs_leb_write(struct ubifs_info *c, int lnum, const void *buf, int offs, in ubifs_leb_write() argument
123 err = ubi_leb_write(c->ubi, lnum, buf, offs, len); in ubifs_leb_write()
126 err = dbg_leb_write(c, lnum, buf, offs, len); in ubifs_leb_write()
130 len, lnum, offs, err); in ubifs_leb_write()
243 int offs, int quiet, int must_chk_crc) in ubifs_check_node() argument
249 ubifs_assert(lnum >= 0 && lnum < c->leb_cnt && offs >= 0); in ubifs_check_node()
250 ubifs_assert(!(offs & 7) && offs < c->leb_size); in ubifs_check_node()
269 if (node_len + offs > c->leb_size) in ubifs_check_node()
300 ubifs_err(c, "bad node at LEB %d:%d", lnum, offs); in ubifs_check_node()
513 wbuf->lnum, wbuf->offs, wbuf->used, dbg_jhead(wbuf->jhead)); in ubifs_wbuf_sync_nolock()
515 ubifs_assert(wbuf->offs + wbuf->size <= c->leb_size); in ubifs_wbuf_sync_nolock()
520 if (c->leb_size - wbuf->offs >= c->max_write_size) in ubifs_wbuf_sync_nolock()
521 ubifs_assert(!((wbuf->offs + wbuf->size) % c->max_write_size)); in ubifs_wbuf_sync_nolock()
534 err = ubifs_leb_write(c, wbuf->lnum, wbuf->buf, wbuf->offs, sync_len); in ubifs_wbuf_sync_nolock()
539 wbuf->offs += sync_len; in ubifs_wbuf_sync_nolock()
550 if (c->leb_size - wbuf->offs < c->max_write_size) in ubifs_wbuf_sync_nolock()
551 wbuf->size = c->leb_size - wbuf->offs; in ubifs_wbuf_sync_nolock()
552 else if (wbuf->offs & (c->max_write_size - 1)) in ubifs_wbuf_sync_nolock()
553 wbuf->size = ALIGN(wbuf->offs, c->max_write_size) - wbuf->offs; in ubifs_wbuf_sync_nolock()
563 c->leb_size - wbuf->offs, dirt); in ubifs_wbuf_sync_nolock()
577 int ubifs_wbuf_seek_nolock(struct ubifs_wbuf *wbuf, int lnum, int offs) in ubifs_wbuf_seek_nolock() argument
581 dbg_io("LEB %d:%d, jhead %s", lnum, offs, dbg_jhead(wbuf->jhead)); in ubifs_wbuf_seek_nolock()
583 ubifs_assert(offs >= 0 && offs <= c->leb_size); in ubifs_wbuf_seek_nolock()
584 ubifs_assert(offs % c->min_io_size == 0 && !(offs & 7)); in ubifs_wbuf_seek_nolock()
590 wbuf->offs = offs; in ubifs_wbuf_seek_nolock()
591 if (c->leb_size - wbuf->offs < c->max_write_size) in ubifs_wbuf_seek_nolock()
592 wbuf->size = c->leb_size - wbuf->offs; in ubifs_wbuf_seek_nolock()
593 else if (wbuf->offs & (c->max_write_size - 1)) in ubifs_wbuf_seek_nolock()
594 wbuf->size = ALIGN(wbuf->offs, c->max_write_size) - wbuf->offs; in ubifs_wbuf_seek_nolock()
692 dbg_jhead(wbuf->jhead), wbuf->lnum, wbuf->offs + wbuf->used); in ubifs_wbuf_write_nolock()
694 ubifs_assert(wbuf->offs >= 0 && wbuf->offs % c->min_io_size == 0); in ubifs_wbuf_write_nolock()
695 ubifs_assert(!(wbuf->offs & 7) && wbuf->offs <= c->leb_size); in ubifs_wbuf_write_nolock()
703 if (c->leb_size - wbuf->offs >= c->max_write_size) in ubifs_wbuf_write_nolock()
704 ubifs_assert(!((wbuf->offs + wbuf->size) % c->max_write_size)); in ubifs_wbuf_write_nolock()
706 if (c->leb_size - wbuf->offs - wbuf->used < aligned_len) { in ubifs_wbuf_write_nolock()
725 dbg_jhead(wbuf->jhead), wbuf->lnum, wbuf->offs); in ubifs_wbuf_write_nolock()
727 wbuf->offs, wbuf->size); in ubifs_wbuf_write_nolock()
732 wbuf->offs += wbuf->size; in ubifs_wbuf_write_nolock()
733 if (c->leb_size - wbuf->offs >= c->max_write_size) in ubifs_wbuf_write_nolock()
736 wbuf->size = c->leb_size - wbuf->offs; in ubifs_wbuf_write_nolock()
760 dbg_jhead(wbuf->jhead), wbuf->lnum, wbuf->offs); in ubifs_wbuf_write_nolock()
762 err = ubifs_leb_write(c, wbuf->lnum, wbuf->buf, wbuf->offs, in ubifs_wbuf_write_nolock()
767 wbuf->offs += wbuf->size; in ubifs_wbuf_write_nolock()
771 } else if (wbuf->offs & (c->max_write_size - 1)) { in ubifs_wbuf_write_nolock()
780 wbuf->size, wbuf->lnum, wbuf->offs); in ubifs_wbuf_write_nolock()
781 err = ubifs_leb_write(c, wbuf->lnum, buf, wbuf->offs, in ubifs_wbuf_write_nolock()
786 wbuf->offs += wbuf->size; in ubifs_wbuf_write_nolock()
802 wbuf->offs); in ubifs_wbuf_write_nolock()
804 wbuf->offs, n); in ubifs_wbuf_write_nolock()
807 wbuf->offs += n; in ubifs_wbuf_write_nolock()
822 if (c->leb_size - wbuf->offs >= c->max_write_size) in ubifs_wbuf_write_nolock()
825 wbuf->size = c->leb_size - wbuf->offs; in ubifs_wbuf_write_nolock()
833 int free = c->leb_size - wbuf->offs - wbuf->used; in ubifs_wbuf_write_nolock()
847 len, wbuf->lnum, wbuf->offs, err); in ubifs_wbuf_write_nolock()
869 int offs) in ubifs_write_node() argument
874 lnum, offs, dbg_ntype(((struct ubifs_ch *)buf)->node_type), len, in ubifs_write_node()
876 ubifs_assert(lnum >= 0 && lnum < c->leb_cnt && offs >= 0); in ubifs_write_node()
877 ubifs_assert(offs % c->min_io_size == 0 && offs < c->leb_size); in ubifs_write_node()
885 err = ubifs_leb_write(c, lnum, buf, offs, buf_len); in ubifs_write_node()
909 int lnum, int offs) in ubifs_read_node_wbuf() argument
915 dbg_io("LEB %d:%d, %s, length %d, jhead %s", lnum, offs, in ubifs_read_node_wbuf()
917 ubifs_assert(wbuf && lnum >= 0 && lnum < c->leb_cnt && offs >= 0); in ubifs_read_node_wbuf()
918 ubifs_assert(!(offs & 7) && offs < c->leb_size); in ubifs_read_node_wbuf()
922 overlap = (lnum == wbuf->lnum && offs + len > wbuf->offs); in ubifs_read_node_wbuf()
926 return ubifs_read_node(c, buf, type, len, lnum, offs); in ubifs_read_node_wbuf()
930 rlen = wbuf->offs - offs; in ubifs_read_node_wbuf()
935 memcpy(buf + rlen, wbuf->buf + offs + rlen - wbuf->offs, len - rlen); in ubifs_read_node_wbuf()
940 err = ubifs_leb_read(c, lnum, buf, offs, rlen, 0); in ubifs_read_node_wbuf()
951 err = ubifs_check_node(c, buf, lnum, offs, 0, 0); in ubifs_read_node_wbuf()
966 ubifs_err(c, "bad node at LEB %d:%d", lnum, offs); in ubifs_read_node_wbuf()
986 int lnum, int offs) in ubifs_read_node() argument
991 dbg_io("LEB %d:%d, %s, length %d", lnum, offs, dbg_ntype(type), len); in ubifs_read_node()
992 ubifs_assert(lnum >= 0 && lnum < c->leb_cnt && offs >= 0); in ubifs_read_node()
993 ubifs_assert(len >= UBIFS_CH_SZ && offs + len <= c->leb_size); in ubifs_read_node()
994 ubifs_assert(!(offs & 7) && offs < c->leb_size); in ubifs_read_node()
997 err = ubifs_leb_read(c, lnum, buf, offs, len, 0); in ubifs_read_node()
1007 err = ubifs_check_node(c, buf, lnum, offs, 0, 0); in ubifs_read_node()
1023 offs, ubi_is_mapped(c->ubi, lnum)); in ubifs_read_node()
1056 wbuf->lnum = wbuf->offs = -1; in ubifs_wbuf_init()