Lines Matching refs:len
50 static int is_empty(void *buf, int len) in is_empty() argument
55 for (i = 0; i < len; i++) in is_empty()
69 static int first_non_ff(void *buf, int len) in first_non_ff() argument
74 for (i = 0; i < len; i++) in first_non_ff()
101 int err, offs, len; in get_master_node() local
115 len = c->leb_size; in get_master_node()
123 len -= sz; in get_master_node()
131 len += sz; in get_master_node()
132 ret = ubifs_scan_a_node(c, buf, len, lnum, offs, 1); in get_master_node()
137 len += sz; in get_master_node()
138 ret = ubifs_scan_a_node(c, buf, len, lnum, offs, 1); in get_master_node()
156 len -= sz; in get_master_node()
161 if (!is_empty(buf, min_t(int, len, sz))) { in get_master_node()
167 len -= sz; in get_master_node()
171 if (!is_empty(buf, len)) in get_master_node()
430 int *offs, int *len) in clean_buf() argument
442 *len -= pad_len; in clean_buf()
458 static int no_more_nodes(const struct ubifs_info *c, void *buf, int len, in no_more_nodes() argument
462 int skip, dlen = le32_to_cpu(ch->len); in no_more_nodes()
466 if (is_empty(buf + skip, len - skip)) in no_more_nodes()
479 if (is_empty(buf + skip, len - skip)) in no_more_nodes()
502 endpt = snod->offs + snod->len; in fix_unclean_leb()
528 int len = ALIGN(endpt, c->min_io_size); in fix_unclean_leb() local
537 if (len > endpt) { in fix_unclean_leb()
538 int pad_len = len - ALIGN(endpt, 8); in fix_unclean_leb()
541 void *buf = sleb->buf + len - pad_len; in fix_unclean_leb()
546 err = ubifs_leb_change(c, lnum, sleb->buf, len); in fix_unclean_leb()
625 int ret = 0, err, len = c->leb_size - offs, start = offs, min_io_unit; in ubifs_recover_leb() local
636 ubifs_assert(c, len >= 8); in ubifs_recover_leb()
637 while (len >= 8) { in ubifs_recover_leb()
639 lnum, offs, len); in ubifs_recover_leb()
647 ret = ubifs_scan_a_node(c, buf, len, lnum, offs, 1); in ubifs_recover_leb()
656 node_len = ALIGN(le32_to_cpu(ch->len), 8); in ubifs_recover_leb()
659 len -= node_len; in ubifs_recover_leb()
664 len -= ret; in ubifs_recover_leb()
683 if (!no_more_nodes(c, buf, len, lnum, offs)) in ubifs_recover_leb()
685 } else if (!is_empty(buf, len)) { in ubifs_recover_leb()
687 int corruption = first_non_ff(buf, len); in ubifs_recover_leb()
766 len = c->leb_size - offs; in ubifs_recover_leb()
768 clean_buf(c, &buf, lnum, &offs, &len); in ubifs_recover_leb()
780 ubifs_scan_a_node(c, buf, len, lnum, offs, 0); in ubifs_recover_leb()
914 int len = c->max_write_size, err; in recover_head() local
916 if (offs + len > c->leb_size) in recover_head()
917 len = c->leb_size - offs; in recover_head()
919 if (!len) in recover_head()
923 err = ubifs_leb_read(c, lnum, sbuf, offs, len, 1); in recover_head()
924 if (err || !is_empty(sbuf, len)) { in recover_head()
985 int err, lnum = ucleb->lnum, offs = 0, len = ucleb->endpt, quiet = 1; in clean_an_unclean_leb() local
988 dbg_rcvry("LEB %d len %d", lnum, len); in clean_an_unclean_leb()
990 if (len == 0) { in clean_an_unclean_leb()
995 err = ubifs_leb_read(c, lnum, buf, offs, len, 0); in clean_an_unclean_leb()
999 while (len >= 8) { in clean_an_unclean_leb()
1005 ret = ubifs_scan_a_node(c, buf, len, lnum, offs, quiet); in clean_an_unclean_leb()
1012 node_len = ALIGN(le32_to_cpu(ch->len), 8); in clean_an_unclean_leb()
1015 len -= node_len; in clean_an_unclean_leb()
1023 len -= ret; in clean_an_unclean_leb()
1044 len = ALIGN(ucleb->endpt, c->min_io_size); in clean_an_unclean_leb()
1045 if (len > ucleb->endpt) { in clean_an_unclean_leb()
1046 int pad_len = len - ALIGN(ucleb->endpt, 8); in clean_an_unclean_leb()
1049 buf = c->sbuf + len - pad_len; in clean_an_unclean_leb()
1055 err = ubifs_leb_change(c, lnum, sbuf, len); in clean_an_unclean_leb()
1407 int err, lnum, offs, len; in fix_size_in_place() local
1430 len = le32_to_cpu(ino->ch.len); in fix_size_in_place()
1431 crc = crc32(UBIFS_CRC32_INIT, (void *)ino + 8, len - 8); in fix_size_in_place()
1435 len = c->leb_size - 1; in fix_size_in_place()
1436 while (p[len] == 0xff) in fix_size_in_place()
1437 len -= 1; in fix_size_in_place()
1438 len = ALIGN(len + 1, c->min_io_size); in fix_size_in_place()
1440 err = ubifs_leb_change(c, lnum, c->sbuf, len); in fix_size_in_place()