|
| 1 | +diff --git a/CMakeLists.txt b/CMakeLists.txt |
| 2 | +index eec0993..ce64c51 100644 |
| 3 | +--- a/CMakeLists.txt |
| 4 | ++++ b/CMakeLists.txt |
| 5 | +@@ -30,11 +30,21 @@ elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL msp430g2210) |
| 6 | + add_definitions(-DCONFIG_DEBUG_ASSERT=0) |
| 7 | + #... |
| 8 | + elseif(LIB_ONLY) |
| 9 | +- add_definitions(-DCONFIG_DEBUG_PRINTF=0) |
| 10 | +- add_definitions(-DCONFIG_DEBUG_ASSERT=0) |
| 11 | +- add_definitions(-DCONFIG_HAVE_OWN_OFLAGS=1) |
| 12 | ++ if (CMAKE_BUILD_TYPE STREQUAL Release) |
| 13 | ++ add_definitions(-DCONFIG_DEBUG_PRINTF=0) |
| 14 | ++ add_definitions(-DCONFIG_DEBUG_ASSERT=0) |
| 15 | ++ else() |
| 16 | ++ add_definitions(-DCONFIG_DEBUG_PRINTF=1) |
| 17 | ++ add_definitions(-DCONFIG_DEBUG_ASSERT=1) |
| 18 | ++ endif() |
| 19 | ++ add_definitions(-DCONFIG_HAVE_OWN_ASSERT=0) |
| 20 | + add_definitions(-DCONFIG_HAVE_OWN_ERRNO=0) |
| 21 | + add_definitions(-DCONFIG_BLOCK_DEV_CACHE_SIZE=16) |
| 22 | ++ add_definitions(-DCONFIG_EXT4_BLOCKDEVS_COUNT=8) |
| 23 | ++ add_definitions(-DCONFIG_EXT4_MOUNTPOINTS_COUNT=8) |
| 24 | ++ add_definitions(-DCONFIG_HAVE_OWN_OFLAGS=0) |
| 25 | ++ add_definitions(-DCONFIG_UNALIGNED_ACCESS=1) |
| 26 | ++ add_definitions(-DCONFIG_USE_USER_MALLOC=0) |
| 27 | + else() |
| 28 | + #Generic example target |
| 29 | + if (WIN32) |
| 30 | +@@ -74,8 +84,6 @@ macro(output_configure) |
| 31 | + endmacro() |
| 32 | + output_configure() |
| 33 | + |
| 34 | +-add_subdirectory(blockdev) |
| 35 | +- |
| 36 | + #Library build |
| 37 | + add_subdirectory(src) |
| 38 | + #Detect all possible warnings for lwext4 target |
| 39 | +diff --git a/Makefile b/Makefile |
| 40 | +index 12ee5c7..413317d 100644 |
| 41 | +--- a/Makefile |
| 42 | ++++ b/Makefile |
| 43 | +@@ -65,7 +65,7 @@ mingw: |
| 44 | + lib_only: |
| 45 | + rm -R -f build_lib_only |
| 46 | + mkdir build_lib_only |
| 47 | +- cd build_lib_only && cmake $(COMMON_DEFINITIONS) -DLIB_ONLY=TRUE .. |
| 48 | ++ cd build_lib_only && aarch64-none-elf-cmake $(COMMON_DEFINITIONS) -DLIB_ONLY=TRUE .. |
| 49 | + |
| 50 | + all: |
| 51 | + generic |
| 52 | +diff --git a/src/ext4.c b/src/ext4.c |
| 53 | +index 90ce45e..2bdd520 100644 |
| 54 | +--- a/src/ext4.c |
| 55 | ++++ b/src/ext4.c |
| 56 | +@@ -461,14 +461,13 @@ int ext4_umount(const char *mount_point) |
| 57 | + if (r != EOK) |
| 58 | + goto Finish; |
| 59 | + |
| 60 | +- mp->mounted = 0; |
| 61 | +- |
| 62 | + ext4_bcache_cleanup(mp->fs.bdev->bc); |
| 63 | + ext4_bcache_fini_dynamic(mp->fs.bdev->bc); |
| 64 | + |
| 65 | + r = ext4_block_fini(mp->fs.bdev); |
| 66 | + Finish: |
| 67 | + mp->fs.bdev->fs = NULL; |
| 68 | ++ memset(mp, 0, sizeof(struct ext4_mountpoint)); |
| 69 | + return r; |
| 70 | + } |
| 71 | + |
| 72 | +@@ -1616,7 +1615,7 @@ static int ext4_ftruncate_no_lock(ext4_file *file, uint64_t size) |
| 73 | + /*Sync file size*/ |
| 74 | + file->fsize = ext4_inode_get_size(&file->mp->fs.sb, ref.inode); |
| 75 | + if (file->fsize <= size) { |
| 76 | +- r = EOK; |
| 77 | ++ r = ENOTSUP; |
| 78 | + goto Finish; |
| 79 | + } |
| 80 | + |
| 81 | +@@ -1659,11 +1658,12 @@ int ext4_ftruncate(ext4_file *f, uint64_t size) |
| 82 | + EXT4_MP_LOCK(f->mp); |
| 83 | + |
| 84 | + ext4_trans_start(f->mp); |
| 85 | ++ |
| 86 | + r = ext4_ftruncate_no_lock(f, size); |
| 87 | +- if (r != EOK) |
| 88 | +- ext4_trans_abort(f->mp); |
| 89 | +- else |
| 90 | ++ if (r == EOK || r == ENOTSUP) |
| 91 | + ext4_trans_stop(f->mp); |
| 92 | ++ else |
| 93 | ++ ext4_trans_abort(f->mp); |
| 94 | + |
| 95 | + EXT4_MP_UNLOCK(f->mp); |
| 96 | + return r; |
| 97 | +@@ -3146,8 +3146,10 @@ int ext4_dir_mk(const char *path) |
| 98 | + |
| 99 | + /*Check if exist.*/ |
| 100 | + r = ext4_generic_open(&f, path, "r", false, 0, 0); |
| 101 | +- if (r == EOK) |
| 102 | ++ if (r == EOK) { |
| 103 | ++ r = EEXIST; |
| 104 | + goto Finish; |
| 105 | ++ } |
| 106 | + |
| 107 | + /*Create new directory.*/ |
| 108 | + r = ext4_generic_open(&f, path, "w", false, 0, 0); |
0 commit comments