Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Truncate with littlefs #7091

Closed
OscarGarciaF opened this issue Jun 1, 2018 · 3 comments
Closed

Truncate with littlefs #7091

OscarGarciaF opened this issue Jun 1, 2018 · 3 comments
Assignees

Comments

@OscarGarciaF
Copy link

How may i truncate with the littlefs?

I see that lfs.cpp has the method defined but LittleFileSystem.cpp does not have a file_truncate method
how may i accomplish this?

Also may i know what's the maximum size of a file in the littlefs?
@geky

@geky
Copy link
Contributor

geky commented Jun 4, 2018

Hi @OscarGarciaF, you will need a file_truncate function that calls into littlefs like this:

int LittleFileSystem::file_truncate(fs_file_t file, off_t length)
{
    lfs_file_t *f = (lfs_file_t *)file;
    _mutex.lock();
    LFS_INFO("file_truncate(%p)", file);
    int err = lfs_file_truncate(&_lfs, f, length);
    LFS_INFO("file_truncate -> %d", lfs_toerror(err));
    _mutex.unlock();
    return lfs_toerror(err);
}

Sorry about all the hoops you've been having to jump through, truncate was added very recently and you've probably noticed it's not integrated into Mbed OS yet.

Files in littlefs limited by a 32-bit file size. So ~4GB.

(related: #7010)
[Mirrored to Jira]

@dannybenor
Copy link

dannybenor commented Jun 26, 2018

Please do not merge
[Mirrored to Jira]

@ARMmbed ARMmbed deleted a comment from ciarmcom Oct 2, 2018
@adbridge
Copy link
Contributor

adbridge commented Oct 4, 2018

Internal Jira reference: https://jira.arm.com/browse/IOTSTOR-445

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants