Code Monkey home page Code Monkey logo

Comments (3)

rsta2 avatar rsta2 commented on September 22, 2024

There are two different implementations of file system drivers for the FAT file system in Circle. The historic first in lib/fs/fat/, which has limited function and the ported FatFs library in addon/fatfs/ with full function and higher performance.

The first one uses a buffer cache, which is flushed by calling CFATFileSystem::Synchronize() or automatically, when a file is closed, which was open for write.

I suppose you are using circle-stdlib/-newlib, which is based on the second option (FatFs library). As I understand it, with FatFs you can power off your Raspberry Pi at any time, when no file is open for write. You do not need to explicitly un-mount the file system before. Furthermore, when a power off occurs, when a file is open for write, you can loose the contents of this file at maximum, not more. You can improve this situation even more, when you call fsync() from time to time for this file. fsync() is implemented in circle-newlib and calls the FatFs function f_sync() by itself. Please read this application note for info about possible data loss with FatFs.

Currently it seems impossible to me to modify one of these file system drivers for a fully synchronous operation, but perhaps the situation with FatFs is enough for you.

from circle.

kevinboone avatar kevinboone commented on September 22, 2024

Thank you for the prompt reply. I think the situation is perhaps worse with circle-stdlib than it is with Circle itself. If you're programming with Circle, then you know you're working outside an operating system. You know that you probably have to take actions in code that you would not take, if you were working on an operating system. In any case, you're most likely working with code specifically written for that environment.

Using circle-stdlib obscures the fact that there is no operating system, which is both its strength and its weakness. circle-stdlib makes it easy to port existing code and libraries that were originally intended for Unix-like systems, without having to make many changes. This is great, but can lead to problems.

On Linux, a background process flushes disk changes periodically. Also, modern Linux filesystems are journalling, so it's relatively easy to repair changes related to a bad shut-down. Without these protections, the developer has to take a lot more care. But if you're using code in existing libraries, it's not always easy to work out what changes need to be made.

In any event, if circle-stdlib uses ChaN's FATFS implementation directly, and not Circle's filesystem support, then this isn't a problem that can be solved in Circle itself. So please close this.

By the way -- is there a place to ask general questions about Circle, without having to raise an issue in GitHub? I have many questions ;)

from circle.

rsta2 avatar rsta2 commented on September 22, 2024

Understood. There is a Q&A category in the Discussions for asking questions without open an issue.

from circle.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.