Lines Matching refs:len
62 static int is_empty(void *buf, int len) in is_empty() argument
67 for (i = 0; i < len; i++) in is_empty()
81 static int first_non_ff(void *buf, int len) in first_non_ff() argument
86 for (i = 0; i < len; i++) in first_non_ff()
113 int err, offs, len; in get_master_node() local
127 len = c->leb_size; in get_master_node()
135 len -= sz; in get_master_node()
143 len += sz; in get_master_node()
144 ret = ubifs_scan_a_node(c, buf, len, lnum, offs, 1); in get_master_node()
149 len += sz; in get_master_node()
150 ret = ubifs_scan_a_node(c, buf, len, lnum, offs, 1); in get_master_node()
168 len -= sz; in get_master_node()
173 if (!is_empty(buf, min_t(int, len, sz))) { in get_master_node()
179 len -= sz; in get_master_node()
183 if (!is_empty(buf, len)) in get_master_node()
441 int *offs, int *len) in clean_buf() argument
454 *len -= pad_len; in clean_buf()
470 static int no_more_nodes(const struct ubifs_info *c, void *buf, int len, in no_more_nodes() argument
474 int skip, dlen = le32_to_cpu(ch->len); in no_more_nodes()
478 if (is_empty(buf + skip, len - skip)) in no_more_nodes()
491 if (is_empty(buf + skip, len - skip)) in no_more_nodes()
514 endpt = snod->offs + snod->len; in fix_unclean_leb()
540 int len = ALIGN(endpt, c->min_io_size); in fix_unclean_leb() local
549 if (len > endpt) { in fix_unclean_leb()
550 int pad_len = len - ALIGN(endpt, 8); in fix_unclean_leb()
553 void *buf = sleb->buf + len - pad_len; in fix_unclean_leb()
558 err = ubifs_leb_change(c, lnum, sleb->buf, len); in fix_unclean_leb()
637 int ret = 0, err, len = c->leb_size - offs, start = offs, min_io_unit; in ubifs_recover_leb() local
648 ubifs_assert(len >= 8); in ubifs_recover_leb()
649 while (len >= 8) { in ubifs_recover_leb()
651 lnum, offs, len); in ubifs_recover_leb()
659 ret = ubifs_scan_a_node(c, buf, len, lnum, offs, 1); in ubifs_recover_leb()
668 node_len = ALIGN(le32_to_cpu(ch->len), 8); in ubifs_recover_leb()
671 len -= node_len; in ubifs_recover_leb()
676 len -= ret; in ubifs_recover_leb()
695 if (!no_more_nodes(c, buf, len, lnum, offs)) in ubifs_recover_leb()
697 } else if (!is_empty(buf, len)) { in ubifs_recover_leb()
699 int corruption = first_non_ff(buf, len); in ubifs_recover_leb()
778 len = c->leb_size - offs; in ubifs_recover_leb()
780 clean_buf(c, &buf, lnum, &offs, &len); in ubifs_recover_leb()
792 ubifs_scan_a_node(c, buf, len, lnum, offs, 0); in ubifs_recover_leb()
926 int len = c->max_write_size, err; in recover_head() local
928 if (offs + len > c->leb_size) in recover_head()
929 len = c->leb_size - offs; in recover_head()
931 if (!len) in recover_head()
935 err = ubifs_leb_read(c, lnum, sbuf, offs, len, 1); in recover_head()
936 if (err || !is_empty(sbuf, len)) { in recover_head()
997 int err, lnum = ucleb->lnum, offs = 0, len = ucleb->endpt, quiet = 1; in clean_an_unclean_leb() local
1000 dbg_rcvry("LEB %d len %d", lnum, len); in clean_an_unclean_leb()
1002 if (len == 0) { in clean_an_unclean_leb()
1007 err = ubifs_leb_read(c, lnum, buf, offs, len, 0); in clean_an_unclean_leb()
1011 while (len >= 8) { in clean_an_unclean_leb()
1017 ret = ubifs_scan_a_node(c, buf, len, lnum, offs, quiet); in clean_an_unclean_leb()
1024 node_len = ALIGN(le32_to_cpu(ch->len), 8); in clean_an_unclean_leb()
1027 len -= node_len; in clean_an_unclean_leb()
1035 len -= ret; in clean_an_unclean_leb()
1056 len = ALIGN(ucleb->endpt, c->min_io_size); in clean_an_unclean_leb()
1057 if (len > ucleb->endpt) { in clean_an_unclean_leb()
1058 int pad_len = len - ALIGN(ucleb->endpt, 8); in clean_an_unclean_leb()
1061 buf = c->sbuf + len - pad_len; in clean_an_unclean_leb()
1067 err = ubifs_leb_change(c, lnum, sbuf, len); in clean_an_unclean_leb()
1419 int err, lnum, offs, len; in fix_size_in_place() local
1442 len = le32_to_cpu(ino->ch.len); in fix_size_in_place()
1443 crc = crc32(UBIFS_CRC32_INIT, (void *)ino + 8, len - 8); in fix_size_in_place()
1447 len = c->leb_size - 1; in fix_size_in_place()
1448 while (p[len] == 0xff) in fix_size_in_place()
1449 len -= 1; in fix_size_in_place()
1450 len = ALIGN(len + 1, c->min_io_size); in fix_size_in_place()
1452 err = ubifs_leb_change(c, lnum, c->sbuf, len); in fix_size_in_place()