Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/littlefs-project/littlefs.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lfs.h
diff options
context:
space:
mode:
authorChristopher Haster <chaster@utexas.edu>2018-01-21 02:30:40 +0300
committerChristopher Haster <chaster@utexas.edu>2018-01-21 04:22:44 +0300
commitd88f0ac02ff93b549418d38d464b5591fce4f688 (patch)
treea10fb4ed3bbcaed8d24180a04532c20c15a24fc7 /lfs.h
parent2ad435ed6309096979d6f90aa762632d23202a42 (diff)
Added lfs_file_truncate
As a copy-on-write filesystem, the truncate function is a very nice function to have, as it can take advantage of reusing the data already written out to disk.
Diffstat (limited to 'lfs.h')
-rw-r--r--lfs.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/lfs.h b/lfs.h
index b612f62..e85780a 100644
--- a/lfs.h
+++ b/lfs.h
@@ -364,6 +364,11 @@ lfs_ssize_t lfs_file_write(lfs_t *lfs, lfs_file_t *file,
lfs_soff_t lfs_file_seek(lfs_t *lfs, lfs_file_t *file,
lfs_soff_t off, int whence);
+// Truncates the size of the file to the specified size
+//
+// Returns a negative error code on failure.
+int lfs_file_truncate(lfs_t *lfs, lfs_file_t *file, lfs_off_t size);
+
// Return the position of the file
//
// Equivalent to lfs_file_seek(lfs, file, 0, LFS_SEEK_CUR)