Lines Matching refs:size
50 void *buffer, lfs_size_t size) { in lfs_bd_read() argument
52 if (off+size > lfs->cfg->block_size in lfs_bd_read()
57 while (size > 0) { in lfs_bd_read()
58 lfs_size_t diff = size; in lfs_bd_read()
61 off < pcache->off + pcache->size) { in lfs_bd_read()
64 diff = lfs_min(diff, pcache->size - (off-pcache->off)); in lfs_bd_read()
69 size -= diff; in lfs_bd_read()
78 off < rcache->off + rcache->size) { in lfs_bd_read()
81 diff = lfs_min(diff, rcache->size - (off-rcache->off)); in lfs_bd_read()
86 size -= diff; in lfs_bd_read()
94 if (size >= hint && off % lfs->cfg->read_size == 0 && in lfs_bd_read()
95 size >= lfs->cfg->read_size) { in lfs_bd_read()
105 size -= diff; in lfs_bd_read()
113 rcache->size = lfs_min( in lfs_bd_read()
120 rcache->off, rcache->buffer, rcache->size); in lfs_bd_read()
133 const void *buffer, lfs_size_t size) { in lfs_bd_cmp() argument
137 for (lfs_off_t i = 0; i < size; i += diff) { in lfs_bd_cmp()
140 diff = lfs_min(size-i, sizeof(dat)); 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
162 for (lfs_off_t i = 0; i < size; i += diff) { in lfs_bd_crc()
164 diff = lfs_min(size-i, sizeof(dat)); in lfs_bd_crc()
183 lfs_size_t diff = lfs_alignup(pcache->size, lfs->cfg->prog_size); in lfs_bd_flush()
233 const void *buffer, lfs_size_t size) { in lfs_bd_prog() argument
236 LFS_ASSERT(off + size <= lfs->cfg->block_size); in lfs_bd_prog()
238 while (size > 0) { in lfs_bd_prog()
243 lfs_size_t diff = lfs_min(size, in lfs_bd_prog()
249 size -= diff; in lfs_bd_prog()
251 pcache->size = lfs_max(pcache->size, off - pcache->off); in lfs_bd_prog()
252 if (pcache->size == lfs->cfg->cache_size) { in lfs_bd_prog()
270 pcache->size = 0; in lfs_bd_prog()
329 #define LFS_MKTAG(type, id, size) \ argument
330 (((lfs_tag_t)(type) << 20) | ((lfs_tag_t)(id) << 10) | (lfs_tag_t)(size))
332 #define LFS_MKTAG_IF(cond, type, id, size) \ argument
333 ((cond) ? LFS_MKTAG(type, id, size) : LFS_MKTAG(LFS_FROM_NOOP, 0, 0))
448 lfs_size_t size; member
453 fcrc->size = lfs_fromle32(fcrc->size); in lfs_fcrc_fromle32()
459 fcrc->size = lfs_tole32(fcrc->size); in lfs_fcrc_tole32()
467 ctz->size = lfs_fromle32(ctz->size); in lfs_ctz_fromle32()
473 ctz->size = lfs_tole32(ctz->size); in lfs_ctz_tole32()
557 const void *buffer, lfs_size_t size);
559 const void *buffer, lfs_size_t size);
585 void *buffer, lfs_size_t size);
587 void *buffer, lfs_size_t size);
607 if (off < lfs->free.size) { in lfs_alloc_lookahead()
625 lfs->free.size = 0; in lfs_alloc_drop()
635 lfs->free.size = lfs_min(8*lfs->cfg->lookahead_size, lfs->free.ack); in lfs_fs_rawgc()
653 while (lfs->free.i != lfs->free.size) { in lfs_alloc()
664 while (lfs->free.i != lfs->free.size && in lfs_alloc()
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()
769 while (size > 0) { in lfs_dir_getread()
770 lfs_size_t diff = size; in lfs_dir_getread()
773 off < pcache->off + pcache->size) { in lfs_dir_getread()
776 diff = lfs_min(diff, pcache->size - (off-pcache->off)); in lfs_dir_getread()
781 size -= diff; in lfs_dir_getread()
790 off < rcache->off + rcache->size) { in lfs_dir_getread()
793 diff = lfs_min(diff, rcache->size - (off-rcache->off)); in lfs_dir_getread()
798 size -= diff; 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()
1030 lfs_tag_id(tag) + diff, a[i].size), a[i].buffer); in lfs_dir_traverse()
1317 dir->pair[0], dir->off, fcrc.size, &fcrc_); in lfs_dir_fetchmatch()
1408 info->size = ctz.size; in lfs_dir_getinfo()
1410 info->size = lfs_tag_size(tag); in lfs_dir_getinfo()
1419 lfs_size_t size; member
1429 lfs_size_t diff = lfs_min(name->size, lfs_tag_size(tag)); in lfs_dir_find_match()
1438 if (name->size != lfs_tag_size(tag)) { in lfs_dir_find_match()
1439 return (name->size < lfs_tag_size(tag)) ? LFS_CMP_LT : LFS_CMP_GT; in lfs_dir_find_match()
1559 const void *buffer, lfs_size_t size) { in lfs_dir_commitprog() argument
1563 (const uint8_t*)buffer, size); in lfs_dir_commitprog()
1568 commit->crc = lfs_crc(commit->crc, buffer, size); in lfs_dir_commitprog()
1569 commit->off += size; in lfs_dir_commitprog()
1671 .size = lfs->cfg->prog_size, in lfs_dir_commitcrc()
1676 commit->block, noff, fcrc.size, &fcrc.crc); in lfs_dir_commitcrc()
1870 lfs_size_t *size = p; in lfs_dir_commit_size() local
1873 *size += lfs_tag_dsize(tag); in lfs_dir_commit_size()
2091 lfs_size_t size = 0; in lfs_dir_splittingcompact() local
2097 lfs_dir_commit_size, &size); in lfs_dir_splittingcompact()
2114 && size <= lfs_min( in lfs_dir_splittingcompact()
2154 lfs_ssize_t size = lfs_fs_rawsize(lfs); in lfs_dir_splittingcompact() local
2155 if (size < 0) { in lfs_dir_splittingcompact()
2156 return size; in lfs_dir_splittingcompact()
2161 if ((lfs_size_t)size < lfs->block_count/2) { in lfs_dir_splittingcompact()
2362 f->ctz.size > lfs->cfg->cache_size) { in lfs_dir_orphaningcommit()
2821 lfs_off_t size = *off; in lfs_ctz_index() local
2823 lfs_off_t i = size / b; in lfs_ctz_index()
2828 i = (size - 4*(lfs_popc(i-1)+2)) / b; in lfs_ctz_index()
2829 *off = size - b*i - 4*lfs_popc(i); in lfs_ctz_index()
2835 lfs_block_t head, lfs_size_t size, in lfs_ctz_find() argument
2837 if (size == 0) { in lfs_ctz_find()
2843 lfs_off_t current = lfs_ctz_index(lfs, &(lfs_off_t){size-1}); in lfs_ctz_find()
2870 lfs_block_t head, lfs_size_t size, in lfs_ctz_extend() argument
2889 if (size == 0) { in lfs_ctz_extend()
2895 lfs_size_t noff = size - 1; in lfs_ctz_extend()
2969 lfs_block_t head, lfs_size_t size, in lfs_ctz_traverse() argument
2971 if (size == 0) { in lfs_ctz_traverse()
2975 lfs_off_t index = lfs_ctz_index(lfs, &(lfs_off_t){size-1}); in lfs_ctz_traverse()
3109 file->id, file->cfg->attrs[i].size),
3120 if (file->cfg->attrs[i].size > lfs->attr_max) {
3147 file->ctz.size = lfs_tag_size(tag);
3151 file->cache.size = lfs->cfg->cache_size;
3154 if (file->ctz.size > 0) {
3158 lfs_min(file->cache.size, 0x3fe)),
3261 file->cache.size = lfs->pcache.size;
3307 .ctz.size = file->ctz.size,
3314 while (file->pos < file->ctz.size) {
3355 file->pos = lfs_max(file->pos, file->ctz.size);
3360 file->ctz.size = file->pos;
3390 lfs_size_t size; local
3396 size = file->ctz.size;
3404 size = sizeof(ctz);
3409 {LFS_MKTAG(type, file->id, size), buffer},
3425 void *buffer, lfs_size_t size) { argument
3427 lfs_size_t nsize = size;
3429 if (file->pos >= file->ctz.size) {
3434 size = lfs_min(size, file->ctz.size - file->pos);
3435 nsize = size;
3443 file->ctz.head, file->ctz.size,
3482 return size;
3486 void *buffer, lfs_size_t size) { argument
3499 return lfs_file_flushedread(lfs, file, buffer, size);
3505 const void *buffer, lfs_size_t size) { argument
3507 lfs_size_t nsize = size;
3510 lfs_max(file->pos+nsize, file->ctz.size) >
3531 file->ctz.head, file->ctz.size,
3589 return size;
3593 const void *buffer, lfs_size_t size) { argument
3604 if ((file->flags & LFS_O_APPEND) && file->pos < file->ctz.size) {
3605 file->pos = file->ctz.size;
3608 if (file->pos + size > lfs->file_max) {
3613 if (!(file->flags & LFS_F_WRITING) && file->pos > file->ctz.size) {
3616 file->pos = file->ctz.size;
3626 lfs_ssize_t nsize = lfs_file_flushedwrite(lfs, file, buffer, size);
3681 && noff < file->cache.off + file->cache.size) {
3700 static int lfs_file_rawtruncate(lfs_t *lfs, lfs_file_t *file, lfs_off_t size) { argument
3703 if (size > LFS_FILE_MAX) {
3709 if (size < oldsize) {
3711 if (size <= lfs_min(0x3fe, lfs_min(
3724 lfs->rcache.buffer, size);
3730 file->ctz.size = size;
3734 file->cache.size = lfs->cfg->cache_size;
3735 memcpy(file->cache.buffer, lfs->rcache.buffer, size);
3746 file->ctz.head, file->ctz.size,
3747 size-1, &file->block, &(lfs_off_t){0});
3754 file->pos = size;
3756 file->ctz.size = size;
3759 } else if (size > oldsize) {
3767 while (file->pos < size) {
3804 return lfs_max(file->pos, file->ctz.size);
3808 return file->ctz.size;
4039 uint8_t type, void *buffer, lfs_size_t size) { argument
4058 id, lfs_min(size, lfs->attr_max)),
4073 uint8_t type, const void *buffer, lfs_size_t size) { argument
4091 {LFS_MKTAG(LFS_TYPE_USERATTR + type, id, size), buffer}));
4097 uint8_t type, const void *buffer, lfs_size_t size) { argument
4098 if (size > lfs->attr_max) {
4102 return lfs_commitattr(lfs, path, type, buffer, size);
4275 lfs->free.size = lfs_min(8*lfs->cfg->lookahead_size,
4605 ctz.head, ctz.size, cb, data);
4630 f->ctz.head, f->ctz.size, cb, data);
5038 lfs_size_t *size = p; local
5039 *size += 1;
5044 lfs_size_t size = 0; local
5045 int err = lfs_fs_rawtraverse(lfs, lfs_fs_size_count, &size, false);
5050 return size;
5136 lfs_size_t size; member
5153 lfs_size_t size; member
5176 static void lfs1_crc(uint32_t *crc, const void *buffer, size_t size) { argument
5177 *crc = lfs_crc(*crc, buffer, size);
5181 lfs_off_t off, void *buffer, lfs_size_t size) { argument
5184 return lfs_bd_read(lfs, &lfs->pcache, &lfs->rcache, size,
5185 block, off, buffer, size);
5189 lfs_off_t off, lfs_size_t size, uint32_t *crc) { argument
5190 for (lfs_off_t i = 0; i < size; i++) {
5207 d->size = lfs_fromle32(d->size);
5214 d->size = lfs_tole32(d->size);
5265 if ((0x7fffffff & test.size) < sizeof(test)+4 ||
5266 (0x7fffffff & test.size) > lfs->cfg->block_size) {
5275 (0x7fffffff & test.size) - sizeof(test), &crc);
5306 while (dir->off + sizeof(entry->d) > (0x7fffffff & dir->d.size)-4) {
5307 if (!(0x80000000 & dir->d.size)) {
5359 while (dir.off + sizeof(entry.d) <= (0x7fffffff & dir.d.size)-4) {
5370 entry.d.u.file.head, entry.d.u.file.size, cb, data);
5460 lfs->free.size = 0;
5878 uint8_t type, void *buffer, lfs_size_t size) { argument
5884 (void*)lfs, path, type, buffer, size);
5886 lfs_ssize_t res = lfs_rawgetattr(lfs, path, type, buffer, size);
5895 uint8_t type, const void *buffer, lfs_size_t size) { argument
5901 (void*)lfs, path, type, buffer, size);
5903 err = lfs_rawsetattr(lfs, path, type, buffer, size);
5998 void *buffer, lfs_size_t size) { argument
6004 (void*)lfs, (void*)file, buffer, size);
6007 lfs_ssize_t res = lfs_file_rawread(lfs, file, buffer, size);
6016 const void *buffer, lfs_size_t size) { argument
6022 (void*)lfs, (void*)file, buffer, size);
6025 lfs_ssize_t res = lfs_file_rawwrite(lfs, file, buffer, size);
6051 int lfs_file_truncate(lfs_t *lfs, lfs_file_t *file, lfs_off_t size) { argument
6057 (void*)lfs, (void*)file, size);
6060 err = lfs_file_rawtruncate(lfs, file, size);