Lines Matching refs:len
49 * @len: length of buffer
54 static int is_empty(void *buf, int len)
59 for (i = 0; i < len; i++) {
70 * @len: length of buffer
75 static int first_non_ff(void *buf, int len)
80 for (i = 0; i < len; i++) {
108 int err, offs, len;
124 len = c->leb_size;
133 len -= sz;
141 len += sz;
142 ret = ubifs_scan_a_node(c, buf, len, lnum, offs, 1);
147 len += sz;
148 ret = ubifs_scan_a_node(c, buf, len, lnum, offs, 1);
168 len -= sz;
173 if (!is_empty(buf, min_t(int, len, sz))) {
179 len -= sz;
183 if (!is_empty(buf, len)) {
447 * @len: length of buffer
450 * sets empty space to all 0xff. @buf, @offs and @len are updated to the next
453 static void clean_buf(const struct ubifs_info *c, void **buf, int lnum, int *offs, int *len)
465 *len -= pad_len;
473 * @len: length of buffer
481 static int no_more_nodes(const struct ubifs_info *c, void *buf, int len, int lnum, int offs)
484 int skip, dlen = le32_to_cpu(ch->len);
488 if (is_empty(buf + skip, len - skip)) {
495 if (ubifs_check_node(c, buf, len, lnum, offs, 1, 0) != -EUCLEAN) {
502 if (is_empty(buf + skip, len - skip)) {
524 endpt = snod->offs + snod->len;
550 int len = ALIGN(endpt, c->min_io_size);
559 if (len > endpt) {
560 int pad_len = len - ALIGN(endpt, RECOVERY_EIGHT);
562 void *buf = sleb->buf + len - pad_len;
567 err = ubifs_leb_change(c, lnum, sleb->buf, len);
643 int ret = 0, err, len = c->leb_size - offs, start = offs, min_io_unit;
655 ubifs_assert(c, len >= RECOVERY_EIGHT);
656 while (len >= RECOVERY_EIGHT) {
657 dbg_scan("look at LEB %d:%d (%d bytes left)", lnum, offs, len);
665 ret = ubifs_scan_a_node(c, buf, len, lnum, offs, 1);
675 node_len = ALIGN(le32_to_cpu(ch->len), RECOVERY_EIGHT);
678 len -= node_len;
683 len -= ret;
686 if (ubifs_check_node(c, buf, len, lnum, offs, 1, 1) == -EUCLEAN &&
687 !no_more_nodes(c, buf, len, lnum, offs)) {
698 skip = ALIGN(offs + le32_to_cpu(ch->len), c->max_write_size) - offs;
699 memset(buf + skip, 0xff, len - skip);
705 if (!is_empty(buf, len) && !is_last_write(c, buf, offs)) {
713 memset(buf, 0xff, len);
732 if (!no_more_nodes(c, buf, len, lnum, offs)) {
735 } else if (!is_empty(buf, len)) {
737 int corruption = first_non_ff(buf, len);
817 len = c->leb_size - offs;
819 clean_buf(c, &buf, lnum, &offs, &len);
832 ubifs_scan_a_node(c, buf, len, lnum, offs, 0);
965 int len = c->max_write_size, err;
967 if (offs + len > c->leb_size) {
968 len = c->leb_size - offs;
971 if (!len) {
976 err = ubifs_leb_read(c, lnum, sbuf, offs, len, 1);
977 if (err || !is_empty(sbuf, len)) {
1040 int err, lnum = ucleb->lnum, offs = 0, len = ucleb->endpt, quiet = 1;
1043 dbg_rcvry("LEB %d len %d", lnum, len);
1045 if (len == 0) {
1050 err = ubifs_leb_read(c, lnum, buf, offs, len, 0);
1055 while (len >= RECOVERY_EIGHT) {
1061 ret = ubifs_scan_a_node(c, buf, len, lnum, offs, quiet);
1067 node_len = ALIGN(le32_to_cpu(ch->len), RECOVERY_EIGHT);
1070 len -= node_len;
1078 len -= ret;
1098 len = ALIGN(ucleb->endpt, c->min_io_size);
1099 if (len > ucleb->endpt) {
1100 int pad_len = len - ALIGN(ucleb->endpt, RECOVERY_EIGHT);
1102 buf = c->sbuf + len - pad_len;
1108 err = ubifs_leb_change(c, lnum, sbuf, len);
1476 int err, lnum, offs, len;
1502 len = le32_to_cpu(ino->ch.len);
1503 crc = crc32(UBIFS_CRC32_INIT, (void *)ino + RECOVERY_EIGHT, len - RECOVERY_EIGHT);
1507 len = c->leb_size - 1;
1508 while (p[len] == 0xff) {
1509 len -= 1;
1511 len = ALIGN(len + 1, c->min_io_size);
1513 err = ubifs_leb_change(c, lnum, c->sbuf, len);