Lines Matching +full:spi +full:- +full:crc

2  * JFFS2 -- Journalling Flash File System, Version 2.
4 * Copyright © 2004 Ferenc Havasi <havasi@inf.u-szeged.hu>,
5 * Zoltan Sogor <weth@inf.u-szeged.hu>,
6 * Patrik Kluba <pajko@halom.u-szeged.hu>,
28 uint32_t sum_size = min_t(uint32_t, c->sector_size, MAX_SUMMARY_SIZE); in jffs2_sum_init()
30 c->summary = kzalloc(sizeof(struct jffs2_summary), GFP_KERNEL); in jffs2_sum_init()
32 if (!c->summary) { in jffs2_sum_init()
34 return -ENOMEM; in jffs2_sum_init()
37 c->summary->sum_buf = kmalloc(sum_size, GFP_KERNEL); in jffs2_sum_init()
39 if (!c->summary->sum_buf) { in jffs2_sum_init()
41 kfree(c->summary); in jffs2_sum_init()
42 return -ENOMEM; in jffs2_sum_init()
54 jffs2_sum_disable_collecting(c->summary); in jffs2_sum_exit()
56 kfree(c->summary->sum_buf); in jffs2_sum_exit()
57 c->summary->sum_buf = NULL; in jffs2_sum_exit()
59 kfree(c->summary); in jffs2_sum_exit()
60 c->summary = NULL; in jffs2_sum_exit()
65 if (!s->sum_list_head) in jffs2_sum_add_mem()
66 s->sum_list_head = (union jffs2_sum_mem *) item; in jffs2_sum_add_mem()
67 if (s->sum_list_tail) in jffs2_sum_add_mem()
68 s->sum_list_tail->u.next = (union jffs2_sum_mem *) item; in jffs2_sum_add_mem()
69 s->sum_list_tail = (union jffs2_sum_mem *) item; in jffs2_sum_add_mem()
71 switch (je16_to_cpu(item->u.nodetype)) { in jffs2_sum_add_mem()
73 s->sum_size += JFFS2_SUMMARY_INODE_SIZE; in jffs2_sum_add_mem()
74 s->sum_num++; in jffs2_sum_add_mem()
76 je32_to_cpu(item->i.inode)); in jffs2_sum_add_mem()
79 s->sum_size += JFFS2_SUMMARY_DIRENT_SIZE(item->d.nsize); in jffs2_sum_add_mem()
80 s->sum_num++; in jffs2_sum_add_mem()
82 je32_to_cpu(item->d.ino)); in jffs2_sum_add_mem()
86 s->sum_size += JFFS2_SUMMARY_XATTR_SIZE; in jffs2_sum_add_mem()
87 s->sum_num++; in jffs2_sum_add_mem()
89 je32_to_cpu(item->x.xid), je32_to_cpu(item->x.version)); in jffs2_sum_add_mem()
92 s->sum_size += JFFS2_SUMMARY_XREF_SIZE; in jffs2_sum_add_mem()
93 s->sum_num++; in jffs2_sum_add_mem()
99 je16_to_cpu(item->u.nodetype)); in jffs2_sum_add_mem()
111 s->sum_padded += size; in jffs2_sum_add_padding_mem()
121 return -ENOMEM; in jffs2_sum_add_inode_mem()
123 temp->nodetype = ri->nodetype; in jffs2_sum_add_inode_mem()
124 temp->inode = ri->ino; in jffs2_sum_add_inode_mem()
125 temp->version = ri->version; in jffs2_sum_add_inode_mem()
126 temp->offset = cpu_to_je32(ofs); /* relative offset from the beginning of the jeb */ in jffs2_sum_add_inode_mem()
127 temp->totlen = ri->totlen; in jffs2_sum_add_inode_mem()
128 temp->next = NULL; in jffs2_sum_add_inode_mem()
137 kmalloc(sizeof(struct jffs2_sum_dirent_mem) + rd->nsize, GFP_KERNEL); in jffs2_sum_add_dirent_mem()
140 return -ENOMEM; in jffs2_sum_add_dirent_mem()
142 temp->nodetype = rd->nodetype; in jffs2_sum_add_dirent_mem()
143 temp->totlen = rd->totlen; in jffs2_sum_add_dirent_mem()
144 temp->offset = cpu_to_je32(ofs); /* relative from the beginning of the jeb */ in jffs2_sum_add_dirent_mem()
145 temp->pino = rd->pino; in jffs2_sum_add_dirent_mem()
146 temp->version = rd->version; in jffs2_sum_add_dirent_mem()
147 temp->ino = rd->ino; in jffs2_sum_add_dirent_mem()
148 temp->nsize = rd->nsize; in jffs2_sum_add_dirent_mem()
149 temp->type = rd->type; in jffs2_sum_add_dirent_mem()
150 temp->next = NULL; in jffs2_sum_add_dirent_mem()
152 memcpy(temp->name, rd->name, rd->nsize); in jffs2_sum_add_dirent_mem()
164 return -ENOMEM; in jffs2_sum_add_xattr_mem()
166 temp->nodetype = rx->nodetype; in jffs2_sum_add_xattr_mem()
167 temp->xid = rx->xid; in jffs2_sum_add_xattr_mem()
168 temp->version = rx->version; in jffs2_sum_add_xattr_mem()
169 temp->offset = cpu_to_je32(ofs); in jffs2_sum_add_xattr_mem()
170 temp->totlen = rx->totlen; in jffs2_sum_add_xattr_mem()
171 temp->next = NULL; in jffs2_sum_add_xattr_mem()
182 return -ENOMEM; in jffs2_sum_add_xref_mem()
184 temp->nodetype = rr->nodetype; in jffs2_sum_add_xref_mem()
185 temp->offset = cpu_to_je32(ofs); in jffs2_sum_add_xref_mem()
186 temp->next = NULL; in jffs2_sum_add_xref_mem()
197 if (!s->sum_list_head) { in jffs2_sum_clean_collected()
200 while (s->sum_list_head) { in jffs2_sum_clean_collected()
201 temp = s->sum_list_head; in jffs2_sum_clean_collected()
202 s->sum_list_head = s->sum_list_head->u.next; in jffs2_sum_clean_collected()
205 s->sum_list_tail = NULL; in jffs2_sum_clean_collected()
206 s->sum_padded = 0; in jffs2_sum_clean_collected()
207 s->sum_num = 0; in jffs2_sum_clean_collected()
214 s->sum_size = 0; in jffs2_sum_reset_collected()
221 s->sum_size = JFFS2_SUMMARY_NOSUM_SIZE; in jffs2_sum_disable_collecting()
226 return (s->sum_size == JFFS2_SUMMARY_NOSUM_SIZE); in jffs2_sum_is_disabled()
234 c->summary->sum_size, c->summary->sum_num, in jffs2_sum_move_collected()
235 s->sum_size, s->sum_num); in jffs2_sum_move_collected()
237 c->summary->sum_size = s->sum_size; in jffs2_sum_move_collected()
238 c->summary->sum_num = s->sum_num; in jffs2_sum_move_collected()
239 c->summary->sum_padded = s->sum_padded; in jffs2_sum_move_collected()
240 c->summary->sum_list_head = s->sum_list_head; in jffs2_sum_move_collected()
241 c->summary->sum_list_tail = s->sum_list_tail; in jffs2_sum_move_collected()
243 s->sum_list_head = s->sum_list_tail = NULL; in jffs2_sum_move_collected()
254 if (c->summary->sum_size == JFFS2_SUMMARY_NOSUM_SIZE) { in jffs2_sum_add_kvec()
260 jeb = &c->blocks[ofs / c->sector_size]; in jffs2_sum_add_kvec()
261 ofs -= jeb->offset; in jffs2_sum_add_kvec()
263 switch (je16_to_cpu(node->u.nodetype)) { in jffs2_sum_add_kvec()
271 temp->nodetype = node->i.nodetype; in jffs2_sum_add_kvec()
272 temp->inode = node->i.ino; in jffs2_sum_add_kvec()
273 temp->version = node->i.version; in jffs2_sum_add_kvec()
274 temp->offset = cpu_to_je32(ofs); in jffs2_sum_add_kvec()
275 temp->totlen = node->i.totlen; in jffs2_sum_add_kvec()
276 temp->next = NULL; in jffs2_sum_add_kvec()
278 return jffs2_sum_add_mem(c->summary, (union jffs2_sum_mem *)temp); in jffs2_sum_add_kvec()
283 kmalloc(sizeof(struct jffs2_sum_dirent_mem) + node->d.nsize, GFP_KERNEL); in jffs2_sum_add_kvec()
288 temp->nodetype = node->d.nodetype; in jffs2_sum_add_kvec()
289 temp->totlen = node->d.totlen; in jffs2_sum_add_kvec()
290 temp->offset = cpu_to_je32(ofs); in jffs2_sum_add_kvec()
291 temp->pino = node->d.pino; in jffs2_sum_add_kvec()
292 temp->version = node->d.version; in jffs2_sum_add_kvec()
293 temp->ino = node->d.ino; in jffs2_sum_add_kvec()
294 temp->nsize = node->d.nsize; in jffs2_sum_add_kvec()
295 temp->type = node->d.type; in jffs2_sum_add_kvec()
296 temp->next = NULL; in jffs2_sum_add_kvec()
300 memcpy(temp->name,node->d.name,node->d.nsize); in jffs2_sum_add_kvec()
304 memcpy(temp->name,invecs[1].iov_base,node->d.nsize); in jffs2_sum_add_kvec()
312 return jffs2_sum_add_mem(c->summary, (union jffs2_sum_mem *)temp); in jffs2_sum_add_kvec()
321 temp->nodetype = node->x.nodetype; in jffs2_sum_add_kvec()
322 temp->xid = node->x.xid; in jffs2_sum_add_kvec()
323 temp->version = node->x.version; in jffs2_sum_add_kvec()
324 temp->totlen = node->x.totlen; in jffs2_sum_add_kvec()
325 temp->offset = cpu_to_je32(ofs); in jffs2_sum_add_kvec()
326 temp->next = NULL; in jffs2_sum_add_kvec()
328 return jffs2_sum_add_mem(c->summary, (union jffs2_sum_mem *)temp); in jffs2_sum_add_kvec()
335 temp->nodetype = node->r.nodetype; in jffs2_sum_add_kvec()
336 temp->offset = cpu_to_je32(ofs); in jffs2_sum_add_kvec()
337 temp->next = NULL; in jffs2_sum_add_kvec()
339 return jffs2_sum_add_mem(c->summary, (union jffs2_sum_mem *)temp); in jffs2_sum_add_kvec()
344 c->summary->sum_padded += je32_to_cpu(node->u.totlen); in jffs2_sum_add_kvec()
367 return -ENOMEM; in jffs2_sum_add_kvec()
376 if ((ofs & ~3) > c->sector_size - jeb->free_size) { in sum_link_node_ref()
378 jffs2_scan_dirty_space(c, jeb, (ofs & ~3) - (c->sector_size - jeb->free_size)); in sum_link_node_ref()
381 return jffs2_link_node_ref(c, jeb, jeb->offset + ofs, len, ic); in sum_link_node_ref()
384 /* Process the stored summary information - helper function for jffs2_sum_scan_sumnode() */
395 sp = summary->sum; in jffs2_sum_process_sum_data()
397 for (i=0; i<je32_to_cpu(summary->sum_num); i++) { in jffs2_sum_process_sum_data()
407 switch (je16_to_cpu(((struct jffs2_sum_unknown_flash *)sp)->nodetype)) { in jffs2_sum_process_sum_data()
409 struct jffs2_sum_inode_flash *spi; in jffs2_sum_process_sum_data() local
410 spi = sp; in jffs2_sum_process_sum_data()
412 ino = je32_to_cpu(spi->inode); in jffs2_sum_process_sum_data()
414 dbg_summary("Inode at 0x%08x-0x%08x\n", in jffs2_sum_process_sum_data()
415 jeb->offset + je32_to_cpu(spi->offset), in jffs2_sum_process_sum_data()
416 jeb->offset + je32_to_cpu(spi->offset) + je32_to_cpu(spi->totlen)); in jffs2_sum_process_sum_data()
421 return -ENOMEM; in jffs2_sum_process_sum_data()
424 sum_link_node_ref(c, jeb, je32_to_cpu(spi->offset) | REF_UNCHECKED, in jffs2_sum_process_sum_data()
425 PAD(je32_to_cpu(spi->totlen)), ic); in jffs2_sum_process_sum_data()
427 *pseudo_random += je32_to_cpu(spi->version); in jffs2_sum_process_sum_data()
439 dbg_summary("Dirent at 0x%08x-0x%08x\n", in jffs2_sum_process_sum_data()
440 jeb->offset + je32_to_cpu(spd->offset), in jffs2_sum_process_sum_data()
441 jeb->offset + je32_to_cpu(spd->offset) + je32_to_cpu(spd->totlen)); in jffs2_sum_process_sum_data()
445 checkedlen = strnlen(spd->name, spd->nsize); in jffs2_sum_process_sum_data()
448 jeb->offset + in jffs2_sum_process_sum_data()
449 je32_to_cpu(spd->offset)); in jffs2_sum_process_sum_data()
450 return -EIO; in jffs2_sum_process_sum_data()
452 if (checkedlen < spd->nsize) { in jffs2_sum_process_sum_data()
454 jeb->offset + in jffs2_sum_process_sum_data()
455 je32_to_cpu(spd->offset), in jffs2_sum_process_sum_data()
462 return -ENOMEM; in jffs2_sum_process_sum_data()
464 memcpy(&fd->name, spd->name, checkedlen); in jffs2_sum_process_sum_data()
465 fd->name[checkedlen] = 0; in jffs2_sum_process_sum_data()
467 ic = jffs2_scan_make_ino_cache(c, je32_to_cpu(spd->pino)); in jffs2_sum_process_sum_data()
470 return -ENOMEM; in jffs2_sum_process_sum_data()
473 fd->raw = sum_link_node_ref(c, jeb, je32_to_cpu(spd->offset) | REF_UNCHECKED, in jffs2_sum_process_sum_data()
474 PAD(je32_to_cpu(spd->totlen)), ic); in jffs2_sum_process_sum_data()
476 fd->next = NULL; in jffs2_sum_process_sum_data()
477 fd->version = je32_to_cpu(spd->version); in jffs2_sum_process_sum_data()
478 fd->ino = je32_to_cpu(spd->ino); in jffs2_sum_process_sum_data()
479 fd->nhash = full_name_hash(NULL, fd->name, checkedlen); in jffs2_sum_process_sum_data()
480 fd->type = spd->type; in jffs2_sum_process_sum_data()
482 jffs2_add_fd_to_list(c, fd, &ic->scan_dents); in jffs2_sum_process_sum_data()
484 *pseudo_random += je32_to_cpu(spd->version); in jffs2_sum_process_sum_data()
486 sp += JFFS2_SUMMARY_DIRENT_SIZE(spd->nsize); in jffs2_sum_process_sum_data()
496 dbg_summary("xattr at %#08x-%#08x (xid=%u, version=%u)\n", in jffs2_sum_process_sum_data()
497 jeb->offset + je32_to_cpu(spx->offset), in jffs2_sum_process_sum_data()
498 jeb->offset + je32_to_cpu(spx->offset) + je32_to_cpu(spx->totlen), in jffs2_sum_process_sum_data()
499 je32_to_cpu(spx->xid), je32_to_cpu(spx->version)); in jffs2_sum_process_sum_data()
501 xd = jffs2_setup_xattr_datum(c, je32_to_cpu(spx->xid), in jffs2_sum_process_sum_data()
502 je32_to_cpu(spx->version)); in jffs2_sum_process_sum_data()
505 if (xd->version > je32_to_cpu(spx->version)) { in jffs2_sum_process_sum_data()
508 = sum_link_node_ref(c, jeb, je32_to_cpu(spx->offset) | REF_UNCHECKED, in jffs2_sum_process_sum_data()
509 PAD(je32_to_cpu(spx->totlen)), NULL); in jffs2_sum_process_sum_data()
510 raw->next_in_ino = xd->node->next_in_ino; in jffs2_sum_process_sum_data()
511 xd->node->next_in_ino = raw; in jffs2_sum_process_sum_data()
513 xd->version = je32_to_cpu(spx->version); in jffs2_sum_process_sum_data()
514 sum_link_node_ref(c, jeb, je32_to_cpu(spx->offset) | REF_UNCHECKED, in jffs2_sum_process_sum_data()
515 PAD(je32_to_cpu(spx->totlen)), (void *)xd); in jffs2_sum_process_sum_data()
517 *pseudo_random += je32_to_cpu(spx->xid); in jffs2_sum_process_sum_data()
527 dbg_summary("xref at %#08x-%#08x\n", in jffs2_sum_process_sum_data()
528 jeb->offset + je32_to_cpu(spr->offset), in jffs2_sum_process_sum_data()
529 jeb->offset + je32_to_cpu(spr->offset) + in jffs2_sum_process_sum_data()
535 return -ENOMEM; in jffs2_sum_process_sum_data()
537 ref->next = c->xref_temp; in jffs2_sum_process_sum_data()
538 c->xref_temp = ref; in jffs2_sum_process_sum_data()
540 sum_link_node_ref(c, jeb, je32_to_cpu(spr->offset) | REF_UNCHECKED, in jffs2_sum_process_sum_data()
543 *pseudo_random += ref->node->flash_offset; in jffs2_sum_process_sum_data()
550 uint16_t nodetype = je16_to_cpu(((struct jffs2_sum_unknown_flash *)sp)->nodetype); in jffs2_sum_process_sum_data()
553 return -EIO; in jffs2_sum_process_sum_data()
556 c->wasted_size -= jeb->wasted_size; in jffs2_sum_process_sum_data()
557 c->free_size += c->sector_size - jeb->free_size; in jffs2_sum_process_sum_data()
558 c->used_size -= jeb->used_size; in jffs2_sum_process_sum_data()
559 c->dirty_size -= jeb->dirty_size; in jffs2_sum_process_sum_data()
560 jeb->wasted_size = jeb->used_size = jeb->dirty_size = 0; in jffs2_sum_process_sum_data()
561 jeb->free_size = c->sector_size; in jffs2_sum_process_sum_data()
564 return -ENOTRECOVERABLE; in jffs2_sum_process_sum_data()
571 /* Process the summary node - called from jffs2_scan_eraseblock() */
578 uint32_t crc; in jffs2_sum_scan_sumnode() local
580 ofs = c->sector_size - sumsize; in jffs2_sum_scan_sumnode()
583 jeb->offset, jeb->offset + ofs, sumsize); in jffs2_sum_scan_sumnode()
585 /* OK, now check for node validity and CRC */ in jffs2_sum_scan_sumnode()
588 crcnode.totlen = summary->totlen; in jffs2_sum_scan_sumnode()
589 crc = crc32(0, &crcnode, sizeof(crcnode)-4); in jffs2_sum_scan_sumnode()
591 if (je32_to_cpu(summary->hdr_crc) != crc) { in jffs2_sum_scan_sumnode()
592 dbg_summary("Summary node header is corrupt (bad CRC or " in jffs2_sum_scan_sumnode()
597 if (je32_to_cpu(summary->totlen) != sumsize) { in jffs2_sum_scan_sumnode()
602 crc = crc32(0, summary, sizeof(struct jffs2_raw_summary)-8); in jffs2_sum_scan_sumnode()
604 if (je32_to_cpu(summary->node_crc) != crc) { in jffs2_sum_scan_sumnode()
605 dbg_summary("Summary node is corrupt (bad CRC)\n"); in jffs2_sum_scan_sumnode()
609 crc = crc32(0, summary->sum, sumsize - sizeof(struct jffs2_raw_summary)); in jffs2_sum_scan_sumnode()
611 if (je32_to_cpu(summary->sum_crc) != crc) { in jffs2_sum_scan_sumnode()
612 dbg_summary("Summary node data is corrupt (bad CRC)\n"); in jffs2_sum_scan_sumnode()
616 if ( je32_to_cpu(summary->cln_mkr) ) { in jffs2_sum_scan_sumnode()
624 if (je32_to_cpu(summary->cln_mkr) != c->cleanmarker_size) { in jffs2_sum_scan_sumnode()
626 je32_to_cpu(summary->cln_mkr), c->cleanmarker_size); in jffs2_sum_scan_sumnode()
627 if ((ret = jffs2_scan_dirty_space(c, jeb, PAD(je32_to_cpu(summary->cln_mkr))))) in jffs2_sum_scan_sumnode()
629 } else if (jeb->first_node) { in jffs2_sum_scan_sumnode()
631 "(0x%08x)\n", jeb->offset); in jffs2_sum_scan_sumnode()
632 if ((ret = jffs2_scan_dirty_space(c, jeb, PAD(je32_to_cpu(summary->cln_mkr))))) in jffs2_sum_scan_sumnode()
635 jffs2_link_node_ref(c, jeb, jeb->offset | REF_NORMAL, in jffs2_sum_scan_sumnode()
636 je32_to_cpu(summary->cln_mkr), NULL); in jffs2_sum_scan_sumnode()
641 /* -ENOTRECOVERABLE isn't a fatal error -- it means we should do a full in jffs2_sum_scan_sumnode()
643 if (ret == -ENOTRECOVERABLE) in jffs2_sum_scan_sumnode()
655 if (unlikely(jeb->free_size)) { in jffs2_sum_scan_sumnode()
657 jeb->free_size, jeb->offset); in jffs2_sum_scan_sumnode()
658 jeb->wasted_size += jeb->free_size; in jffs2_sum_scan_sumnode()
659 c->wasted_size += jeb->free_size; in jffs2_sum_scan_sumnode()
660 c->free_size -= jeb->free_size; in jffs2_sum_scan_sumnode()
661 jeb->free_size = 0; in jffs2_sum_scan_sumnode()
667 JFFS2_WARNING("Summary node crc error, skipping summary information.\n"); in jffs2_sum_scan_sumnode()
672 /* Write summary data to flash - helper function for jffs2_sum_write_sumnode() */
688 jffs2_sum_disable_collecting(c->summary); in jffs2_sum_write_data()
691 datasize, padsize, jeb->offset); in jffs2_sum_write_data()
692 /* Non-fatal */ in jffs2_sum_write_data()
698 jffs2_sum_disable_collecting(c->summary); in jffs2_sum_write_data()
702 /* Non-fatal */ in jffs2_sum_write_data()
706 memset(c->summary->sum_buf, 0xff, datasize); in jffs2_sum_write_data()
712 isum.hdr_crc = cpu_to_je32(crc32(0, &isum, sizeof(struct jffs2_unknown_node) - 4)); in jffs2_sum_write_data()
713 isum.padded = cpu_to_je32(c->summary->sum_padded); in jffs2_sum_write_data()
714 isum.cln_mkr = cpu_to_je32(c->cleanmarker_size); in jffs2_sum_write_data()
715 isum.sum_num = cpu_to_je32(c->summary->sum_num); in jffs2_sum_write_data()
716 wpage = c->summary->sum_buf; in jffs2_sum_write_data()
718 while (c->summary->sum_num) { in jffs2_sum_write_data()
719 temp = c->summary->sum_list_head; in jffs2_sum_write_data()
721 switch (je16_to_cpu(temp->u.nodetype)) { in jffs2_sum_write_data()
725 sino_ptr->nodetype = temp->i.nodetype; in jffs2_sum_write_data()
726 sino_ptr->inode = temp->i.inode; in jffs2_sum_write_data()
727 sino_ptr->version = temp->i.version; in jffs2_sum_write_data()
728 sino_ptr->offset = temp->i.offset; in jffs2_sum_write_data()
729 sino_ptr->totlen = temp->i.totlen; in jffs2_sum_write_data()
739 sdrnt_ptr->nodetype = temp->d.nodetype; in jffs2_sum_write_data()
740 sdrnt_ptr->totlen = temp->d.totlen; in jffs2_sum_write_data()
741 sdrnt_ptr->offset = temp->d.offset; in jffs2_sum_write_data()
742 sdrnt_ptr->pino = temp->d.pino; in jffs2_sum_write_data()
743 sdrnt_ptr->version = temp->d.version; in jffs2_sum_write_data()
744 sdrnt_ptr->ino = temp->d.ino; in jffs2_sum_write_data()
745 sdrnt_ptr->nsize = temp->d.nsize; in jffs2_sum_write_data()
746 sdrnt_ptr->type = temp->d.type; in jffs2_sum_write_data()
748 memcpy(sdrnt_ptr->name, temp->d.name, in jffs2_sum_write_data()
749 temp->d.nsize); in jffs2_sum_write_data()
751 wpage += JFFS2_SUMMARY_DIRENT_SIZE(temp->d.nsize); in jffs2_sum_write_data()
759 temp = c->summary->sum_list_head; in jffs2_sum_write_data()
760 sxattr_ptr->nodetype = temp->x.nodetype; in jffs2_sum_write_data()
761 sxattr_ptr->xid = temp->x.xid; in jffs2_sum_write_data()
762 sxattr_ptr->version = temp->x.version; in jffs2_sum_write_data()
763 sxattr_ptr->offset = temp->x.offset; in jffs2_sum_write_data()
764 sxattr_ptr->totlen = temp->x.totlen; in jffs2_sum_write_data()
772 temp = c->summary->sum_list_head; in jffs2_sum_write_data()
773 sxref_ptr->nodetype = temp->r.nodetype; in jffs2_sum_write_data()
774 sxref_ptr->offset = temp->r.offset; in jffs2_sum_write_data()
781 if ((je16_to_cpu(temp->u.nodetype) & JFFS2_COMPAT_MASK) in jffs2_sum_write_data()
784 je16_to_cpu(temp->u.nodetype)); in jffs2_sum_write_data()
785 jffs2_sum_disable_collecting(c->summary); in jffs2_sum_write_data()
794 c->summary->sum_list_head = temp->u.next; in jffs2_sum_write_data()
797 c->summary->sum_num--; in jffs2_sum_write_data()
801 jffs2_sum_reset_collected(c->summary); in jffs2_sum_write_data()
806 sm->offset = cpu_to_je32(c->sector_size - jeb->free_size); in jffs2_sum_write_data()
807 sm->magic = cpu_to_je32(JFFS2_SUM_MAGIC); in jffs2_sum_write_data()
809 isum.sum_crc = cpu_to_je32(crc32(0, c->summary->sum_buf, datasize)); in jffs2_sum_write_data()
810 isum.node_crc = cpu_to_je32(crc32(0, &isum, sizeof(isum) - 8)); in jffs2_sum_write_data()
814 vecs[1].iov_base = c->summary->sum_buf; in jffs2_sum_write_data()
817 sum_ofs = jeb->offset + c->sector_size - jeb->free_size; in jffs2_sum_write_data()
830 spin_lock(&c->erase_completion_lock); in jffs2_sum_write_data()
832 spin_unlock(&c->erase_completion_lock); in jffs2_sum_write_data()
835 c->summary->sum_size = JFFS2_SUMMARY_NOSUM_SIZE; in jffs2_sum_write_data()
840 spin_lock(&c->erase_completion_lock); in jffs2_sum_write_data()
842 spin_unlock(&c->erase_completion_lock); in jffs2_sum_write_data()
847 /* Write out summary information - called from jffs2_do_reserve_space */
850 __must_hold(&c->erase_completion_block) in jffs2_sum_write_sumnode()
858 spin_unlock(&c->erase_completion_lock); in jffs2_sum_write_sumnode()
860 jeb = c->nextblock; in jffs2_sum_write_sumnode()
863 if (!c->summary->sum_num || !c->summary->sum_list_head) { in jffs2_sum_write_sumnode()
868 datasize = c->summary->sum_size + sizeof(struct jffs2_sum_marker); in jffs2_sum_write_sumnode()
870 padsize = jeb->free_size - infosize; in jffs2_sum_write_sumnode()
875 spin_lock(&c->erase_completion_lock); in jffs2_sum_write_sumnode()