Lines Matching defs:lnr
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);
84 * @lnr: LEB number
87 nor_create_eb_hdr(struct chfs_eb_hdr *ebhdr, int lnr)
89 ebhdr->u.nor_hdr.lid = htole32(lnr);
96 * @lnr: LEB number
99 nand_create_eb_hdr(struct chfs_eb_hdr *ebhdr, int lnr)
101 ebhdr->u.nand_hdr.lid = htole32(lnr);
547 return (le1->lnr - le2->lnr);
566 ltree_lookup(struct chfs_ebh *ebh, int lnr)
569 le.lnr = lnr;
577 * @lnr: identifier of the logical eraseblock
579 * This function adds a new logical eraseblock entry identified with @lnr to the
586 ltree_add_entry(struct chfs_ebh *ebh, int lnr)
592 le->lnr = lnr;
617 * @lnr: identifier of the logical eraseblock
622 leb_read_lock(struct chfs_ebh *ebh, int lnr)
626 le = ltree_add_entry(ebh, lnr);
637 * @lnr: identifier of the logical eraseblock
643 leb_read_unlock(struct chfs_ebh *ebh, int lnr)
649 le = ltree_lookup(ebh, lnr);
673 * @lnr: identifier of the logical eraseblock
678 leb_write_lock(struct chfs_ebh *ebh, int lnr)
682 le = ltree_add_entry(ebh, lnr);
693 * @lnr: identifier of the logical eraseblock
699 leb_write_unlock(struct chfs_ebh *ebh, int lnr)
705 le = ltree_lookup(ebh, lnr);
1164 return (sleb1->lnr - sleb2->lnr);
1214 int err, lnr, ec;
1217 lnr = CHFS_GET_LID(ebhdr->u.nor_hdr.lid);
1223 sleb->lnr = lnr;
1243 old->lnr = lnr;
1322 int err, lnr, ec;
1326 lnr = CHFS_GET_LID(ebhdr->u.nor_hdr.lid);
1332 sleb->lnr = lnr;
1350 old->lnr = lnr;
1547 ebh->lmap[sleb->lnr] = sleb->pebnr;
1716 * @lnr: logical eraseblock number
1724 ebh_read_leb(struct chfs_ebh *ebh, int lnr, char *buf, uint32_t offset,
1732 err = leb_read_lock(ebh, lnr);
1736 pebnr = ebh->lmap[lnr];
1739 leb_read_unlock(ebh, lnr);
1754 leb_read_unlock(ebh, lnr);
1812 * @lnr: logical eraseblock number
1820 ebh_write_leb(struct chfs_ebh *ebh, int lnr, char *buf, uint32_t offset,
1832 err = leb_write_lock(ebh, lnr);
1836 pebnr = ebh->lmap[lnr];
1851 leb_write_unlock(ebh, lnr);
1862 ebh->ops->create_eb_hdr(ebhdr, lnr);
1868 leb_write_unlock(ebh, lnr);
1878 lnr, pebnr);
1895 ebh->lmap[lnr] = pebnr;
1896 leb_write_unlock(ebh, lnr);
1904 leb_write_unlock(ebh, lnr);
1914 * @lnr: leb number
1919 ebh_erase_leb(struct chfs_ebh *ebh, int lnr)
1923 leb_write_lock(ebh, lnr);
1925 pebnr = ebh->lmap[lnr];
1927 leb_write_unlock(ebh, lnr);
1934 ebh->lmap[lnr] = EBH_LEB_UNMAPPED;
1937 leb_write_unlock(ebh, lnr);
1944 * @lnr: leb number
1949 ebh_map_leb(struct chfs_ebh *ebh, int lnr)
1956 err = leb_write_lock(ebh, lnr);
1969 ebh->ops->create_eb_hdr(ebhdr, lnr);
1975 lnr, pebnr);
1979 ebh->lmap[lnr] = pebnr;
1982 leb_write_unlock(ebh, lnr);
1989 leb_write_unlock(ebh, lnr);
1999 * @lnr: leb number
2004 ebh_unmap_leb(struct chfs_ebh *ebh, int lnr)
2008 if (ebh_is_mapped(ebh, lnr) < 0)
2012 err = ebh_erase_leb(ebh, lnr);
2018 * ebh_is_mapped - check if a PEB is mapped to @lnr
2020 * @lnr: leb number
2025 ebh_is_mapped(struct chfs_ebh *ebh, int lnr)
2028 err = leb_read_lock(ebh, lnr);
2032 result = ebh->lmap[lnr];
2033 leb_read_unlock(ebh, lnr);
2041 * @lnr: leb number
2047 ebh_change_leb(struct chfs_ebh *ebh, int lnr, char *buf, size_t len,
2056 if (ebh_is_mapped(ebh, lnr) < 0)
2060 err = ebh_unmap_leb(ebh, lnr);
2063 return ebh_map_leb(ebh, lnr);
2068 pebnr_old = ebh->lmap[lnr];
2071 err = leb_write_lock(ebh, lnr);
2076 err = ebh->ops->mark_eb_hdr_dirty_flash(ebh, pebnr_old, lnr);
2082 ebh->ops->create_eb_hdr(ebhdr, lnr);
2088 leb_write_unlock(ebh, lnr);
2098 lnr, pebnr);
2113 ebh->lmap[lnr] = pebnr;
2124 leb_write_unlock(ebh, lnr);
2136 leb_write_unlock(ebh, lnr);