I'm looking for the reason of many LOST_CHAIN errors happening in a FTPSRV application and, while looking, spotted 2 inconsistencies in the MQX 220.127.116.11/2 patches that got my attention:
The PDF says that the line:
else if (sp_ptr->ATTRIBUTE & MFS_SEARCH_SUBDIR)
should be change to:
else if ((sp_ptr->ATTRIBUTE & 0x3F) == MFS_SEARCH_SUBDIR)
but this is NOT what the patch does!
The patch changes the order of condition checking and also the following line:
else if (sp_ptr->ATTRIBUTE & MFS_SEARCH_NORMAL)
else if ((sp_ptr->ATTRIBUTE & 0x3F) == MFS_SEARCH_NORMAL)
So - which line should be changed? The one containing SEARCH_SUBDIR or the one containing SEARCH_NORMAL, or both? Which one is right - the PDF, the patch, or neither of them? As the PDF mentions the MFS_SEARCH_SUBDIR in the issue explanation, I suspect the patch may not be correct!
In many places this patch changes the:
line of code to outside of the nonzero checking condition due to a +1/-1 error - however there is a place (that looks important) in which it doesn't modify: function MFS_lfn_chain_extract in file mfs_lfn.c
Was that meant to be in this way or did you miss this change?
I'm having some trouble with MFS - some files are not being found while I'm performing a FTP upload through RTCS app ftpsrv. I'm debugging it and the error returned by MQX when trying to fopen the file is 0x30F0 - which is, according to mqx.h, FS_LOST_CHAIN - and this is the reason I'm looking for help. I've also experienced some other weird behavior on MFS which I couldn't explain and may be related to this, but I couldn't get more clues (the errors happened on production boards). I've already tried correcting the lfn_chain_extract function already according to MQX-5537 comments above, but it didn't help
UPDATE: I've just figured out what the problem probably is about - I just can't create directories whose filename has more than 8 characters! To test it, I've just executed the following command on my httpd dir (my shell is a regular MQX Shell, as in example supplied in MQX files):
shell> pwd a:\httpd shell> mkdir a2345678 shell> cd a2345678 shell> write a.txt 1 shell> type a.txt 0 shell> del a.txt shell> cd .. shell> rmdir a2345678 shell> mkdir a23456789 shell> cd a23456789 shell> write a.txt 1 Error, unable to open file a.txt shell> dir . 0 07-20-2016 18:35:48 D . .. 0 07-20-2016 18:35:48 D ..
Before you ask, I've already applied the MQX 18.104.22.168 fixes a long time ago, including theextra sector_count-- not included in the patch.
Any help is appreciated. I assume I'm having trust issues with MFS due to these sporadic problems - do anyone have any suggestion on changing it by other FAT implementation (without spending one month on it)?
Thank you very much!