Commit graph

43 commits

Author SHA1 Message Date
Ha Thach
bba4b53a2d
Merge pull request #829 from attermann/file_term
Null termination of file name when max length
2024-07-18 17:22:07 +07:00
Chad Attermann
1b12011507 Null termination of file name when max length
File names are returned unterminated in the edge case where their length
is max size This is due to the fact that strncpy does terminate the
destination string when the source string is greater than or equal to
the specifid maximum length.
2024-07-15 09:01:40 -06:00
Chad Attermann
236e434296 Additionally clearing pointers just in case
Clearing `_file` and `_dir` pointers after freeing on failure to open
just in case close() is later called.

To elaborate, the `_file` and `_dir` pointers are normally freed and
cleared by _close(), but when a failure occurs upon opening, these
pointers were being left orphaned since calling close() after failure to
open doesn't make much sense, and indeed caused serious issues within
lfs.
2024-07-12 13:18:40 -06:00
Chad Attermann
1ce5cf13d2 Fix memory leak on failure to open
Fixes leak of memory caused by failure to free file and directory
structures when open fails.
2024-07-12 12:42:53 -06:00
hathach
23f0b09605 add tinyusb header across libraries 2021-06-02 13:26:54 +07:00
hathach
c25d93268a fix warnings 2020-08-04 16:34:09 +07:00
Ha Thach
f9e71e746f
Merge pull request #513 from meshtastic/master
Add a rename(oldfilename, newfilename) method to LittleFS class
2020-07-03 20:51:17 +07:00
Steven James
85b6e26dc9 Adafruit_LittleFS_File.cpp::truncate: change default value of ret to
LFS_ERR_ISDIR.
2020-06-26 04:04:44 -04:00
Steven James
4a26462db9 Truncate should return false when performed on a directory. 2020-06-25 11:29:11 -04:00
Steven James
778529c301 Add truncate method to Adafruit_LittleFS_File. 2020-06-25 03:32:04 -04:00
geeksville
c0c87b0dc7 Add a rename(oldfilename, newfilename) method to LittleFS class 2020-05-25 10:10:06 -07:00
hathach
045f4f8cca partial revert PRITNF in lfs_util.h due to compilation error 2020-03-20 11:32:42 +07:00
Henry Gabryjelski
4565d0cd7d Use uppercase PRINTF.
This is a step in preparation for the ability to
change the default handler for printf(), such as
when advanced debug output capabilities make it
more performant to output via an alternative route.
2020-03-11 15:25:39 -07:00
hathach
78464dd6e3 skip lock FS for File name()/isDirectory()/isOpen() 2020-01-07 12:04:50 +07:00
hathach
f8cfa3d727 add _lockFS()/_unlockFS() to Adafruit_LittleFS 2020-01-07 11:50:31 +07:00
Henry Gabryjelski
76987ca28e Rename internal lock/unlock APIs 2020-01-06 08:36:08 -08:00
Henry Gabryjelski
2451ae0cb2 make File::operator bool(void) redirect to isOpen() 2020-01-06 08:25:54 -08:00
Henry Gabryjelski
d53387455c Remove now-unused private constructor 2020-01-06 08:25:54 -08:00
Henry Gabryjelski
d56df88961 remove deprecation 2020-01-06 08:25:54 -08:00
Henry Gabryjelski
39faf9f823 Also serialize Adafruit_LittleFS_File.
This solution appears to work.  However, it does not
follow all best practices.  For example, the use of
friend declarations, and the need to make the lock/unlock
functions in File public (in order to get friend status).
However, it passes the stress test without errors.
2020-01-06 08:25:53 -08:00
Henry Gabryjelski
35b5d4b548 re-enable logging that was temporarily removed 2020-01-06 08:25:53 -08:00
Henry Gabryjelski
c697872139 Remove wrapper functions
Per @hathach's PR, this removes the wrapper functions.
2020-01-06 08:25:53 -08:00
Henry Gabryjelski
e976c6592c Serialize at the LFS layer 2020-01-06 08:25:50 -08:00
Henry Gabryjelski
4904ee5a9d Fix printf format specifier to match length of data type.
Here, LFS uses an int for return value, which is 16-bit.
The VERIFY_MESS expects a 32-bit value, so cast here at
the boundary between the two sets of files.
2019-10-05 18:02:26 -07:00
Henry Gabryjelski
f0f6b1041a Fix printf format specifier to match length of data type. 2019-10-05 18:02:09 -07:00
hathach
dda9dba070 bump version to 0.11..0 2019-05-31 14:53:39 +07:00
hathach
b99cae32b6 fix #276 rename macro FILE_READ/WRITE to enum FILE_O_READ/WRITE
to avoid conflict with other filesystem define
2019-05-30 18:09:07 +07:00
hathach
fda089980e move internal flash examples 2019-05-30 16:53:51 +07:00
hathach
187ddc6058 move InternalFS to its own subclass of LFS 2019-05-30 16:48:48 +07:00
hathach
20c257daa2 more internal flash clean up 2019-05-30 16:16:57 +07:00
hathach
58c47d3298 make lfs config as external input for flexibilty 2019-05-30 12:48:15 +07:00
hathach
063a668a04 rename lfs namespace 2019-05-29 17:25:40 +07:00
hathach
0b0fc8e9d6 clean up 2019-05-29 17:19:21 +07:00
hathach
d11a553dff rename lfs examples 2019-05-29 17:18:44 +07:00
hathach
99b6de3207 improve cdc core 2019-05-29 15:17:12 +07:00
hathach
a122cef5a8 remove external examples 2019-05-29 14:59:45 +07:00
hathach
f2e7ef6fc4 revert to use malloc for lfs file/dir data due to lfs pointer matching 2019-05-29 14:58:52 +07:00
hathach
6ca6be16c9 use static instead of malloc file/dir handle for lfs 2019-05-28 16:58:03 +07:00
hathach
fe375eb448 clean up lfs 2019-05-27 22:46:27 +07:00
hathach
616162fe25 refactor lfs 2019-05-27 22:05:55 +07:00
hathach
86d63af7c8 open, read, write seems to work 2019-05-27 21:18:53 +07:00
hathach
1529ed0380 clean up 2019-05-24 23:54:57 +07:00
hathach
87a3907912 rename FileSystem to Adafruit_LittleFS 2019-05-24 23:51:55 +07:00