Lines Matching refs:dir
485 static int lfs_dir_commit(lfs_t *lfs, lfs_mdir_t *dir,
488 lfs_mdir_t *dir, const struct lfs_mattr *attrs, int attrcount,
502 static int lfs_fs_pred(lfs_t *lfs, const lfs_block_t dir[2],
504 static lfs_stag_t lfs_fs_parent(lfs_t *lfs, const lfs_block_t dir[2],
514 static int lfs_dir_rawrewind(lfs_t *lfs, lfs_dir_t *dir);
611 static lfs_stag_t lfs_dir_getslice(lfs_t *lfs, const lfs_mdir_t *dir, in lfs_dir_getslice() argument
614 lfs_off_t off = dir->off; in lfs_dir_getslice()
615 lfs_tag_t ntag = dir->etag; in lfs_dir_getslice()
618 if (lfs_gstate_hasmovehere(&lfs->gdisk, dir->pair) && in lfs_dir_getslice()
631 dir->pair[0], off, &ntag, sizeof(ntag)); in lfs_dir_getslice()
659 dir->pair[0], off+sizeof(tag)+goff, gbuffer, diff); in lfs_dir_getslice()
673 static lfs_stag_t lfs_dir_get(lfs_t *lfs, const lfs_mdir_t *dir, in lfs_dir_get() argument
675 return lfs_dir_getslice(lfs, dir, in lfs_dir_get()
680 static int lfs_dir_getread(lfs_t *lfs, const lfs_mdir_t *dir, in lfs_dir_getread() argument
731 int err = lfs_dir_getslice(lfs, dir, gmask, gtag, in lfs_dir_getread()
782 const lfs_mdir_t *dir; member
803 const lfs_mdir_t *dir, lfs_off_t off, lfs_tag_t ptag, in lfs_dir_traverse() argument
820 if (off+lfs_tag_dsize(ptag) < dir->off) { in lfs_dir_traverse()
824 dir->pair[0], off, &tag, sizeof(tag)); in lfs_dir_traverse()
830 disk.block = dir->pair[0]; in lfs_dir_traverse()
856 .dir = dir, in lfs_dir_traverse()
874 dir = dir; in lfs_dir_traverse()
923 .dir = dir, in lfs_dir_traverse()
941 dir = buffer; in lfs_dir_traverse()
979 dir = stack[sp-1].dir; in lfs_dir_traverse()
1003 lfs_mdir_t *dir, const lfs_block_t pair[2], in lfs_dir_fetchmatch() argument
1034 dir->pair[0] = pair[(r+0)%2]; in lfs_dir_fetchmatch()
1035 dir->pair[1] = pair[(r+1)%2]; in lfs_dir_fetchmatch()
1036 dir->rev = revs[(r+0)%2]; in lfs_dir_fetchmatch()
1037 dir->off = 0; // nonzero = found some commits in lfs_dir_fetchmatch()
1049 dir->rev = lfs_tole32(dir->rev); in lfs_dir_fetchmatch()
1050 uint32_t crc = lfs_crc(0xffffffff, &dir->rev, sizeof(dir->rev)); in lfs_dir_fetchmatch()
1051 dir->rev = lfs_fromle32(dir->rev); in lfs_dir_fetchmatch()
1059 dir->pair[0], off, &tag, sizeof(tag)); in lfs_dir_fetchmatch()
1063 dir->erased = false; in lfs_dir_fetchmatch()
1074 dir->erased = (lfs_tag_type1(ptag) == LFS_TYPE_CRC && in lfs_dir_fetchmatch()
1075 dir->off % lfs->cfg->prog_size == 0); in lfs_dir_fetchmatch()
1078 dir->erased = false; in lfs_dir_fetchmatch()
1089 dir->pair[0], off+sizeof(tag), &dcrc, sizeof(dcrc)); in lfs_dir_fetchmatch()
1092 dir->erased = false; in lfs_dir_fetchmatch()
1100 dir->erased = false; in lfs_dir_fetchmatch()
1115 dir->off = off + lfs_tag_dsize(tag); in lfs_dir_fetchmatch()
1116 dir->etag = ptag; in lfs_dir_fetchmatch()
1117 dir->count = tempcount; in lfs_dir_fetchmatch()
1118 dir->tail[0] = temptail[0]; in lfs_dir_fetchmatch()
1119 dir->tail[1] = temptail[1]; in lfs_dir_fetchmatch()
1120 dir->split = tempsplit; in lfs_dir_fetchmatch()
1132 dir->pair[0], off+j, &dat, 1); in lfs_dir_fetchmatch()
1135 dir->erased = false; in lfs_dir_fetchmatch()
1165 dir->pair[0], off+sizeof(tag), &temptail, 8); in lfs_dir_fetchmatch()
1168 dir->erased = false; in lfs_dir_fetchmatch()
1178 dir->pair[0], off+sizeof(tag)}); in lfs_dir_fetchmatch()
1181 dir->erased = false; in lfs_dir_fetchmatch()
1204 if (dir->off > 0) { in lfs_dir_fetchmatch()
1206 if (lfs_gstate_hasmovehere(&lfs->gdisk, dir->pair)) { in lfs_dir_fetchmatch()
1217 *id = lfs_min(lfs_tag_id(besttag), dir->count); in lfs_dir_fetchmatch()
1222 } else if (lfs_tag_id(besttag) < dir->count) { in lfs_dir_fetchmatch()
1230 lfs_pair_swap(dir->pair); in lfs_dir_fetchmatch()
1231 dir->rev = revs[(r+1)%2]; in lfs_dir_fetchmatch()
1235 dir->pair[0], dir->pair[1]); in lfs_dir_fetchmatch()
1240 lfs_mdir_t *dir, const lfs_block_t pair[2]) { in lfs_dir_fetch() argument
1243 return (int)lfs_dir_fetchmatch(lfs, dir, pair, in lfs_dir_fetch()
1247 static int lfs_dir_getgstate(lfs_t *lfs, const lfs_mdir_t *dir, in lfs_dir_getgstate() argument
1250 lfs_stag_t res = lfs_dir_get(lfs, dir, LFS_MKTAG(0x7ff, 0, 0), in lfs_dir_getgstate()
1265 static int lfs_dir_getinfo(lfs_t *lfs, lfs_mdir_t *dir, in lfs_dir_getinfo() argument
1274 lfs_stag_t tag = lfs_dir_get(lfs, dir, LFS_MKTAG(0x780, 0x3ff, 0), in lfs_dir_getinfo()
1283 tag = lfs_dir_get(lfs, dir, LFS_MKTAG(0x700, 0x3ff, 0), in lfs_dir_getinfo()
1329 static lfs_stag_t lfs_dir_find(lfs_t *lfs, lfs_mdir_t *dir, in lfs_dir_find() argument
1339 dir->tail[0] = lfs->root[0]; in lfs_dir_find()
1340 dir->tail[1] = lfs->root[1]; in lfs_dir_find()
1394 lfs_stag_t res = lfs_dir_get(lfs, dir, LFS_MKTAG(0x700, 0x3ff, 0), in lfs_dir_find()
1395 LFS_MKTAG(LFS_TYPE_STRUCT, lfs_tag_id(tag), 8), dir->tail); in lfs_dir_find()
1399 lfs_pair_fromle32(dir->tail); in lfs_dir_find()
1404 tag = lfs_dir_fetchmatch(lfs, dir, dir->tail, in lfs_dir_find()
1419 if (!dir->split) { in lfs_dir_find()
1607 static int lfs_dir_alloc(lfs_t *lfs, lfs_mdir_t *dir) { in lfs_dir_alloc() argument
1610 int err = lfs_alloc(lfs, &dir->pair[(i+1)%2]); in lfs_dir_alloc()
1617 dir->rev = 0; in lfs_dir_alloc()
1622 NULL, &lfs->rcache, sizeof(dir->rev), in lfs_dir_alloc()
1623 dir->pair[0], 0, &dir->rev, sizeof(dir->rev)); in lfs_dir_alloc()
1624 dir->rev = lfs_fromle32(dir->rev); in lfs_dir_alloc()
1633 dir->rev = lfs_alignup(dir->rev, ((lfs->cfg->block_cycles+1)|1)); in lfs_dir_alloc()
1637 dir->off = sizeof(dir->rev); in lfs_dir_alloc()
1638 dir->etag = 0xffffffff; in lfs_dir_alloc()
1639 dir->count = 0; in lfs_dir_alloc()
1640 dir->tail[0] = LFS_BLOCK_NULL; in lfs_dir_alloc()
1641 dir->tail[1] = LFS_BLOCK_NULL; in lfs_dir_alloc()
1642 dir->erased = false; in lfs_dir_alloc()
1643 dir->split = false; in lfs_dir_alloc()
1651 static int lfs_dir_drop(lfs_t *lfs, lfs_mdir_t *dir, lfs_mdir_t *tail) { in lfs_dir_drop() argument
1660 err = lfs_dir_commit(lfs, dir, LFS_MKATTRS( in lfs_dir_drop()
1673 lfs_mdir_t *dir, const struct lfs_mattr *attrs, int attrcount, in lfs_dir_split() argument
1682 tail.split = dir->split; in lfs_dir_split()
1683 tail.tail[0] = dir->tail[0]; in lfs_dir_split()
1684 tail.tail[1] = dir->tail[1]; in lfs_dir_split()
1692 dir->tail[0] = tail.pair[0]; in lfs_dir_split()
1693 dir->tail[1] = tail.pair[1]; in lfs_dir_split()
1694 dir->split = true; in lfs_dir_split()
1697 if (lfs_pair_cmp(dir->pair, lfs->root) == 0 && split == 0) { in lfs_dir_split()
1731 static bool lfs_dir_needsrelocation(lfs_t *lfs, lfs_mdir_t *dir) { in lfs_dir_needsrelocation() argument
1739 && ((dir->rev + 1) % ((lfs->cfg->block_cycles+1)|1) == 0)); in lfs_dir_needsrelocation()
1745 lfs_mdir_t *dir, const struct lfs_mattr *attrs, int attrcount, in lfs_dir_compact() argument
1749 bool tired = lfs_dir_needsrelocation(lfs, dir); in lfs_dir_compact()
1752 dir->rev += 1; in lfs_dir_compact()
1766 if (tired && lfs_pair_cmp(dir->pair, (const lfs_block_t[2]){0, 1}) != 0) { in lfs_dir_compact()
1776 .block = dir->pair[1], in lfs_dir_compact()
1787 int err = lfs_bd_erase(lfs, dir->pair[1]); in lfs_dir_compact()
1796 dir->rev = lfs_tole32(dir->rev); in lfs_dir_compact()
1798 &dir->rev, sizeof(dir->rev)); in lfs_dir_compact()
1799 dir->rev = lfs_fromle32(dir->rev); in lfs_dir_compact()
1823 if (!lfs_pair_isnull(dir->tail)) { in lfs_dir_compact()
1824 lfs_pair_tole32(dir->tail); in lfs_dir_compact()
1826 LFS_MKTAG(LFS_TYPE_TAIL + dir->split, 0x3ff, 8), in lfs_dir_compact()
1827 dir->tail); in lfs_dir_compact()
1828 lfs_pair_fromle32(dir->tail); in lfs_dir_compact()
1846 err = lfs_dir_getgstate(lfs, dir, &delta); in lfs_dir_compact()
1875 lfs_pair_swap(dir->pair); in lfs_dir_compact()
1876 dir->count = end - begin; in lfs_dir_compact()
1877 dir->off = commit.off; in lfs_dir_compact()
1878 dir->etag = commit.ptag; in lfs_dir_compact()
1892 LFS_DEBUG("Bad block at 0x%"PRIx32, dir->pair[1]); in lfs_dir_compact()
1896 if (lfs_pair_cmp(dir->pair, (const lfs_block_t[2]){0, 1}) == 0) { in lfs_dir_compact()
1898 dir->pair[1]); in lfs_dir_compact()
1903 int err = lfs_alloc(lfs, &dir->pair[1]); in lfs_dir_compact()
1917 static int lfs_dir_splittingcompact(lfs_t *lfs, lfs_mdir_t *dir, in lfs_dir_splittingcompact() argument
1962 int err = lfs_dir_split(lfs, dir, attrs, attrcount, in lfs_dir_splittingcompact()
1972 dir->pair[0], dir->pair[1]); in lfs_dir_splittingcompact()
1979 if (lfs_dir_needsrelocation(lfs, dir) in lfs_dir_splittingcompact()
1980 && lfs_pair_cmp(dir->pair, (const lfs_block_t[2]){0, 1}) == 0) { in lfs_dir_splittingcompact()
1991 LFS_DEBUG("Expanding superblock at rev %"PRIu32, dir->rev); in lfs_dir_splittingcompact()
1992 int err = lfs_dir_split(lfs, dir, attrs, attrcount, in lfs_dir_splittingcompact()
2008 return lfs_dir_compact(lfs, dir, attrs, attrcount, source, begin, end); in lfs_dir_splittingcompact()
2013 static int lfs_dir_relocatingcommit(lfs_t *lfs, lfs_mdir_t *dir, in lfs_dir_relocatingcommit() argument
2023 dir->count += 1; in lfs_dir_relocatingcommit()
2025 LFS_ASSERT(dir->count > 0); in lfs_dir_relocatingcommit()
2026 dir->count -= 1; in lfs_dir_relocatingcommit()
2029 dir->tail[0] = ((lfs_block_t*)attrs[i].buffer)[0]; in lfs_dir_relocatingcommit()
2030 dir->tail[1] = ((lfs_block_t*)attrs[i].buffer)[1]; in lfs_dir_relocatingcommit()
2031 dir->split = (lfs_tag_chunk(attrs[i].tag) & 1); in lfs_dir_relocatingcommit()
2032 lfs_pair_fromle32(dir->tail); in lfs_dir_relocatingcommit()
2037 if (hasdelete && dir->count == 0) { in lfs_dir_relocatingcommit()
2039 int err = lfs_fs_pred(lfs, dir->pair, pdir); in lfs_dir_relocatingcommit()
2050 if (dir->erased) { in lfs_dir_relocatingcommit()
2053 .block = dir->pair[0], in lfs_dir_relocatingcommit()
2054 .off = dir->off, in lfs_dir_relocatingcommit()
2055 .ptag = dir->etag, in lfs_dir_relocatingcommit()
2058 .begin = dir->off, in lfs_dir_relocatingcommit()
2064 lfs_pair_tole32(dir->tail); in lfs_dir_relocatingcommit()
2066 dir, dir->off, dir->etag, attrs, attrcount, in lfs_dir_relocatingcommit()
2070 lfs_pair_fromle32(dir->tail); in lfs_dir_relocatingcommit()
2085 err = lfs_dir_getgstate(lfs, dir, &delta); in lfs_dir_relocatingcommit()
2113 dir->off = commit.off; in lfs_dir_relocatingcommit()
2114 dir->etag = commit.ptag; in lfs_dir_relocatingcommit()
2126 state = lfs_dir_splittingcompact(lfs, dir, attrs, attrcount, in lfs_dir_relocatingcommit()
2127 dir, 0, dir->count); in lfs_dir_relocatingcommit()
2145 d->m = *dir; in lfs_dir_relocatingcommit()
2184 static int lfs_dir_orphaningcommit(lfs_t *lfs, lfs_mdir_t *dir, in lfs_dir_orphaningcommit() argument
2189 if (dir != &f->m && lfs_pair_cmp(f->m.pair, dir->pair) == 0 && in lfs_dir_orphaningcommit()
2204 lfs_block_t lpair[2] = {dir->pair[0], dir->pair[1]}; in lfs_dir_orphaningcommit()
2205 lfs_mdir_t ldir = *dir; in lfs_dir_orphaningcommit()
2207 int state = lfs_dir_relocatingcommit(lfs, &ldir, dir->pair, in lfs_dir_orphaningcommit()
2215 if (lfs_pair_cmp(dir->pair, lpair) == 0) { in lfs_dir_orphaningcommit()
2216 *dir = ldir; in lfs_dir_orphaningcommit()
2226 int err = lfs_dir_getgstate(lfs, dir, &lfs->gdelta); in lfs_dir_orphaningcommit()
2234 lfs_pair_tole32(dir->tail); in lfs_dir_orphaningcommit()
2236 {LFS_MKTAG(LFS_TYPE_TAIL + dir->split, 0x3ff, 8), in lfs_dir_orphaningcommit()
2237 dir->tail}), in lfs_dir_orphaningcommit()
2239 lfs_pair_fromle32(dir->tail); in lfs_dir_orphaningcommit()
2377 static int lfs_dir_commit(lfs_t *lfs, lfs_mdir_t *dir, in lfs_dir_commit() argument
2379 int orphans = lfs_dir_orphaningcommit(lfs, dir, attrs, attrcount); in lfs_dir_commit()
2424 lfs_mdir_t dir; in lfs_rawmkdir() local
2425 err = lfs_dir_alloc(lfs, &dir); in lfs_rawmkdir()
2441 err = lfs_dir_commit(lfs, &dir, LFS_MKATTRS( in lfs_rawmkdir()
2464 lfs_pair_tole32(dir.pair); in lfs_rawmkdir()
2466 {LFS_MKTAG(LFS_TYPE_SOFTTAIL, 0x3ff, 8), dir.pair})); in lfs_rawmkdir()
2467 lfs_pair_fromle32(dir.pair); in lfs_rawmkdir()
2481 lfs_pair_tole32(dir.pair); in lfs_rawmkdir()
2485 {LFS_MKTAG(LFS_TYPE_DIRSTRUCT, id, 8), dir.pair}, in lfs_rawmkdir()
2487 LFS_TYPE_SOFTTAIL, 0x3ff, 8), dir.pair})); in lfs_rawmkdir()
2488 lfs_pair_fromle32(dir.pair); in lfs_rawmkdir()
2497 static int lfs_dir_rawopen(lfs_t *lfs, lfs_dir_t *dir, const char *path) { in lfs_dir_rawopen() argument
2498 lfs_stag_t tag = lfs_dir_find(lfs, &dir->m, &path, NULL); in lfs_dir_rawopen()
2514 lfs_stag_t res = lfs_dir_get(lfs, &dir->m, LFS_MKTAG(0x700, 0x3ff, 0), in lfs_dir_rawopen()
2523 int err = lfs_dir_fetch(lfs, &dir->m, pair); in lfs_dir_rawopen()
2529 dir->head[0] = dir->m.pair[0]; in lfs_dir_rawopen()
2530 dir->head[1] = dir->m.pair[1]; in lfs_dir_rawopen()
2531 dir->id = 0; in lfs_dir_rawopen()
2532 dir->pos = 0; in lfs_dir_rawopen()
2535 dir->type = LFS_TYPE_DIR; in lfs_dir_rawopen()
2536 lfs_mlist_append(lfs, (struct lfs_mlist *)dir); in lfs_dir_rawopen()
2541 static int lfs_dir_rawclose(lfs_t *lfs, lfs_dir_t *dir) { in lfs_dir_rawclose() argument
2543 lfs_mlist_remove(lfs, (struct lfs_mlist *)dir); in lfs_dir_rawclose()
2548 static int lfs_dir_rawread(lfs_t *lfs, lfs_dir_t *dir, struct lfs_info *info) { in lfs_dir_rawread() argument
2552 if (dir->pos == 0) { in lfs_dir_rawread()
2555 dir->pos += 1; in lfs_dir_rawread()
2557 } else if (dir->pos == 1) { in lfs_dir_rawread()
2560 dir->pos += 1; in lfs_dir_rawread()
2565 if (dir->id == dir->m.count) { in lfs_dir_rawread()
2566 if (!dir->m.split) { in lfs_dir_rawread()
2570 int err = lfs_dir_fetch(lfs, &dir->m, dir->m.tail); in lfs_dir_rawread()
2575 dir->id = 0; in lfs_dir_rawread()
2578 int err = lfs_dir_getinfo(lfs, &dir->m, dir->id, info); in lfs_dir_rawread()
2583 dir->id += 1; in lfs_dir_rawread()
2589 dir->pos += 1; in lfs_dir_rawread()
2593 static int lfs_dir_rawseek(lfs_t *lfs, lfs_dir_t *dir, lfs_off_t off) { in lfs_dir_rawseek() argument
2595 int err = lfs_dir_rawrewind(lfs, dir); in lfs_dir_rawseek()
2601 dir->pos = lfs_min(2, off); in lfs_dir_rawseek()
2602 off -= dir->pos; in lfs_dir_rawseek()
2605 dir->id = (off > 0 && lfs_pair_cmp(dir->head, lfs->root) == 0); in lfs_dir_rawseek()
2608 int diff = lfs_min(dir->m.count - dir->id, off); in lfs_dir_rawseek()
2609 dir->id += diff; in lfs_dir_rawseek()
2610 dir->pos += diff; in lfs_dir_rawseek()
2613 if (dir->id == dir->m.count) { in lfs_dir_rawseek()
2614 if (!dir->m.split) { in lfs_dir_rawseek()
2618 err = lfs_dir_fetch(lfs, &dir->m, dir->m.tail); in lfs_dir_rawseek()
2623 dir->id = 0; in lfs_dir_rawseek()
2630 static lfs_soff_t lfs_dir_rawtell(lfs_t *lfs, lfs_dir_t *dir) { in lfs_dir_rawtell() argument
2632 return dir->pos; in lfs_dir_rawtell()
2635 static int lfs_dir_rawrewind(lfs_t *lfs, lfs_dir_t *dir) { in lfs_dir_rawrewind() argument
2637 int err = lfs_dir_fetch(lfs, &dir->m, dir->head); in lfs_dir_rawrewind()
2642 dir->id = 0; in lfs_dir_rawrewind()
2643 dir->pos = 0; in lfs_dir_rawrewind()
3635 struct lfs_mlist dir; local
3636 dir.next = lfs->mlist;
3647 err = lfs_dir_fetch(lfs, &dir.m, pair);
3652 if (dir.m.count > 0 || dir.m.split) {
3664 dir.type = 0;
3665 dir.id = 0;
3666 lfs->mlist = &dir;
3673 lfs->mlist = dir.next;
3677 lfs->mlist = dir.next;
3685 err = lfs_fs_pred(lfs, dir.m.pair, &cwd);
3690 err = lfs_dir_drop(lfs, &cwd, &dir.m);
4111 lfs_mdir_t dir = {.tail = {0, 1}}; local
4113 while (!lfs_pair_isnull(dir.tail)) {
4122 lfs_stag_t tag = lfs_dir_fetchmatch(lfs, &dir, dir.tail,
4136 lfs->root[0] = dir.pair[0];
4137 lfs->root[1] = dir.pair[1];
4141 tag = lfs_dir_get(lfs, &dir, LFS_MKTAG(0x7ff, 0x3ff, 0),
4211 err = lfs_dir_getgstate(lfs, &dir, &lfs->gstate);
4255 lfs_mdir_t dir = {.tail = {0, 1}}; local
4265 dir.tail[0] = lfs->root[0];
4266 dir.tail[1] = lfs->root[1];
4271 while (!lfs_pair_isnull(dir.tail)) {
4279 int err = cb(data, dir.tail[i]);
4286 int err = lfs_dir_fetch(lfs, &dir, dir.tail);
4291 for (uint16_t id = 0; id < dir.count; id++) {
4293 lfs_stag_t tag = lfs_dir_get(lfs, &dir, LFS_MKTAG(0x700, 0x3ff, 0),
4498 lfs_mdir_t dir; local
4502 int err = lfs_dir_fetch(lfs, &dir, pdir.tail);
4525 err = lfs_dir_getgstate(lfs, &dir, &lfs->gdelta);
4531 lfs_pair_tole32(dir.tail);
4533 {LFS_MKTAG(LFS_TYPE_TAIL + dir.split, 0x3ff, 8),
4534 dir.tail}));
4535 lfs_pair_fromle32(dir.tail);
4603 pdir = dir;
4693 lfs_block_t dir[2]; member
4775 d->u.dir[0] = lfs_fromle32(d->u.dir[0]);
4776 d->u.dir[1] = lfs_fromle32(d->u.dir[1]);
4780 d->u.dir[0] = lfs_tole32(d->u.dir[0]);
4781 d->u.dir[1] = lfs_tole32(d->u.dir[1]);
4799 lfs1_dir_t *dir, const lfs_block_t pair[2]) { argument
4816 if (valid && lfs_scmp(test.rev, dir->d.rev) < 0) {
4845 dir->pair[0] = tpair[(i+0) % 2];
4846 dir->pair[1] = tpair[(i+1) % 2];
4847 dir->off = sizeof(dir->d);
4848 dir->d = test;
4860 static int lfs1_dir_next(lfs_t *lfs, lfs1_dir_t *dir, lfs1_entry_t *entry) { argument
4861 while (dir->off + sizeof(entry->d) > (0x7fffffff & dir->d.size)-4) {
4862 if (!(0x80000000 & dir->d.size)) {
4863 entry->off = dir->off;
4867 int err = lfs1_dir_fetch(lfs, dir, dir->d.tail);
4872 dir->off = sizeof(dir->d);
4873 dir->pos += sizeof(dir->d) + 4;
4876 int err = lfs1_bd_read(lfs, dir->pair[0], dir->off,
4883 entry->off = dir->off;
4884 dir->off += lfs1_entry_size(entry);
4885 dir->pos += lfs1_entry_size(entry);
4896 lfs1_dir_t dir; local
4908 int err = lfs1_dir_fetch(lfs, &dir, cwd);
4914 while (dir.off + sizeof(entry.d) <= (0x7fffffff & dir.d.size)-4) {
4915 err = lfs1_bd_read(lfs, dir.pair[0], dir.off,
4922 dir.off += lfs1_entry_size(&entry);
4948 cwd[0] = dir.d.tail[0];
4949 cwd[1] = dir.d.tail[1];
5020 lfs1_dir_t dir; local
5022 err = lfs1_dir_fetch(lfs, &dir, (const lfs_block_t[2]){0, 1});
5028 err = lfs1_bd_read(lfs, dir.pair[0], sizeof(dir.d),
5679 int lfs_dir_open(lfs_t *lfs, lfs_dir_t *dir, const char *path) { argument
5684 LFS_TRACE("lfs_dir_open(%p, %p, \"%s\")", (void*)lfs, (void*)dir, path);
5685 LFS_ASSERT(!lfs_mlist_isopen(lfs->mlist, (struct lfs_mlist*)dir));
5687 err = lfs_dir_rawopen(lfs, dir, path);
5694 int lfs_dir_close(lfs_t *lfs, lfs_dir_t *dir) { argument
5699 LFS_TRACE("lfs_dir_close(%p, %p)", (void*)lfs, (void*)dir);
5701 err = lfs_dir_rawclose(lfs, dir);
5708 int lfs_dir_read(lfs_t *lfs, lfs_dir_t *dir, struct lfs_info *info) { argument
5714 (void*)lfs, (void*)dir, (void*)info);
5716 err = lfs_dir_rawread(lfs, dir, info);
5723 int lfs_dir_seek(lfs_t *lfs, lfs_dir_t *dir, lfs_off_t off) { argument
5729 (void*)lfs, (void*)dir, off);
5731 err = lfs_dir_rawseek(lfs, dir, off);
5738 lfs_soff_t lfs_dir_tell(lfs_t *lfs, lfs_dir_t *dir) { argument
5743 LFS_TRACE("lfs_dir_tell(%p, %p)", (void*)lfs, (void*)dir);
5745 lfs_soff_t res = lfs_dir_rawtell(lfs, dir);
5752 int lfs_dir_rewind(lfs_t *lfs, lfs_dir_t *dir) { argument
5757 LFS_TRACE("lfs_dir_rewind(%p, %p)", (void*)lfs, (void*)dir);
5759 err = lfs_dir_rawrewind(lfs, dir);