remove stackfunction

This commit is contained in:
Steven Dan
2026-03-30 20:13:05 +08:00
parent fe0028bba4
commit c3202488f6
2 changed files with 36 additions and 38 deletions

View File

@@ -41,7 +41,7 @@ static inline void lfs_cache_zero(lfs_t *lfs, lfs_cache_t *pcache) {
pcache->block = LFS_BLOCK_NULL;
}
#pragma stackfunction 100
static int lfs_bd_read(lfs_t *lfs,
const lfs_cache_t *pcache, lfs_cache_t *rcache, lfs_size_t hint,
lfs_block_t block, lfs_off_t off,
@@ -125,7 +125,7 @@ static int lfs_bd_read(lfs_t *lfs,
return 0;
}
#pragma stackfunction 100
static int lfs_bd_cmp(lfs_t *lfs,
const lfs_cache_t *pcache, lfs_cache_t *rcache, lfs_size_t hint,
lfs_block_t block, lfs_off_t off,
@@ -153,7 +153,7 @@ static int lfs_bd_cmp(lfs_t *lfs,
return LFS_CMP_EQ;
}
#pragma stackfunction 100
static int lfs_bd_crc(lfs_t *lfs,
const lfs_cache_t *pcache, lfs_cache_t *rcache, lfs_size_t hint,
lfs_block_t block, lfs_off_t off, lfs_size_t size, uint32_t *crc) {
@@ -176,7 +176,7 @@ static int lfs_bd_crc(lfs_t *lfs,
}
#ifndef LFS_READONLY
#pragma stackfunction 100
static int lfs_bd_flush(lfs_t *lfs,
lfs_cache_t *pcache, lfs_cache_t *rcache, bool validate) {
if (pcache->block != LFS_BLOCK_NULL && pcache->block != LFS_BLOCK_INLINE) {
@@ -212,7 +212,7 @@ static int lfs_bd_flush(lfs_t *lfs,
#endif
#ifndef LFS_READONLY
#pragma stackfunction 100
static int lfs_bd_sync(lfs_t *lfs,
lfs_cache_t *pcache, lfs_cache_t *rcache, bool validate) {
lfs_cache_drop(lfs, rcache);
@@ -229,7 +229,7 @@ static int lfs_bd_sync(lfs_t *lfs,
#endif
#ifndef LFS_READONLY
#pragma stackfunction 100
static int lfs_bd_prog(lfs_t *lfs,
lfs_cache_t *pcache, lfs_cache_t *rcache, bool validate,
lfs_block_t block, lfs_off_t off,
@@ -278,7 +278,7 @@ static int lfs_bd_prog(lfs_t *lfs,
#endif
#ifndef LFS_READONLY
#pragma stackfunction 100
static int lfs_bd_erase(lfs_t *lfs, lfs_block_t block) {
LFS_ASSERT(block < lfs->block_count);
int err = lfs->cfg->erase(lfs->cfg, block);
@@ -653,7 +653,7 @@ static int lfs_alloc_scan(lfs_t *lfs) {
//
// note we limit the lookahead buffer to at most the amount of blocks
// checkpointed, this prevents the math in lfs_alloc from underflowing
lfs->lookahead.start = (lfs->lookahead.start + lfs->lookahead.next)
lfs->lookahead.start = (lfs->lookahead.start + lfs->lookahead.next)
% lfs->block_count;
lfs->lookahead.next = 0;
lfs->lookahead.size = lfs_min(
@@ -860,7 +860,7 @@ static int lfs_dir_getread(lfs_t *lfs, const lfs_mdir_t *dir,
}
#ifndef LFS_READONLY
#pragma stackfunction 100
static int lfs_dir_traverse_filter(void *p,
lfs_tag_t tag, const void *buffer) {
lfs_tag_t *filtertag = p;
@@ -921,7 +921,7 @@ struct lfs_dir_traverse {
struct lfs_diskoff disk;
};
#pragma stackfunction 200
static int lfs_dir_traverse(lfs_t *lfs,
const lfs_mdir_t *dir, lfs_off_t off, lfs_tag_t ptag,
const struct lfs_mattr *attrs, int attrcount,
@@ -1117,7 +1117,7 @@ popped:
}
#endif
#pragma stackfunction 100
static lfs_stag_t lfs_dir_fetchmatch(lfs_t *lfs,
lfs_mdir_t *dir, const lfs_block_t pair[2],
lfs_tag_t fmask, lfs_tag_t ftag, uint16_t *id,
@@ -1128,7 +1128,7 @@ static lfs_stag_t lfs_dir_fetchmatch(lfs_t *lfs,
// if either block address is invalid we return LFS_ERR_CORRUPT here,
// otherwise later writes to the pair could fail
if (lfs->block_count
if (lfs->block_count
&& (pair[0] >= lfs->block_count || pair[1] >= lfs->block_count)) {
return LFS_ERR_CORRUPT;
}
@@ -1944,7 +1944,7 @@ struct lfs_dir_commit_commit {
#endif
#ifndef LFS_READONLY
#pragma stackfunction 100
__attribute__((fptrgroup("lfs_cb_tag_fptr_grp")))
static int lfs_dir_commit_commit(void *p, lfs_tag_t tag, const void *buffer) {
struct lfs_dir_commit_commit *commit = p;
@@ -1953,7 +1953,7 @@ static int lfs_dir_commit_commit(void *p, lfs_tag_t tag, const void *buffer) {
#endif
#ifndef LFS_READONLY
#pragma stackfunction 100
static bool lfs_dir_needsrelocation(lfs_t *lfs, lfs_mdir_t *dir) {
// If our revision count == n * block_cycles, we should force a relocation,
// this is how littlefs wear-levels at the metadata-pair level. Note that we
@@ -1967,7 +1967,7 @@ static bool lfs_dir_needsrelocation(lfs_t *lfs, lfs_mdir_t *dir) {
#endif
#ifndef LFS_READONLY
#pragma stackfunction 100
static int lfs_dir_compact(lfs_t *lfs,
lfs_mdir_t *dir, const struct lfs_mattr *attrs, int attrcount,
lfs_mdir_t *source, uint16_t begin, uint16_t end) {
@@ -2141,7 +2141,7 @@ relocate:
#endif
#ifndef LFS_READONLY
#pragma stackfunction 100
static int lfs_dir_splittingcompact(lfs_t *lfs, lfs_mdir_t *dir,
const struct lfs_mattr *attrs, int attrcount,
lfs_mdir_t *source, uint16_t begin, uint16_t end) {
@@ -2251,7 +2251,7 @@ static int lfs_dir_splittingcompact(lfs_t *lfs, lfs_mdir_t *dir,
#endif
#ifndef LFS_READONLY
#pragma stackfunction 100
static int lfs_dir_relocatingcommit(lfs_t *lfs, lfs_mdir_t *dir,
const lfs_block_t pair[2],
const struct lfs_mattr *attrs, int attrcount,
@@ -2425,7 +2425,7 @@ fixmlist:;
#endif
#ifndef LFS_READONLY
#pragma stackfunction 100
static int lfs_dir_orphaningcommit(lfs_t *lfs, lfs_mdir_t *dir,
const struct lfs_mattr *attrs, int attrcount) {
// check for any inline files that aren't RAM backed and
@@ -2619,7 +2619,7 @@ static int lfs_dir_orphaningcommit(lfs_t *lfs, lfs_mdir_t *dir,
#endif
#ifndef LFS_READONLY
#pragma stackfunction 100
static int lfs_dir_commit(lfs_t *lfs, lfs_mdir_t *dir,
const struct lfs_mattr *attrs, int attrcount) {
int orphans = lfs_dir_orphaningcommit(lfs, dir, attrs, attrcount);
@@ -2644,7 +2644,7 @@ static int lfs_dir_commit(lfs_t *lfs, lfs_mdir_t *dir,
/// Top level directory operations ///
#ifndef LFS_READONLY
#pragma stackfunction 100
static int lfs_mkdir_(lfs_t *lfs, const char *path) {
// deorphan if we haven't yet, needed at most once after poweron
int err = lfs_fs_forceconsistency(lfs);
@@ -2740,7 +2740,7 @@ static int lfs_mkdir_(lfs_t *lfs, const char *path) {
return 0;
}
#endif
#pragma stackfunction 100
static int lfs_dir_open_(lfs_t *lfs, lfs_dir_t *dir, const char *path) {
lfs_stag_t tag = lfs_dir_find(lfs, &dir->m, &path, NULL);
if (tag < 0) {
@@ -2785,7 +2785,7 @@ static int lfs_dir_open_(lfs_t *lfs, lfs_dir_t *dir, const char *path) {
return 0;
}
#pragma stackfunction 100
static int lfs_dir_close_(lfs_t *lfs, lfs_dir_t *dir) {
// remove from list of mdirs
lfs_mlist_remove(lfs, (struct lfs_mlist *)dir);
@@ -2793,7 +2793,7 @@ static int lfs_dir_close_(lfs_t *lfs, lfs_dir_t *dir) {
return 0;
}
#pragma stackfunction 100
static int lfs_dir_read_(lfs_t *lfs, lfs_dir_t *dir, struct lfs_info *info) {
memset(info, 0, sizeof(*info));
@@ -2839,7 +2839,7 @@ static int lfs_dir_read_(lfs_t *lfs, lfs_dir_t *dir, struct lfs_info *info) {
return true;
}
#pragma stackfunction 100
static int lfs_dir_seek_(lfs_t *lfs, lfs_dir_t *dir, lfs_off_t off) {
// simply walk from head dir
int err = lfs_dir_rewind_(lfs, dir);
@@ -3289,7 +3289,7 @@ static int lfs_file_close_(lfs_t *lfs, lfs_file_t *file) {
#ifndef LFS_READONLY
#pragma stackfunction 100
static int lfs_file_relocate(lfs_t *lfs, lfs_file_t *file) {
while (true) {
// just relocate what exists into new block
@@ -3455,7 +3455,7 @@ relocate:
}
#ifndef LFS_READONLY
#pragma stackfunction 100
static int lfs_file_sync_(lfs_t *lfs, lfs_file_t *file) {
if (file->flags & LFS_F_ERRED) {
// it's not safe to do anything if our file errored
@@ -3597,7 +3597,7 @@ static lfs_ssize_t lfs_file_read_(lfs_t *lfs, lfs_file_t *file,
#ifndef LFS_READONLY
#pragma stackfunction 100
static lfs_ssize_t lfs_file_flushedwrite(lfs_t *lfs, lfs_file_t *file,
const void *buffer, lfs_size_t size) {
const uint8_t *data = buffer;
@@ -3682,7 +3682,7 @@ relocate:
return size;
}
#pragma stackfunction 100
static lfs_ssize_t lfs_file_write_(lfs_t *lfs, lfs_file_t *file,
const void *buffer, lfs_size_t size) {
LFS_ASSERT((file->flags & LFS_O_WRONLY) == LFS_O_WRONLY);
@@ -3727,7 +3727,7 @@ static lfs_ssize_t lfs_file_write_(lfs_t *lfs, lfs_file_t *file,
}
#endif
#pragma stackfunction 100
static lfs_soff_t lfs_file_seek_(lfs_t *lfs, lfs_file_t *file,
lfs_soff_t off, int whence) {
// find new pos
@@ -3786,7 +3786,7 @@ static lfs_soff_t lfs_file_seek_(lfs_t *lfs, lfs_file_t *file,
}
#ifndef LFS_READONLY
#pragma stackfunction 100
static int lfs_file_truncate_(lfs_t *lfs, lfs_file_t *file, lfs_off_t size) {
LFS_ASSERT((file->flags & LFS_O_WRONLY) == LFS_O_WRONLY);
@@ -4683,7 +4683,7 @@ static int lfs_unmount_(lfs_t *lfs) {
/// Filesystem filesystem operations ///
#pragma stackfunction 100
static int lfs_fs_stat_(lfs_t *lfs, struct lfs_fsinfo *fsinfo) {
// if the superblock is up-to-date, we must be on the most recent
// minor version of littlefs
@@ -4724,7 +4724,7 @@ static int lfs_fs_stat_(lfs_t *lfs, struct lfs_fsinfo *fsinfo) {
return 0;
}
#pragma stackfunction 100
int lfs_fs_traverse_(lfs_t *lfs,
int (* __attribute__((fptrgroup("lfs_cb_block_fptr_grp"))) cb)(void *data, lfs_block_t block), void *data,
bool includeorphans) {
@@ -6201,7 +6201,7 @@ int lfs_file_close(lfs_t *lfs, lfs_file_t *file) {
}
#ifndef LFS_READONLY
#pragma stackfunction 100
int lfs_file_sync(lfs_t *lfs, lfs_file_t *file) {
int err = LFS_LOCK(lfs->cfg);
if (err) {
@@ -6557,4 +6557,3 @@ int lfs_migrate(lfs_t *lfs, const struct lfs_config *cfg) {
return err;
}
#endif