Merge pull request #13300 from rajkan01/storage_fsdir_restructure

Restructure storage filesystem directory
pull/13317/head
Martin Kojtal 2020-07-20 15:19:17 +01:00 committed by GitHub
commit 3a8989a247
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
83 changed files with 50 additions and 53 deletions

View File

@ -114,7 +114,10 @@ set(unittest-includes-base
"${PROJECT_SOURCE_DIR}/../features"
"${PROJECT_SOURCE_DIR}/../features/netsocket"
"${PROJECT_SOURCE_DIR}/../platform"
"${PROJECT_SOURCE_DIR}/../storage/filesystem/littlefs/include"
"${PROJECT_SOURCE_DIR}/../storage/filesystem/fat/include"
"${PROJECT_SOURCE_DIR}/../storage/blockdevice/include"
"${PROJECT_SOURCE_DIR}/../storage/filesystem/include"
"${PROJECT_SOURCE_DIR}/../drivers"
"${PROJECT_SOURCE_DIR}/../hal"
"${PROJECT_SOURCE_DIR}/../events"

View File

@ -12,9 +12,6 @@ set(unittest-includes ${unittest-includes}
)
set(unittest-sources
../storage/filesystem/Dir.cpp
../storage/filesystem/FileSystem.cpp
../storage/filesystem/File.cpp
../storage/kvstore/global_api/kvstore_global_api.cpp
../storage/kvstore/securestore/SecureStore.cpp
../storage/kvstore/kv_map/KVMap.cpp

View File

@ -17,7 +17,7 @@
#include "gtest/gtest.h"
#include "blockdevice/HeapBlockDevice.h"
#include "storage/kvstore/filesystemstore/FileSystemStore.h"
#include "storage/filesystem/littlefs/LittleFileSystem.h"
#include "littlefs/LittleFileSystem.h"
#include "mbed_error.h"
#include <stdlib.h>

View File

@ -11,10 +11,10 @@ set(unittest-includes ${unittest-includes}
set(unittest-sources
../storage/blockdevice/source/HeapBlockDevice.cpp
../storage/kvstore/filesystemstore/FileSystemStore.cpp
../storage/filesystem/littlefs/LittleFileSystem.cpp
../storage/filesystem/Dir.cpp
../storage/filesystem/File.cpp
../storage/filesystem/FileSystem.cpp
../storage/filesystem/littlefs/source/LittleFileSystem.cpp
../storage/filesystem/source/Dir.cpp
../storage/filesystem/source/File.cpp
../storage/filesystem/source/FileSystem.cpp
../features/frameworks/mbed-trace/source/mbed_trace.c
../storage/filesystem/littlefs/littlefs/lfs_util.c
../storage/filesystem/littlefs/littlefs/lfs.c

View File

@ -26,7 +26,7 @@
#ifndef MBED_FATFILESYSTEM_H
#define MBED_FATFILESYSTEM_H
#include "storage/filesystem/FileSystem.h"
#include "filesystem/FileSystem.h"
#include "blockdevice/BlockDevice.h"
#include "FileHandle.h"
#include <stdint.h>

View File

@ -19,12 +19,12 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
#include "storage/filesystem/fat/ChaN/diskio.h"
#include "storage/filesystem/fat/ChaN/ffconf.h"
#include "storage/filesystem/fat/ChaN/ff.h"
#include "fat/ChaN/diskio.h"
#include "fat/ChaN/ffconf.h"
#include "fat/ChaN/ff.h"
#include "platform/mbed_debug.h"
#include "platform/mbed_critical.h"
#include "storage/filesystem/mbed_filesystem.h"
#include "filesystem/mbed_filesystem.h"
#include "FATFileSystem.h"
#include <errno.h>

View File

@ -17,7 +17,7 @@
#ifndef DIR_H
#define DIR_H
#include "storage/filesystem/FileSystem.h"
#include "filesystem/FileSystem.h"
#include "platform/DirHandle.h"
namespace mbed {

View File

@ -17,7 +17,7 @@
#ifndef FILE_H
#define FILE_H
#include "storage/filesystem/FileSystem.h"
#include "filesystem/FileSystem.h"
#include "platform/FileHandle.h"
namespace mbed {

View File

@ -23,9 +23,9 @@
#include "platform/platform.h"
// FileSystem classes
#include "storage/filesystem/FileSystem.h"
#include "storage/filesystem/File.h"
#include "storage/filesystem/Dir.h"
#include "filesystem/FileSystem.h"
#include "filesystem/File.h"
#include "filesystem/Dir.h"
// BlockDevice classes
#include "blockdevice/BlockDevice.h"

View File

@ -20,7 +20,7 @@
#ifndef MBED_LFSFILESYSTEM_H
#define MBED_LFSFILESYSTEM_H
#include "storage/filesystem/FileSystem.h"
#include "filesystem/FileSystem.h"
#include "blockdevice/BlockDevice.h"
#include "platform/PlatformMutex.h"
#include "storage/filesystem/littlefs/littlefs/lfs.h"

0
storage/filesystem/littlefs/littlefs/scripts/prefix.py Normal file → Executable file
View File

View File

View File

@ -13,8 +13,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "storage/filesystem/mbed_filesystem.h"
#include "LittleFileSystem.h"
#include "filesystem/mbed_filesystem.h"
#include "littlefs/LittleFileSystem.h"
#include "errno.h"
#include "storage/filesystem/littlefs/littlefs/lfs.h"
#include "storage/filesystem/littlefs/littlefs/lfs_util.h"

View File

@ -22,7 +22,7 @@ from time import sleep
class UnexpectedResetTest(BaseHostTest):
"""This test checks that a device's RTC keeps count through a reset
It does this by setting the RTC's time, triggering a reset,
delaying and then reading the RTC's time again to ensure
that the RTC is still counting.
@ -58,7 +58,7 @@ class UnexpectedResetTest(BaseHostTest):
def unexpected_reset_test(self):
"""Generator for running the reset test
This function calls yield to wait for the next event from
the device. If the device gives the wrong response, then the
generator terminates by returing which raises a StopIteration
@ -100,4 +100,3 @@ class UnexpectedResetTest(BaseHostTest):
self.send_kv("exit", "pass")
yield # No more events expected

View File

@ -4,13 +4,13 @@ all: test_dirs test_files test_seek test_parallel
test_%: ../../littlefs/tests/test_%.sh
cp $< $(notdir $<)
sed -i -e 's/tests\//.\//' -e 's/echo/.\/echo.py/' $(notdir $<)
./clean.sh
ln -f -s replacements_mbed.yml replacements.yml
./$(notdir $<)
mkdir -p ../filesystem/$(patsubst test_%,%,$@)
cp main.cpp ../filesystem/$(patsubst test_%,%,$@)/main.cpp
./clean.sh
ln -f -s replacements_retarget.yml replacements.yml
./$(notdir $<)

View File

@ -4,14 +4,14 @@
- ['lfs_mkdir\(&lfs, (.*)\)', 'fs.mkdir(\1, 0777)']
- ['lfs_remove\(&lfs, (.*)\)', 'fs.remove(\1)']
- ['lfs_rename\(&lfs, (.*), ?(.*)\)', 'fs.rename(\1, \2)']
- ['lfs_dir_open\(&lfs, &dir\[(.*)\], ?(.*)\)', 'dir[\1].open(&fs, \2)']
- ['lfs_dir_close\(&lfs, &dir\[(.*)\]\)', 'dir[\1].close()']
- ['lfs_dir_read\(&lfs, &dir\[(.*)\], &info\)', 'dir[\1].read(&ent)']
- ['lfs_dir_seek\(&lfs, &dir\[(.*)\], ?(.*)\).*;', 'dir[\1].seek(\2);'] # no dir errors
- ['lfs_dir_rewind\(&lfs, &dir\[(.*)\]\).*;', 'dir[\1].rewind();'] # no dir errors
- ['lfs_dir_tell\(&lfs, &dir\[(.*)\]\)', 'dir[\1].tell()']
- ['lfs_file_open\(&lfs, &file\[(.*)\], ?(.*)\)', 'file[\1].open(&fs, \2)']
- ['lfs_file_close\(&lfs, &file\[(.*)\]\)', 'file[\1].close()']
- ['lfs_file_sync\(&lfs, &file\[(.*)\]\)', 'file[\1].sync()']
@ -21,7 +21,7 @@
- ['lfs_file_tell\(&lfs, &file\[(.*)\]\)', 'file[\1].tell()']
- ['lfs_file_rewind\(&lfs, &file\[(.*)\]\).*;', 'file[\1].rewind();'] # no errors
- ['lfs_file_size\(&lfs, &file\[(.*)\]\)', 'file[\1].size()']
- ['LFS_TYPE_([A-Z]+)', 'DT_\1']
- ['LFS_O_([A-Z]+)', 'O_\1']
- ['LFS_SEEK_([A-Z]+)', 'SEEK_\1']

View File

View File

View File

View File

View File

0
storage/filesystem/littlefsv2/littlefs/scripts/test.py Normal file → Executable file
View File

View File

@ -22,7 +22,7 @@ from time import sleep
class UnexpectedResetTest(BaseHostTest):
"""This test checks that a device's RTC keeps count through a reset
It does this by setting the RTC's time, triggering a reset,
delaying and then reading the RTC's time again to ensure
that the RTC is still counting.
@ -58,7 +58,7 @@ class UnexpectedResetTest(BaseHostTest):
def unexpected_reset_test(self):
"""Generator for running the reset test
This function calls yield to wait for the next event from
the device. If the device gives the wrong response, then the
generator terminates by returing which raises a StopIteration
@ -100,4 +100,3 @@ class UnexpectedResetTest(BaseHostTest):
self.send_kv("exit", "pass")
yield # No more events expected

View File

@ -4,13 +4,13 @@ all: test_dirs test_files test_seek test_parallel
test_%: ../../littlefs/tests/test_%.sh
cp $< $(notdir $<)
sed -i -e 's/tests\//.\//' -e 's/echo/.\/echo.py/' $(notdir $<)
./clean.sh
ln -f -s replacements_mbed.yml replacements.yml
./$(notdir $<)
mkdir -p ../filesystem/$(patsubst test_%,%,$@)
cp main.cpp ../filesystem/$(patsubst test_%,%,$@)/main.cpp
./clean.sh
ln -f -s replacements_retarget.yml replacements.yml
./$(notdir $<)

View File

@ -4,14 +4,14 @@
- ['lfs2_mkdir\(&lfs2, (.*)\)', 'fs.mkdir(\1, 0777)']
- ['lfs2_remove\(&lfs2, (.*)\)', 'fs.remove(\1)']
- ['lfs2_rename\(&lfs2, (.*), ?(.*)\)', 'fs.rename(\1, \2)']
- ['lfs2_dir_open\(&lfs2, &dir\[(.*)\], ?(.*)\)', 'dir[\1].open(&fs, \2)']
- ['lfs2_dir_close\(&lfs2, &dir\[(.*)\]\)', 'dir[\1].close()']
- ['lfs2_dir_read\(&lfs2, &dir\[(.*)\], &info\)', 'dir[\1].read(&ent)']
- ['lfs2_dir_seek\(&lfs2, &dir\[(.*)\], ?(.*)\).*;', 'dir[\1].seek(\2);'] # no dir errors
- ['lfs2_dir_rewind\(&lfs2, &dir\[(.*)\]\).*;', 'dir[\1].rewind();'] # no dir errors
- ['lfs2_dir_tell\(&lfs2, &dir\[(.*)\]\)', 'dir[\1].tell()']
- ['lfs2_file_open\(&lfs2, &file\[(.*)\], ?(.*)\)', 'file[\1].open(&fs, \2)']
- ['lfs2_file_close\(&lfs2, &file\[(.*)\]\)', 'file[\1].close()']
- ['lfs2_file_sync\(&lfs2, &file\[(.*)\]\)', 'file[\1].sync()']
@ -21,7 +21,7 @@
- ['lfs2_file_tell\(&lfs2, &file\[(.*)\]\)', 'file[\1].tell()']
- ['lfs2_file_rewind\(&lfs2, &file\[(.*)\]\).*;', 'file[\1].rewind();'] # no errors
- ['lfs2_file_size\(&lfs2, &file\[(.*)\]\)', 'file[\1].size()']
- ['LFS2_TYPE_([A-Z]+)', 'DT_\1']
- ['LFS2_O_([A-Z]+)', 'O_\1']
- ['LFS2_SEEK_([A-Z]+)', 'SEEK_\1']

View File

@ -14,7 +14,7 @@
* limitations under the License.
*/
#include "Dir.h"
#include "filesystem/Dir.h"
#include <errno.h>
namespace mbed {

View File

@ -14,7 +14,7 @@
* limitations under the License.
*/
#include "File.h"
#include "filesystem/File.h"
#include <errno.h>
namespace mbed {

View File

@ -14,9 +14,9 @@
* limitations under the License.
*/
#include "storage/filesystem/Dir.h"
#include "storage/filesystem/File.h"
#include "storage/filesystem/FileSystem.h"
#include "filesystem/Dir.h"
#include "filesystem/File.h"
#include "filesystem/FileSystem.h"
#include <errno.h>
namespace mbed {

View File

@ -2136,4 +2136,3 @@ int main()
{
return !Harness::run(specification);
}

View File

@ -18,11 +18,11 @@
#include "storage/kvstore/include/KVStore.h"
#include "storage/kvstore/kv_map/KVMap.h"
#include "blockdevice/BlockDevice.h"
#include "storage/filesystem/FileSystem.h"
#include "filesystem/FileSystem.h"
#include "storage/kvstore/filesystemstore/FileSystemStore.h"
#include "blockdevice/SlicingBlockDevice.h"
#include "storage/filesystem/fat/FATFileSystem.h"
#include "storage/filesystem/littlefs/LittleFileSystem.h"
#include "fat/FATFileSystem.h"
#include "littlefs/LittleFileSystem.h"
#include "storage/kvstore/tdbstore/TDBStore.h"
#include "mbed_error.h"
#include "drivers/FlashIAP.h"

View File

@ -18,8 +18,8 @@
#include "FileSystemStore.h"
#include "storage/kvstore/conf/kv_config.h"
#include "storage/filesystem/Dir.h"
#include "storage/filesystem/File.h"
#include "filesystem/Dir.h"
#include "filesystem/File.h"
#include "blockdevice/BlockDevice.h"
#include "mbed_error.h"
#include <string.h>

View File

@ -19,7 +19,7 @@
#define MBED_FILE_SYSTEM_STORE_H
#include "storage/kvstore/include/KVStore.h"
#include "storage/filesystem/FileSystem.h"
#include "filesystem/FileSystem.h"
namespace mbed {

View File

@ -20,7 +20,7 @@
#include "platform/PlatformMutex.h"
#include "platform/SingletonPtr.h"
#include "blockdevice/BlockDevice.h"
#include "storage/filesystem/FileSystem.h"
#include "filesystem/FileSystem.h"
namespace mbed {

View File

@ -14,9 +14,9 @@
* limitations under the License.
*/
#include "blockdevice/BlockDevice.h"
#include "storage/filesystem/FileSystem.h"
#include "storage/filesystem/fat/FATFileSystem.h"
#include "storage/filesystem/littlefs/LittleFileSystem.h"
#include "filesystem/FileSystem.h"
#include "fat/FATFileSystem.h"
#include "littlefs/LittleFileSystem.h"
#include "mbed_error.h"