Renamed lfs_fs_findfreeblocks -> lfs_fs_gc, tweaked documentation

The idea is in the future this function may be extended to support other
block janitorial work. In such a case calling this lfs_fs_gc provides a
more general name that can include other operations.

This is currently just wishful thinking, however.
This commit is contained in:
Christopher Haster
2023-09-12 00:06:04 -05:00
parent 63e4408f2a
commit 6b33ee5e34
3 changed files with 26 additions and 21 deletions

View File

@@ -26,7 +26,7 @@ code = '''
}
for (int n = 0; n < FILES; n++) {
if (GC) {
lfs_fs_findfreeblocks(&lfs) => 0;
lfs_fs_gc(&lfs) => 0;
}
size_t size = strlen(names[n]);
for (lfs_size_t i = 0; i < SIZE; i += size) {
@@ -81,7 +81,7 @@ code = '''
memcpy(buffer, names[n], size);
for (int i = 0; i < SIZE; i += size) {
if (GC) {
lfs_fs_findfreeblocks(&lfs) => 0;
lfs_fs_gc(&lfs) => 0;
}
lfs_file_write(&lfs, &file, buffer, size) => size;
}
@@ -255,8 +255,8 @@ code = '''
}
res => LFS_ERR_NOSPC;
// note that lfs_fs_findfreeblocks should not error here
lfs_fs_findfreeblocks(&lfs) => 0;
// note that lfs_fs_gc should not error here
lfs_fs_gc(&lfs) => 0;
lfs_file_close(&lfs, &file) => 0;
lfs_unmount(&lfs) => 0;
@@ -309,8 +309,8 @@ code = '''
}
res => LFS_ERR_NOSPC;
// note that lfs_fs_findfreeblocks should not error here
lfs_fs_findfreeblocks(&lfs) => 0;
// note that lfs_fs_gc should not error here
lfs_fs_gc(&lfs) => 0;
lfs_file_close(&lfs, &file) => 0;
lfs_unmount(&lfs) => 0;
@@ -351,8 +351,8 @@ code = '''
count += 1;
}
err => LFS_ERR_NOSPC;
// note that lfs_fs_findfreeblocks should not error here
lfs_fs_findfreeblocks(&lfs) => 0;
// note that lfs_fs_gc should not error here
lfs_fs_gc(&lfs) => 0;
lfs_file_close(&lfs, &file) => 0;
lfs_remove(&lfs, "exhaustion") => 0;
@@ -451,8 +451,8 @@ code = '''
break;
}
}
// note that lfs_fs_findfreeblocks should not error here
lfs_fs_findfreeblocks(&lfs) => 0;
// note that lfs_fs_gc should not error here
lfs_fs_gc(&lfs) => 0;
lfs_file_close(&lfs, &file) => 0;
lfs_unmount(&lfs) => 0;