Author Topic: MANAGED_FILES  (Read 3524 times)

Offline neil

  • Sr. Member
  • ****
  • Posts: 433
    • View Profile
« on: November 14, 2014, 06:29:32 PM »
Hi Mark,
  I have just upgraded to the latest uFat and noticed MANAGED_FILES isnt defined , but see UTFAT_MANAGED_MODE defined as #10 in the .h file.  Does this mean I havent been using managed mode?

Do I have to #define MANAGED_FILES too?  If so, what is the value after it represent?



« Last Edit: November 14, 2014, 07:02:41 PM by neil »

Offline mark

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3187
    • View Profile
    • uTasker
« Reply #1 on: November 14, 2014, 09:00:49 PM »
Hi Neil

MANAGED_FILES is used for other storage types (like internal Flash or SPI flash). The number of such managed files at the same time is defined by MANAGED_FILE_COUNT.

The SD card used UTMANAGED_FILE_COUNT can be missing or have a value of UTMANAGED_FILE_COUNT 0 (this is for backward compatibility) to be disabled > 1 is enabled for this many files. This allows files to be protected from another (eg. don't allow more than one write to be opened at the same time but keep reads synchronised)

A new feature can be enabled separately:
UTFAT_FILE_CACHE_POOL - this adds optional data cache to indivicual files and can greatly speed up writing lots of small amounts of data to a file.

Some new options don't need any additional basic support to be enabled - such as opening a file with teh property UTFAT_COMMIT_FILE_ON_CLOSE will avoid writing file changes on each write and only update on a file close. This can save a lot of writes to the file object but has a risk of losing written data if not closed before a reset - the user can therfore decide on a usage basis which of the properties speed vs security are most important for each file used.
Furthermore the support for LFN creation, renaming etc. has been greatlys extended with workaroudn for avoiding Microsoft patent and various advanced functiosn for analysing files and deleted files and undelete.

You should find the options and a description of them in the latest utFAT document: