Lines Matching defs:ebhdr

43 int nor_create_eb_hdr(struct chfs_eb_hdr *ebhdr, int lnr);
44 int nand_create_eb_hdr(struct chfs_eb_hdr *ebhdr, int lnr);
47 int nor_read_eb_hdr(struct chfs_ebh *ebh, int pebnr, struct chfs_eb_hdr *ebhdr);
48 int nand_read_eb_hdr(struct chfs_ebh *ebh, int pebnr, struct chfs_eb_hdr *ebhdr);
49 int nor_write_eb_hdr(struct chfs_ebh *ebh, int pebnr, struct chfs_eb_hdr *ebhdr);
50 int nand_write_eb_hdr(struct chfs_ebh *ebh, int pebnr,struct chfs_eb_hdr *ebhdr);
71 int nor_scan_add_to_used(struct chfs_ebh *ebh, struct chfs_scan_info *si,struct chfs_eb_hdr *ebhdr, int pebnr, int leb_status);
73 int pebnr, struct chfs_eb_hdr *ebhdr);
74 int nand_scan_add_to_used(struct chfs_ebh *ebh, struct chfs_scan_info *si,struct chfs_eb_hdr *ebhdr, int pebnr);
76 int pebnr, struct chfs_eb_hdr *ebhdr);
83 * @ebhdr: ebhdr to set
87 nor_create_eb_hdr(struct chfs_eb_hdr *ebhdr, int lnr)
89 ebhdr->u.nor_hdr.lid = htole32(lnr);
95 * @ebhdr: ebhdr to set
99 nand_create_eb_hdr(struct chfs_eb_hdr *ebhdr, int lnr)
101 ebhdr->u.nand_hdr.lid = htole32(lnr);
136 * @ebhdr: whereto store the data
143 int pebnr, struct chfs_eb_hdr *ebhdr)
153 &retlen, (unsigned char *) &ebhdr->ec_hdr);
161 &retlen, (unsigned char *) &ebhdr->u.nor_hdr);
174 * @ebhdr: whereto store the data
181 struct chfs_eb_hdr *ebhdr)
193 (unsigned char *) &ebhdr->ec_hdr);
201 (unsigned char *) &ebhdr->u.nand_hdr);
219 nor_write_eb_hdr(struct chfs_ebh *ebh, int pebnr, struct chfs_eb_hdr *ebhdr)
226 ebhdr->u.nor_hdr.lid = ebhdr->u.nor_hdr.lid
229 crc = crc32(0, (uint8_t *)&ebhdr->u.nor_hdr + 4,
231 ebhdr->u.nand_hdr.crc = htole32(crc);
237 (unsigned char *) &ebhdr->u.nor_hdr);
257 struct chfs_eb_hdr *ebhdr)
268 ebhdr->u.nand_hdr.serial = htole64(++(*ebh->max_serial));
270 crc = crc32(0, (uint8_t *)&ebhdr->u.nand_hdr + 4,
272 ebhdr->u.nand_hdr.crc = htole32(crc);
276 (unsigned char *) &ebhdr->u.nand_hdr);
296 struct chfs_eb_hdr *ebhdr = buf;
300 if (check_pattern((void *) &ebhdr->ec_hdr,
307 magic = le32toh(ebhdr->ec_hdr.magic);
315 hdr_crc = le32toh(ebhdr->ec_hdr.crc_ec);
316 crc = crc32(0, (uint8_t *) &ebhdr->ec_hdr + 8, 4);
325 if (check_pattern((void *) &ebhdr->u.nor_hdr, 0xFF, 0,
332 if (ebhdr->u.nor_hdr.crc == 0 && ebhdr->u.nor_hdr.lid == 0) {
333 dbg_ebh("invalidated ebhdr found\n");
338 hdr_crc = le32toh(ebhdr->u.nor_hdr.crc);
339 lid_save = ebhdr->u.nor_hdr.lid;
342 ebhdr->u.nor_hdr.lid = ebhdr->u.nor_hdr.lid | htole32(
344 crc = crc32(0, (uint8_t *) &ebhdr->u.nor_hdr + 4,
347 ebhdr->u.nor_hdr.lid = lid_save;
356 dbg_ebh("dirty ebhdr found\n");
375 struct chfs_eb_hdr *ebhdr = buf;
378 if (check_pattern((void *) &ebhdr->ec_hdr,
385 magic = le32toh(ebhdr->ec_hdr.magic);
393 hdr_crc = le32toh(ebhdr->ec_hdr.crc_ec);
394 crc = crc32(0, (uint8_t *) &ebhdr->ec_hdr + 8, 4);
403 if (check_pattern((void *) &ebhdr->u.nand_hdr, 0xFF, 0,
410 hdr_crc = le32toh(ebhdr->u.nand_hdr.crc);
412 crc = crc32(0, (uint8_t *) &ebhdr->u.nand_hdr + 4,
509 struct chfs_eb_hdr *ebhdr;
510 ebhdr = kmem_alloc(sizeof(struct chfs_eb_hdr), KM_SLEEP);
512 ebhdr->ec_hdr.magic = htole32(CHFS_MAGIC_BITMASK);
513 ebhdr->ec_hdr.erase_cnt = htole32(ec);
514 crc = crc32(0, (uint8_t *) &ebhdr->ec_hdr + 8, 4);
515 ebhdr->ec_hdr.crc_ec = htole32(crc);
519 KASSERT(sizeof(ebhdr->ec_hdr) == CHFS_EB_EC_HDR_SIZE);
523 (unsigned char *) &ebhdr->ec_hdr);
527 kmem_free(ebhdr, sizeof(struct chfs_eb_hdr));
531 kmem_free(ebhdr, sizeof(struct chfs_eb_hdr));
894 "after mark ebhdr free\n");*/
899 "after mark ebhdr free\n");*/
1201 * @ebhdr: eraseblock header
1212 struct chfs_eb_hdr *ebhdr, int pebnr, int leb_status)
1217 lnr = CHFS_GET_LID(ebhdr->u.nor_hdr.lid);
1218 ec = le32toh(ebhdr->ec_hdr.erase_cnt);
1263 int pebnr, struct chfs_eb_hdr *ebhdr)
1267 err = ebh->ops->read_eb_hdr(ebh, pebnr, ebhdr);
1271 erase_cnt = le32toh(ebhdr->ec_hdr.erase_cnt);
1273 leb_status = ebh->ops->check_eb_hdr(ebh, ebhdr);
1292 err = nor_scan_add_to_used(ebh, si, ebhdr, pebnr, leb_status);
1309 * @ebhdr: eraseblock header
1320 struct chfs_eb_hdr *ebhdr, int pebnr)
1324 uint64_t serial = le64toh(ebhdr->u.nand_hdr.serial);
1326 lnr = CHFS_GET_LID(ebhdr->u.nor_hdr.lid);
1327 ec = le32toh(ebhdr->ec_hdr.erase_cnt);
1370 int pebnr, struct chfs_eb_hdr *ebhdr)
1389 err = ebh->ops->read_eb_hdr(ebh, pebnr, ebhdr);
1393 erase_cnt = le32toh(ebhdr->ec_hdr.erase_cnt);
1394 leb_status = ebh->ops->check_eb_hdr(ebh, ebhdr);
1409 err = nand_scan_add_to_used(ebh, si, ebhdr, pebnr);
1413 max_serial = le64toh(ebhdr->u.nand_hdr.serial);
1436 struct chfs_eb_hdr *ebhdr;
1450 ebhdr = kmem_alloc(sizeof(*ebhdr), KM_SLEEP);
1454 err = ebh->ops->process_eb(ebh, si, pebnr, ebhdr);
1458 kmem_free(ebhdr, sizeof(*ebhdr));
1463 kmem_free(ebhdr, sizeof(*ebhdr));
1825 struct chfs_eb_hdr *ebhdr;
1859 ebhdr = kmem_alloc(sizeof(struct chfs_eb_hdr), KM_SLEEP);
1862 ebh->ops->create_eb_hdr(ebhdr, lnr);
1869 kmem_free(ebhdr, sizeof(struct chfs_eb_hdr));
1874 err = ebh->ops->write_eb_hdr(ebh, pebnr, ebhdr);
1897 kmem_free(ebhdr, sizeof(struct chfs_eb_hdr));
1905 kmem_free(ebhdr, sizeof(struct chfs_eb_hdr));
1952 struct chfs_eb_hdr *ebhdr;
1954 ebhdr = kmem_alloc(sizeof(struct chfs_eb_hdr), KM_SLEEP);
1958 kmem_free(ebhdr, sizeof(struct chfs_eb_hdr));
1969 ebh->ops->create_eb_hdr(ebhdr, lnr);
1971 err = ebh->ops->write_eb_hdr(ebh, pebnr, ebhdr);
1990 kmem_free(ebhdr, sizeof(struct chfs_eb_hdr));
2054 struct chfs_eb_hdr *ebhdr;
2066 ebhdr = kmem_alloc(sizeof(struct chfs_eb_hdr), KM_SLEEP);
2082 ebh->ops->create_eb_hdr(ebhdr, lnr);
2090 kmem_free(ebhdr, sizeof(struct chfs_eb_hdr));
2094 err = ebh->ops->write_eb_hdr(ebh, pebnr, ebhdr);
2128 kmem_free(ebhdr, sizeof(struct chfs_eb_hdr));
2138 kmem_free(ebhdr, sizeof(struct chfs_eb_hdr));