Lines Matching defs:ec_hdr
84 const struct ubi_ec_hdr *ec_hdr);
455 struct ubi_ec_hdr ec_hdr;
475 err = ubi_io_read_ec_hdr(ubi, pnum, &ec_hdr, 0);
625 * @ec_hdr: the erase counter header to check
631 const struct ubi_ec_hdr *ec_hdr)
636 ec = be64_to_cpu(ec_hdr->ec);
637 vid_hdr_offset = be32_to_cpu(ec_hdr->vid_hdr_offset);
638 leb_start = be32_to_cpu(ec_hdr->data_offset);
640 if (ec_hdr->version != UBI_VERSION) {
642 UBI_VERSION, (int)ec_hdr->version);
667 ubi_dump_ec_hdr(ec_hdr);
676 * @ec_hdr: a &struct ubi_ec_hdr object where to store the read erase counter
681 * stores it in @ec_hdr. This function also checks CRC checksum of the read
695 struct ubi_ec_hdr *ec_hdr, int verbose)
703 read_err = ubi_io_read(ubi, ec_hdr, pnum, 0, UBI_EC_HDR_SIZE);
719 magic = be32_to_cpu(ec_hdr->magic);
729 if (ubi_check_pattern(ec_hdr, 0xFF, UBI_EC_HDR_SIZE)) {
749 ubi_dump_ec_hdr(ec_hdr);
756 crc = crc32(UBI_CRC32_INIT, ec_hdr, UBI_EC_HDR_SIZE_CRC);
757 hdr_crc = be32_to_cpu(ec_hdr->hdr_crc);
763 ubi_dump_ec_hdr(ec_hdr);
775 err = validate_ec_hdr(ubi, ec_hdr);
792 * @ec_hdr: the erase counter header to write
794 * This function writes erase counter header described by @ec_hdr to physical
795 * eraseblock @pnum. It also fills most fields of @ec_hdr before writing, so
796 * the caller do not have to fill them. Callers must only fill the @ec_hdr->ec
804 struct ubi_ec_hdr *ec_hdr)
812 ec_hdr->magic = cpu_to_be32(UBI_EC_HDR_MAGIC);
813 ec_hdr->version = UBI_VERSION;
814 ec_hdr->vid_hdr_offset = cpu_to_be32(ubi->vid_hdr_offset);
815 ec_hdr->data_offset = cpu_to_be32(ubi->leb_start);
816 ec_hdr->image_seq = cpu_to_be32(ubi->image_seq);
817 crc = crc32(UBI_CRC32_INIT, ec_hdr, UBI_EC_HDR_SIZE_CRC);
818 ec_hdr->hdr_crc = cpu_to_be32(crc);
820 err = self_check_ec_hdr(ubi, pnum, ec_hdr);
827 err = ubi_io_write(ubi, ec_hdr, pnum, 0, ubi->ec_hdr_alsize);
1110 * @ec_hdr: the erase counter header to check
1116 const struct ubi_ec_hdr *ec_hdr)
1124 magic = be32_to_cpu(ec_hdr->magic);
1131 err = validate_ec_hdr(ubi, ec_hdr);
1140 ubi_dump_ec_hdr(ec_hdr);
1157 struct ubi_ec_hdr *ec_hdr;
1162 ec_hdr = kzalloc(ubi->ec_hdr_alsize, GFP_NOFS);
1163 if (!ec_hdr)
1166 err = ubi_io_read(ubi, ec_hdr, pnum, 0, UBI_EC_HDR_SIZE);
1170 crc = crc32(UBI_CRC32_INIT, ec_hdr, UBI_EC_HDR_SIZE_CRC);
1171 hdr_crc = be32_to_cpu(ec_hdr->hdr_crc);
1176 ubi_dump_ec_hdr(ec_hdr);
1182 err = self_check_ec_hdr(ubi, pnum, ec_hdr);
1185 kfree(ec_hdr);