Lines Matching refs:off

49         lfs_block_t block, lfs_off_t off,  in lfs_bd_read()  argument
52 if (off+size > lfs->cfg->block_size in lfs_bd_read()
61 off < pcache->off + pcache->size) { in lfs_bd_read()
62 if (off >= pcache->off) { in lfs_bd_read()
64 diff = lfs_min(diff, pcache->size - (off-pcache->off)); in lfs_bd_read()
65 memcpy(data, &pcache->buffer[off-pcache->off], diff); in lfs_bd_read()
68 off += diff; in lfs_bd_read()
74 diff = lfs_min(diff, pcache->off-off); in lfs_bd_read()
78 off < rcache->off + rcache->size) { in lfs_bd_read()
79 if (off >= rcache->off) { in lfs_bd_read()
81 diff = lfs_min(diff, rcache->size - (off-rcache->off)); in lfs_bd_read()
82 memcpy(data, &rcache->buffer[off-rcache->off], diff); in lfs_bd_read()
85 off += diff; in lfs_bd_read()
91 diff = lfs_min(diff, rcache->off-off); in lfs_bd_read()
94 if (size >= hint && off % lfs->cfg->read_size == 0 && in lfs_bd_read()
98 int err = lfs->cfg->read(lfs->cfg, block, off, data, diff); in lfs_bd_read()
104 off += diff; in lfs_bd_read()
112 rcache->off = lfs_aligndown(off, lfs->cfg->read_size); in lfs_bd_read()
115 lfs_alignup(off+hint, lfs->cfg->read_size), in lfs_bd_read()
117 - rcache->off, in lfs_bd_read()
120 rcache->off, rcache->buffer, rcache->size); in lfs_bd_read()
132 lfs_block_t block, lfs_off_t off, in lfs_bd_cmp() argument
143 block, off+i, &dat, diff); in lfs_bd_cmp()
159 lfs_block_t block, lfs_off_t off, lfs_size_t size, uint32_t *crc) { in lfs_bd_crc() argument
167 block, off+i, &dat, diff); in lfs_bd_crc()
185 pcache->off, pcache->buffer, diff); in lfs_bd_flush()
196 pcache->block, pcache->off, pcache->buffer, diff); in lfs_bd_flush()
232 lfs_block_t block, lfs_off_t off, in lfs_bd_prog() argument
236 LFS_ASSERT(off + size <= lfs->cfg->block_size); in lfs_bd_prog()
240 off >= pcache->off && in lfs_bd_prog()
241 off < pcache->off + lfs->cfg->cache_size) { in lfs_bd_prog()
244 lfs->cfg->cache_size - (off-pcache->off)); in lfs_bd_prog()
245 memcpy(&pcache->buffer[off-pcache->off], data, diff); in lfs_bd_prog()
248 off += diff; in lfs_bd_prog()
251 pcache->size = lfs_max(pcache->size, off - pcache->off); in lfs_bd_prog()
269 pcache->off = lfs_aligndown(off, lfs->cfg->prog_size); in lfs_bd_prog()
386 lfs_off_t off; member
604 lfs_block_t off = ((block - lfs->free.off) in lfs_alloc_lookahead() local
607 if (off < lfs->free.size) { in lfs_alloc_lookahead()
608 lfs->free.buffer[off / 32] |= 1U << (off % 32); in lfs_alloc_lookahead()
634 lfs->free.off = (lfs->free.off + lfs->free.i) % lfs->block_count; in lfs_fs_rawgc()
654 lfs_block_t off = lfs->free.i; in lfs_alloc() local
658 if (!(lfs->free.buffer[off / 32] & (1U << (off % 32)))) { in lfs_alloc()
660 *block = (lfs->free.off + off) % lfs->block_count; in lfs_alloc()
678 lfs->free.i + lfs->free.off); in lfs_alloc()
694 lfs_off_t off = dir->off; in lfs_dir_getslice() local
706 while (off >= sizeof(lfs_tag_t) + lfs_tag_dsize(ntag)) { in lfs_dir_getslice()
707 off -= lfs_tag_dsize(ntag); in lfs_dir_getslice()
711 dir->pair[0], off, &ntag, sizeof(ntag)); in lfs_dir_getslice()
739 dir->pair[0], off+sizeof(tag)+goff, gbuffer, diff); in lfs_dir_getslice()
763 lfs_off_t off, void *buffer, lfs_size_t size) { in lfs_dir_getread() argument
765 if (off+size > lfs->cfg->block_size) { in lfs_dir_getread()
773 off < pcache->off + pcache->size) { in lfs_dir_getread()
774 if (off >= pcache->off) { in lfs_dir_getread()
776 diff = lfs_min(diff, pcache->size - (off-pcache->off)); in lfs_dir_getread()
777 memcpy(data, &pcache->buffer[off-pcache->off], diff); in lfs_dir_getread()
780 off += diff; in lfs_dir_getread()
786 diff = lfs_min(diff, pcache->off-off); in lfs_dir_getread()
790 off < rcache->off + rcache->size) { in lfs_dir_getread()
791 if (off >= rcache->off) { in lfs_dir_getread()
793 diff = lfs_min(diff, rcache->size - (off-rcache->off)); in lfs_dir_getread()
794 memcpy(data, &rcache->buffer[off-rcache->off], diff); in lfs_dir_getread()
797 off += diff; in lfs_dir_getread()
803 diff = lfs_min(diff, rcache->off-off); in lfs_dir_getread()
808 rcache->off = lfs_aligndown(off, lfs->cfg->read_size); in lfs_dir_getread()
809 rcache->size = lfs_min(lfs_alignup(off+hint, lfs->cfg->read_size), in lfs_dir_getread()
812 rcache->off, rcache->buffer, rcache->size); in lfs_dir_getread()
863 lfs_off_t off; member
883 const lfs_mdir_t *dir, lfs_off_t off, lfs_tag_t ptag, in lfs_dir_traverse() argument
900 if (off+lfs_tag_dsize(ptag) < dir->off) { in lfs_dir_traverse()
901 off += lfs_tag_dsize(ptag); in lfs_dir_traverse()
904 dir->pair[0], off, &tag, sizeof(tag)); in lfs_dir_traverse()
911 disk.off = off+sizeof(lfs_tag_t); in lfs_dir_traverse()
937 .off = off, in lfs_dir_traverse()
999 .off = off, in lfs_dir_traverse()
1017 off = 0; in lfs_dir_traverse()
1055 off = stack[sp-1].off; in lfs_dir_traverse()
1113 dir->off = 0; // nonzero = found some commits in lfs_dir_fetchmatch()
1117 lfs_off_t off = 0; in lfs_dir_fetchmatch() local
1137 off += lfs_tag_dsize(ptag); in lfs_dir_fetchmatch()
1140 dir->pair[0], off, &tag, sizeof(tag)); in lfs_dir_fetchmatch()
1158 } else if (off + lfs_tag_dsize(tag) > lfs->cfg->block_size) { in lfs_dir_fetchmatch()
1169 dir->pair[0], off+sizeof(tag), &dcrc, sizeof(dcrc)); in lfs_dir_fetchmatch()
1193 dir->off = off + lfs_tag_dsize(tag); in lfs_dir_fetchmatch()
1208 dir->pair[0], off+sizeof(tag), in lfs_dir_fetchmatch()
1238 dir->pair[0], off+sizeof(tag), &temptail, 8); in lfs_dir_fetchmatch()
1249 dir->pair[0], off+sizeof(tag), in lfs_dir_fetchmatch()
1264 dir->pair[0], off+sizeof(tag)}); in lfs_dir_fetchmatch()
1289 if (dir->off == 0) { in lfs_dir_fetchmatch()
1298 if (maybeerased && dir->off % lfs->cfg->prog_size == 0) { in lfs_dir_fetchmatch()
1317 dir->pair[0], dir->off, fcrc.size, &fcrc_); in lfs_dir_fetchmatch()
1432 disk->block, disk->off, name->name, diff); in lfs_dir_find_match()
1549 lfs_off_t off; member
1562 commit->block, commit->off , in lfs_dir_commitprog()
1569 commit->off += size; in lfs_dir_commitprog()
1579 if (commit->off + dsize > commit->end) { in lfs_dir_commitattr()
1604 disk->block, disk->off+i, &dat, 1); in lfs_dir_commitattr()
1630 lfs_min(commit->off + 5*sizeof(uint32_t), lfs->cfg->block_size), in lfs_dir_commitcrc()
1639 while (commit->off < end) { in lfs_dir_commitcrc()
1641 lfs_min(end - (commit->off+sizeof(lfs_tag_t)), 0x3fe) in lfs_dir_commitcrc()
1642 + (commit->off+sizeof(lfs_tag_t))); in lfs_dir_commitcrc()
1698 noff - (commit->off+sizeof(lfs_tag_t))); in lfs_dir_commitcrc()
1705 commit->block, commit->off, &ccrc, sizeof(ccrc)); in lfs_dir_commitcrc()
1712 off1 = commit->off + sizeof(lfs_tag_t); in lfs_dir_commitcrc()
1716 commit->off = noff; in lfs_dir_commitcrc()
1724 if (noff >= end || noff >= lfs->pcache.off + lfs->cfg->cache_size) { in lfs_dir_commitcrc()
1737 lfs_off_t off = commit->begin; in lfs_dir_commitcrc() local
1741 commit->block, off, off1-off, &crc); in lfs_dir_commitcrc()
1799 dir->off = sizeof(dir->rev); in lfs_dir_alloc()
1939 .off = 0, in lfs_dir_compact()
2036 LFS_ASSERT(commit.off % lfs->cfg->prog_size == 0); in lfs_dir_compact()
2039 dir->off = commit.off; in lfs_dir_compact()
2225 .off = dir->off, in lfs_dir_relocatingcommit()
2229 .begin = dir->off, in lfs_dir_relocatingcommit()
2237 dir, dir->off, dir->etag, attrs, attrcount, in lfs_dir_relocatingcommit()
2283 LFS_ASSERT(commit.off % lfs->cfg->prog_size == 0); in lfs_dir_relocatingcommit()
2284 dir->off = commit.off; in lfs_dir_relocatingcommit()
2764 static int lfs_dir_rawseek(lfs_t *lfs, lfs_dir_t *dir, lfs_off_t off) { in lfs_dir_rawseek() argument
2772 dir->pos = lfs_min(2, off); in lfs_dir_rawseek()
2773 off -= dir->pos; in lfs_dir_rawseek()
2776 dir->id = (off > 0 && lfs_pair_cmp(dir->head, lfs->root) == 0); in lfs_dir_rawseek()
2778 while (off > 0) { in lfs_dir_rawseek()
2792 int diff = lfs_min(dir->m.count - dir->id, off); in lfs_dir_rawseek()
2795 off -= diff; in lfs_dir_rawseek()
2820 static int lfs_ctz_index(lfs_t *lfs, lfs_off_t *off) { in lfs_ctz_index() argument
2821 lfs_off_t size = *off; in lfs_ctz_index()
2829 *off = size - b*i - 4*lfs_popc(i); in lfs_ctz_index()
2836 lfs_size_t pos, lfs_block_t *block, lfs_off_t *off) { in lfs_ctz_find() argument
2839 *off = 0; in lfs_ctz_find()
2863 *off = pos; in lfs_ctz_find()
2871 lfs_block_t *block, lfs_off_t *off) { in lfs_ctz_extend() argument
2891 *off = 0; in lfs_ctz_extend()
2922 *off = noff; in lfs_ctz_extend()
2954 *off = 4*skips; in lfs_ctz_extend()
3032 file->off = 0;
3150 file->cache.off = 0;
3225 for (lfs_off_t i = 0; i < file->off; i++) {
3230 NULL, &file->cache, file->off-i,
3239 &file->cache, &lfs->rcache, file->off-i,
3260 file->cache.off = lfs->pcache.off;
3279 file->off = file->pos;
3440 file->off == lfs->cfg->block_size) {
3444 file->pos, &file->block, &file->off);
3450 file->off = file->pos;
3457 lfs_size_t diff = lfs_min(nsize, lfs->cfg->block_size - file->off);
3463 file->off, data, diff);
3470 file->block, file->off, data, diff);
3477 file->off += diff;
3526 file->off == lfs->cfg->block_size) {
3546 &file->block, &file->off);
3553 file->off = file->pos;
3560 lfs_size_t diff = lfs_min(nsize, lfs->cfg->block_size - file->off);
3563 file->block, file->off, data, diff);
3582 file->off += diff;
3637 lfs_soff_t off, int whence) { argument
3641 npos = off;
3643 if ((lfs_soff_t)file->pos + off < 0) {
3646 npos = file->pos + off;
3649 lfs_soff_t res = lfs_file_rawsize(lfs, file) + off;
3680 && noff >= file->cache.off
3681 && noff < file->cache.off + file->cache.size) {
3683 file->off = noff;
3733 file->cache.off = 0;
4274 lfs->free.off = 0;
4486 lfs->free.off = lfs->seed % lfs->block_count;
4704 disk->block, disk->off, &child, sizeof(child));
5126 lfs_off_t off; member
5146 lfs_off_t off; member
5159 lfs_off_t off; member
5181 lfs_off_t off, void *buffer, lfs_size_t size) { argument
5185 block, off, buffer, size);
5189 lfs_off_t off, lfs_size_t size, uint32_t *crc) { argument
5192 int err = lfs1_bd_read(lfs, block, off+i, &c, 1);
5292 dir->off = sizeof(dir->d);
5306 while (dir->off + sizeof(entry->d) > (0x7fffffff & dir->d.size)-4) {
5308 entry->off = dir->off;
5317 dir->off = sizeof(dir->d);
5321 int err = lfs1_bd_read(lfs, dir->pair[0], dir->off,
5328 entry->off = dir->off;
5329 dir->off += lfs1_entry_size(entry);
5359 while (dir.off + sizeof(entry.d) <= (0x7fffffff & dir.d.size)-4) {
5360 err = lfs1_bd_read(lfs, dir.pair[0], dir.off,
5367 dir.off += lfs1_entry_size(&entry);
5459 lfs->free.off = 0;
5585 entry1.off + 4+entry1.d.elen+entry1.d.alen,
5662 for (lfs_off_t i = 0; i < dir2.off; i++) {
5665 NULL, &lfs->rcache, dir2.off,
5694 dir2.off = sizeof(dir2.rev);
6034 lfs_soff_t off, int whence) { argument
6040 (void*)lfs, (void*)file, off, whence);
6043 lfs_soff_t res = lfs_file_rawseek(lfs, file, off, whence);
6172 int lfs_dir_seek(lfs_t *lfs, lfs_dir_t *dir, lfs_off_t off) { argument
6178 (void*)lfs, (void*)dir, off);
6180 err = lfs_dir_rawseek(lfs, dir, off);