I am using FreeRTOS version 9.0.0 and FreeRTOS+FAT version 160919 with patch 0001-Changes-since-160919 to work with SD card and USB flash drive on LPC1788.
During testing I noticed that when i trying to create directory with name same as disk mount point it will successfuly create directory with empty name on the disk :
I mounted usb flash drive to point "/usb". Mount was successful, i can see files and folders on the drive.
Then for test purposes i call ffmkdir("/usb") awaiting that it return me some error, for example FFERRDIROBJECT_EXISTS, but it was successful !
Looking in flash disk drive i see new directory whith empty name that can not be entered or deleted.
Only formating whole drive helps remove it ))
Same thing happens with SD card mounted to "/sd" and calling ff_mkdir("/sd").
Is it normal ?
when i trying to create directory with name same as disk mount point
it will successfully create directory with empty name on the disk :
Yes, we were aware of this. After creation there will be a physical directory "
/usb", and a logical (mounted) directory with the same name.
I mounted usb flash drive to point "/usb". Mount was successful,
i can see files and folders on the drive.
Indeed, when you access
/usb, the logical ( mounted ) directory will prevail.
Then for test purposes i call ff_mkdir("/usb") awaiting that it return
me some error, for example
FF_ERR_DIR_OBJECT_EXISTS, but it was successful !
You're right, formally this should be checked for.
Looking in flash disk drive i see new directory whith empty name that
can not be entered or deleted.
There is indeed a bit of a problem here, also FTP shows two directories: a virtual one, and a physical directory on an SD-card.
Only formatting whole drive helps remove it ))
Not true. When using the
FF_ functions, the directory can be emptied and removed.
As you have probably seen, the
ff_ functions from
ff_stdio.c are aware of the mounted directories.
FF_ functions have an I/O manager as a parameter, and these functions are working on physical drives only.
Is it normal ?
We always seek a balance between simplicity and completeness, correctness.
I was aware that a physical directory can be created, while a mounted directory already exists.
But what should the library say if you mount a drive on "/usr", while a directory with that name already exists. Do you want the mount to fail?
Personally, I think that the physical directory should be ignored by the "ff_" functions.
And yes, a call to
ff_mkdir should fail.
Some work has to be done here.
Thanks for the answer.
I gues I am not accurately described the situation. In steps it looks like this:
1 Start the system, no any drives mounted, nothing created.
2 Only mount USB flash drive to point "/usb". Nothing else mounted or created.
3 Call ff_mkdir("/usb").
4 Do nothing.
In result it creates directory whith emty name on USB flash drive, not in root of virtual FS. Path of this directory is "/usb/ ". How can it be deleted if it have no name? When i plug this usb flash drive on Windows it looks like folder with no name (see screenshot in attachment, blue line mark). And it can not be deleted, because Windows trying to delete whole usb drive, seems like this empty name directory is linked to usb drive itself. Only formatting the drive solve it.
Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.