Skip to content

Pure Rust implementation of littlefs #1165

@enum-class

Description

@enum-class

Hi @geky, @sosthene-nitrokey @duanjr, and the littlefs community,

We’ve been following this discussion in here with great interest. To directly address the challenges of porting littlefs to idiomatic, safe, and maintainable Rust, we’ve developed an LLM-powered C-to-Rust transpiler that goes far beyond mechanical translation (e.g., C2Rust).

We’ve already run our end-to-end pipeline on the full littlefs codebase and are currently in active testing.

Early Metrics vs. C2Rust (on littlefs core):

Tool RP decl RP deref RP arithmetic Unsafe Line
Our tool 54 46 28 54
c2rust 378 1474 377 8903

RP = Raw Pointer

Key advantages of our tool output:

  • Highly idiomatic: Uses Result, Option, iterators, Pin where appropriate
  • Minimal unsafe: Only in well-encapsulated, reviewed modules (e.g., intrusive lists)

We’d love your feedback:

  1. Are you open to reviewing a preview of the generated littlefs port?
    (We can share a public repo or draft PR with CI running C test equivalence.)

  2. Initial thoughts on LLM-assisted transpilation for embedded code?
    (Especially given the safety/code-size tradeoffs discussed.)

  3. Would a PR be welcome at this stage?
    Even as an experimental, parallel implementation (e.g., littlefs-rs), not to replace C, but to explore the design space.

We’re particularly excited to validate:

  • Stack usage & code size on real MCUs
  • Async API ergonomics

Looking forward to your thoughts, happy to hop on a call or share early artifacts.

Thanks again for the thoughtful discussion and for building such a solid foundation in littlefs!

Thanks
Saman

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions