• AVR Freaks

Hot!MPFS Configuration: SYS_FS_USE_LFN

Author
Richard Hambly
New Member
  • Total Posts : 7
  • Reward points : 0
  • Joined: 2011/12/30 14:06:28
  • Location: 0
  • Status: offline
2020/06/24 09:47:45 (permalink)
5 (1)

MPFS Configuration: SYS_FS_USE_LFN

I am working to apply Harmony 3 to an old design with a PIC32MX795F512L. I am stuck on an issue with the mpfs file system and I ran across the following in configuration.h. 
 
#define SYS_FS_USE_LFN 1
 
I am not sure why it is enabled. Similar application examples do not have it. I couldn't find the parameter in Harmony 3 Configurator that enabled this. Looking over the code, I suspect that LFN may mean ""Logical File Name" but I am not sure. What does it mean? I need to know if it should be on or off.
 
Just to see if this is related to the problems I am having I commented it out. I also tried setting "1" to "0" which is the same thing.I found two bugs in the Harmony 3 library by doing this. The file sys_fs.c lacks needed conditionals so it will not compile without SYS_FS_USE_LFN.
 
my fix in sys_fs.c is:
#if SYS_FS_USE_LFN
  /* If we have come to end of directory */
  if (stat->lfname != NULL)
  {
    /* If LFN is Enabled but filename fits into Short file name */
    if ((stat->lfname[0] == '\0') && (stat->fname[0] == '\0'))
     {
        errorValue = SYS_FS_ERROR_NO_FILE;
        return SYS_FS_RES_FAILURE;
      }
    }
    else
#endif
    if (stat->fname[0] == '\0')
    {
      errorValue = SYS_FS_ERROR_NO_FILE;
      return SYS_FS_RES_FAILURE;
    }
    /* Firstly, match the file attribute with the requested attribute */
    if ((stat->fattrib & attr) == attr)
    {
#if SYS_FS_USE_LFN
      if((stat->lfname != NULL) && (stat->lfname[0] != '\0'))
      {
        /* File name is LFN */
        fileName = stat->lfname;
      }
    else
#endif
    {
      /* File name fits in 8.3 format */
      fileName = stat->fname;
    }
    if(SYS_FS_StringWildCardCompare(name, fileName) == true)
    {
      return SYS_FS_RES_SUCCESS;
    }
  }
 
#1

2 Replies Related Threads

    NKurzman
    A Guy on the Net
    • Total Posts : 18854
    • Reward points : 0
    • Joined: 2008/01/16 19:33:48
    • Location: 0
    • Status: offline
    Re: MPFS Configuration: SYS_FS_USE_LFN 2020/06/24 10:25:11 (permalink)
    5 (1)
    Use Long File Name.  without that you would need to use 8.3 names  or filna~1.txt
     
    #2
    Richard Hambly
    New Member
    • Total Posts : 7
    • Reward points : 0
    • Joined: 2011/12/30 14:06:28
    • Location: 0
    • Status: offline
    Re: MPFS Configuration: SYS_FS_USE_LFN 2020/06/24 10:50:38 (permalink)
    0
    Thank you. I'll leave it on.
     
    #3
    Jump to:
    © 2020 APG vNext Commercial Version 4.5