Lines Matching refs:buf
44 static int is_empty(void *buf, int len) in is_empty() argument
46 uint8_t *p = buf; in is_empty()
77 void *sbuf, *buf; in get_master_node() local
89 buf = sbuf; in get_master_node()
92 struct ubifs_ch *ch = buf; in get_master_node()
97 buf += sz; in get_master_node()
105 buf -= sz; in get_master_node()
107 ret = ubifs_scan_a_node(c, buf, len, lnum, offs, 1); in get_master_node()
111 buf -= sz; in get_master_node()
113 ret = ubifs_scan_a_node(c, buf, len, lnum, offs, 1); in get_master_node()
123 struct ubifs_ch *ch = buf; in get_master_node()
128 *mst = buf; in get_master_node()
130 buf += sz; in get_master_node()
136 if (!is_empty(buf, min_t(int, len, sz))) { in get_master_node()
137 *cor = buf; in get_master_node()
141 buf += sz; in get_master_node()
146 if (!is_empty(buf, len)) in get_master_node()
349 static int is_last_write(const struct ubifs_info *c, void *buf, int offs) in is_last_write() argument
357 p = buf + check_len; in is_last_write()
377 p = buf + empty_offs - offs; in is_last_write()
397 static void clean_buf(const struct ubifs_info *c, void **buf, int lnum, in clean_buf() argument
406 memset(*buf, 0xff, c->leb_size - *offs); in clean_buf()
413 ubifs_pad(c, *buf, pad_len); in clean_buf()
415 *buf += pad_len; in clean_buf()
417 memset(*buf, 0xff, c->leb_size - empty_offs); in clean_buf()
431 static int no_more_nodes(const struct ubifs_info *c, void *buf, int len, in no_more_nodes() argument
437 struct ubifs_ch *ch = buf; in no_more_nodes()
452 buf += skip; in no_more_nodes()
455 struct ubifs_ch *ch = buf; in no_more_nodes()
460 ret = ubifs_scan_a_node(c, buf, len, lnum, offs, 1); in no_more_nodes()
477 buf += 8; in no_more_nodes()
529 err = ubi_read(c->ubi, lnum, sleb->buf, 0, in fix_unclean_leb()
539 void *buf = sleb->buf + len - pad_len; in fix_unclean_leb() local
541 ubifs_pad(c, buf, pad_len); in fix_unclean_leb()
544 err = ubi_leb_change(c->ubi, lnum, sleb->buf, len, in fix_unclean_leb()
602 void *buf = sbuf + offs; in ubifs_recover_leb() local
625 ret = ubifs_scan_a_node(c, buf, len, lnum, offs, quiet); in ubifs_recover_leb()
629 struct ubifs_ch *ch = buf; in ubifs_recover_leb()
632 err = ubifs_add_snod(c, sleb, buf, offs); in ubifs_recover_leb()
637 buf += node_len; in ubifs_recover_leb()
645 buf += ret; in ubifs_recover_leb()
651 if (!is_empty(buf, len)) { in ubifs_recover_leb()
652 if (!is_last_write(c, buf, offs)) in ubifs_recover_leb()
654 clean_buf(c, &buf, lnum, &offs, &len); in ubifs_recover_leb()
662 if (is_last_write(c, buf, offs)) { in ubifs_recover_leb()
663 clean_buf(c, &buf, lnum, &offs, &len); in ubifs_recover_leb()
670 if (no_more_nodes(c, buf, len, lnum, offs)) { in ubifs_recover_leb()
671 clean_buf(c, &buf, lnum, &offs, &len); in ubifs_recover_leb()
697 if (!empty_chkd && !is_empty(buf, len)) { in ubifs_recover_leb()
698 if (is_last_write(c, buf, offs)) { in ubifs_recover_leb()
699 clean_buf(c, &buf, lnum, &offs, &len); in ubifs_recover_leb()
710 buf = sbuf + offs; in ubifs_recover_leb()
712 clean_buf(c, &buf, lnum, &offs, &len); in ubifs_recover_leb()
717 clean_buf(c, &buf, lnum, &offs, &len); in ubifs_recover_leb()
732 ubifs_scanned_corruption(c, lnum, offs, buf); in ubifs_recover_leb()
954 void *buf = sbuf; in clean_an_unclean_leb() local
966 err = ubi_read(c->ubi, lnum, buf, offs, len); in clean_an_unclean_leb()
976 ret = ubifs_scan_a_node(c, buf, len, lnum, offs, quiet); in clean_an_unclean_leb()
980 struct ubifs_ch *ch = buf; in clean_an_unclean_leb()
985 buf += node_len; in clean_an_unclean_leb()
993 buf += ret; in clean_an_unclean_leb()
1010 ubifs_scanned_corruption(c, lnum, offs, buf); in clean_an_unclean_leb()
1020 buf = c->sbuf + len - pad_len; in clean_an_unclean_leb()
1021 ubifs_pad(c, buf, pad_len); in clean_an_unclean_leb()