Squashed commit of the following:

fs/smartfs:  Add logic needed to ftruncate to shrink a file to any arbitrary size.
    fs/smartfs:  Repartition some functionality to better fit in new ftruncate features.
This commit is contained in:
Gregory Nutt
2018-01-06 10:42:36 -06:00
parent 8b97ea95c7
commit 17cedb6b20
5 changed files with 669 additions and 559 deletions
+1 -1
View File
@@ -147,7 +147,7 @@ int sim_bringup(void)
#if defined(CONFIG_MTD_SMART) && defined(CONFIG_FS_SMARTFS)
/* Initialize a SMART Flash block device and bind it to the MTD
* ./device.
* device.
*/
smart_initialize(0, mtd, NULL);
+1
View File
@@ -16,6 +16,7 @@ if FS_SMARTFS
config SMARTFS_ERASEDSTATE
hex "FLASH erased state"
default 0xff
range 0x00 0xff
---help---
The erased state of FLASH.
This must have one of the values of 0xff or 0x00.
+24 -15
View File
@@ -340,7 +340,7 @@ struct smartfs_mountpt_s
****************************************************************************/
/****************************************************************************
* Internal function prototypes
* Public Functions
****************************************************************************/
/* Semaphore access for internal use */
@@ -354,28 +354,37 @@ struct smartfs_mountpt_s;
/* Utility functions */
int smartfs_mount(struct smartfs_mountpt_s *fs, bool writeable);
int smartfs_mount(FAR struct smartfs_mountpt_s *fs, bool writeable);
int smartfs_unmount(struct smartfs_mountpt_s *fs);
int smartfs_unmount(FAR struct smartfs_mountpt_s *fs);
int smartfs_finddirentry(struct smartfs_mountpt_s *fs,
struct smartfs_entry_s *direntry, const char *relpath,
uint16_t *parentdirsector, const char **filename);
int smartfs_finddirentry(FAR struct smartfs_mountpt_s *fs,
FAR struct smartfs_entry_s *direntry, FAR const char *relpath,
FAR uint16_t *parentdirsector, FAR const char **filename);
int smartfs_createentry(struct smartfs_mountpt_s *fs,
uint16_t parentdirsector, const char* filename,
int smartfs_createentry(FAR struct smartfs_mountpt_s *fs,
uint16_t parentdirsector, FAR const char* filename,
uint16_t type,
mode_t mode, struct smartfs_entry_s *direntry,
mode_t mode, FAR struct smartfs_entry_s *direntry,
uint16_t sectorno, FAR struct smartfs_ofile_s *sf);
int smartfs_deleteentry(struct smartfs_mountpt_s *fs,
struct smartfs_entry_s *entry);
int smartfs_deleteentry(FAR struct smartfs_mountpt_s *fs,
FAR struct smartfs_entry_s *entry);
int smartfs_countdirentries(struct smartfs_mountpt_s *fs,
struct smartfs_entry_s *entry);
int smartfs_countdirentries(FAR struct smartfs_mountpt_s *fs,
FAR struct smartfs_entry_s *entry);
int smartfs_truncatefile(struct smartfs_mountpt_s *fs,
struct smartfs_entry_s *entry, FAR struct smartfs_ofile_s *sf);
int smartfs_sync_internal(FAR struct smartfs_mountpt_s *fs,
FAR struct smartfs_ofile_s *sf);
off_t smartfs_seek_internal(FAR struct smartfs_mountpt_s *fs,
FAR struct smartfs_ofile_s *sf, off_t offset, int whence);
int smartfs_shrinkfile(FAR struct smartfs_mountpt_s *fs,
FAR struct smartfs_ofile_s *sf, off_t length);
int smartfs_extendfile(FAR struct smartfs_mountpt_s *fs,
FAR struct smartfs_ofile_s *sf, off_t length);
uint16_t smartfs_rdle16(FAR const void *val);
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff