From e1bdae15781d64ee42205903c12ea65ab750290b Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Tue, 18 Jun 2019 12:05:34 +0100 Subject: [PATCH] Fix #includes and build a shared library. --- Makefile | 1 + blockdev/CMakeLists.txt | 2 +- blockdev/linux/file_dev.h | 4 ++-- include/ext4.h | 12 ++++++------ include/ext4_balloc.h | 6 +++--- include/ext4_bcache.h | 6 +++--- include/ext4_bitmap.h | 2 +- include/ext4_block_group.h | 6 +++--- include/ext4_blockdev.h | 4 ++-- include/ext4_crc32.h | 2 +- include/ext4_debug.h | 4 ++-- include/ext4_dir.h | 10 +++++----- include/ext4_dir_idx.h | 8 ++++---- include/ext4_errno.h | 2 +- include/ext4_extent.h | 6 +++--- include/ext4_fs.h | 6 +++--- include/ext4_hash.h | 2 +- include/ext4_ialloc.h | 4 ++-- include/ext4_inode.h | 4 ++-- include/ext4_journal.h | 8 ++++---- include/ext4_mbr.h | 4 ++-- include/ext4_mkfs.h | 8 ++++---- include/ext4_super.h | 6 +++--- include/ext4_trans.h | 4 ++-- include/ext4_types.h | 6 +++--- include/ext4_xattr.h | 6 +++--- toolchain/generic.cmake | 2 +- toolchain/mingw.cmake | 4 ++-- 28 files changed, 70 insertions(+), 69 deletions(-) diff --git a/Makefile b/Makefile index 41ee486..5cd1efb 100644 --- a/Makefile +++ b/Makefile @@ -19,6 +19,7 @@ COMMON_DEFINITIONS = \ -DVERSION_MINOR=$(VERSION_MINOR) \ -DVERSION_PATCH=$(VERSION_PATCH) \ -DVERSION=$(VERSION) \ + -DLWEXT4_BUILD_SHARED_LIB=ON \ define generate_common rm -R -f build_$(1) diff --git a/blockdev/CMakeLists.txt b/blockdev/CMakeLists.txt index a16e810..e79cbb4 100644 --- a/blockdev/CMakeLists.txt +++ b/blockdev/CMakeLists.txt @@ -9,5 +9,5 @@ else() endif() aux_source_directory(. BLOCKDEV_SRC) -add_library(blockdev ${BLOCKDEV_SRC}) +add_library(blockdev SHARED ${BLOCKDEV_SRC}) diff --git a/blockdev/linux/file_dev.h b/blockdev/linux/file_dev.h index ce4690d..ade80fb 100644 --- a/blockdev/linux/file_dev.h +++ b/blockdev/linux/file_dev.h @@ -28,8 +28,8 @@ #ifndef FILE_DEV_H_ #define FILE_DEV_H_ -#include -#include +#include "ext4_config.h" +#include "ext4_blockdev.h" #include #include diff --git a/include/ext4.h b/include/ext4.h index 516bbdd..e8db7aa 100644 --- a/include/ext4.h +++ b/include/ext4.h @@ -45,13 +45,13 @@ extern "C" { #include #include -#include -#include -#include -#include -#include +#include "ext4_config.h" +#include "ext4_types.h" +#include "ext4_errno.h" +#include "ext4_oflags.h" +#include "ext4_debug.h" -#include +#include "ext4_blockdev.h" /********************************OS LOCK INFERFACE***************************/ diff --git a/include/ext4_balloc.h b/include/ext4_balloc.h index ad481dc..4e2f224 100644 --- a/include/ext4_balloc.h +++ b/include/ext4_balloc.h @@ -45,10 +45,10 @@ extern "C" { #endif -#include -#include +#include "ext4_config.h" +#include "ext4_types.h" -#include +#include "ext4_fs.h" #include #include diff --git a/include/ext4_bcache.h b/include/ext4_bcache.h index f8bec7d..b7ae438 100644 --- a/include/ext4_bcache.h +++ b/include/ext4_bcache.h @@ -41,12 +41,12 @@ extern "C" { #endif -#include +#include "ext4_config.h" #include #include -#include -#include +#include "misc/tree.h" +#include "misc/queue.h" #define EXT4_BLOCK_ZERO() \ {.lb_id = 0, .data = 0} diff --git a/include/ext4_bitmap.h b/include/ext4_bitmap.h index 6bcb100..cb73b76 100644 --- a/include/ext4_bitmap.h +++ b/include/ext4_bitmap.h @@ -41,7 +41,7 @@ extern "C" { #endif -#include +#include "ext4_config.h" #include #include diff --git a/include/ext4_block_group.h b/include/ext4_block_group.h index 61fbc98..88e00a1 100644 --- a/include/ext4_block_group.h +++ b/include/ext4_block_group.h @@ -46,9 +46,9 @@ extern "C" { #endif -#include -#include -#include +#include "ext4_config.h" +#include "ext4_types.h" +#include "ext4_super.h" #include #include diff --git a/include/ext4_blockdev.h b/include/ext4_blockdev.h index 4efbb43..4673479 100644 --- a/include/ext4_blockdev.h +++ b/include/ext4_blockdev.h @@ -40,8 +40,8 @@ extern "C" { #endif -#include -#include +#include "ext4_config.h" +#include "ext4_bcache.h" #include #include diff --git a/include/ext4_crc32.h b/include/ext4_crc32.h index a9580c2..3dad1d1 100644 --- a/include/ext4_crc32.h +++ b/include/ext4_crc32.h @@ -43,7 +43,7 @@ extern "C" { #endif -#include +#include "ext4_config.h" #include diff --git a/include/ext4_debug.h b/include/ext4_debug.h index 10c581e..6eb8aa1 100644 --- a/include/ext4_debug.h +++ b/include/ext4_debug.h @@ -41,8 +41,8 @@ extern "C" { #endif -#include -#include +#include "ext4_config.h" +#include "ext4_errno.h" #if !CONFIG_HAVE_OWN_ASSERT #include diff --git a/include/ext4_dir.h b/include/ext4_dir.h index 0fa631f..d3b1bf5 100644 --- a/include/ext4_dir.h +++ b/include/ext4_dir.h @@ -46,11 +46,11 @@ extern "C" { #endif -#include -#include -#include -#include -#include +#include "ext4_config.h" +#include "ext4_types.h" +#include "ext4_misc.h" +#include "ext4_blockdev.h" +#include "ext4_super.h" #include diff --git a/include/ext4_dir_idx.h b/include/ext4_dir_idx.h index f1c5b26..f3e83d6 100644 --- a/include/ext4_dir_idx.h +++ b/include/ext4_dir_idx.h @@ -46,11 +46,11 @@ extern "C" { #endif -#include -#include +#include "ext4_config.h" +#include "ext4_types.h" -#include -#include +#include "ext4_fs.h" +#include "ext4_dir.h" #include #include diff --git a/include/ext4_errno.h b/include/ext4_errno.h index 2d92280..edf89a9 100644 --- a/include/ext4_errno.h +++ b/include/ext4_errno.h @@ -40,7 +40,7 @@ extern "C" { #endif -#include +#include "ext4_config.h" #if !CONFIG_HAVE_OWN_ERRNO #include diff --git a/include/ext4_extent.h b/include/ext4_extent.h index fee0926..0d4e1e3 100644 --- a/include/ext4_extent.h +++ b/include/ext4_extent.h @@ -44,9 +44,9 @@ extern "C" { #endif -#include -#include -#include +#include "ext4_config.h" +#include "ext4_types.h" +#include "ext4_inode.h" void ext4_extent_tree_init(struct ext4_inode_ref *inode_ref); diff --git a/include/ext4_fs.h b/include/ext4_fs.h index c520326..9653f47 100644 --- a/include/ext4_fs.h +++ b/include/ext4_fs.h @@ -46,9 +46,9 @@ extern "C" { #endif -#include -#include -#include +#include "ext4_config.h" +#include "ext4_types.h" +#include "ext4_misc.h" #include #include diff --git a/include/ext4_hash.h b/include/ext4_hash.h index 43ecbab..17989a1 100644 --- a/include/ext4_hash.h +++ b/include/ext4_hash.h @@ -41,7 +41,7 @@ extern "C" { #endif -#include +#include "ext4_config.h" #include diff --git a/include/ext4_ialloc.h b/include/ext4_ialloc.h index e845c79..cea3fe6 100644 --- a/include/ext4_ialloc.h +++ b/include/ext4_ialloc.h @@ -46,8 +46,8 @@ extern "C" { #endif -#include -#include +#include "ext4_config.h" +#include "ext4_types.h" /**@brief Calculate and set checksum of inode bitmap. * @param sb superblock pointer. diff --git a/include/ext4_inode.h b/include/ext4_inode.h index bee5b8a..e0ca6e3 100644 --- a/include/ext4_inode.h +++ b/include/ext4_inode.h @@ -46,8 +46,8 @@ extern "C" { #endif -#include -#include +#include "ext4_config.h" +#include "ext4_types.h" #include diff --git a/include/ext4_journal.h b/include/ext4_journal.h index 415618b..76a4a87 100644 --- a/include/ext4_journal.h +++ b/include/ext4_journal.h @@ -41,10 +41,10 @@ extern "C" { #endif -#include -#include -#include -#include +#include "ext4_config.h" +#include "ext4_types.h" +#include "misc/queue.h" +#include "misc/tree.h" struct jbd_fs { struct ext4_blockdev *bdev; diff --git a/include/ext4_mbr.h b/include/ext4_mbr.h index 97a4459..858ab02 100644 --- a/include/ext4_mbr.h +++ b/include/ext4_mbr.h @@ -41,8 +41,8 @@ extern "C" { #endif -#include -#include +#include "ext4_config.h" +#include "ext4_blockdev.h" /**@brief Master boot record block devices descriptor*/ struct ext4_mbr_bdevs { diff --git a/include/ext4_mkfs.h b/include/ext4_mkfs.h index aadedb0..16a05f8 100644 --- a/include/ext4_mkfs.h +++ b/include/ext4_mkfs.h @@ -41,11 +41,11 @@ extern "C" { #endif -#include -#include +#include "ext4_config.h" +#include "ext4_types.h" -#include -#include +#include "ext4_blockdev.h" +#include "ext4_fs.h" #include #include diff --git a/include/ext4_super.h b/include/ext4_super.h index 5afd18d..b420225 100644 --- a/include/ext4_super.h +++ b/include/ext4_super.h @@ -46,9 +46,9 @@ extern "C" { #endif -#include -#include -#include +#include "ext4_config.h" +#include "ext4_types.h" +#include "ext4_misc.h" /**@brief Blocks count get stored in superblock. * @param s superblock descriptor diff --git a/include/ext4_trans.h b/include/ext4_trans.h index b17373c..e3cb28a 100644 --- a/include/ext4_trans.h +++ b/include/ext4_trans.h @@ -41,8 +41,8 @@ extern "C" { #endif -#include -#include +#include "ext4_config.h" +#include "ext4_types.h" /**@brief Mark a buffer dirty and add it to the current transaction. diff --git a/include/ext4_types.h b/include/ext4_types.h index c9cdd34..2fd051e 100644 --- a/include/ext4_types.h +++ b/include/ext4_types.h @@ -46,9 +46,9 @@ extern "C" { #endif -#include -#include -#include +#include "ext4_config.h" +#include "ext4_blockdev.h" +#include "misc/tree.h" #include #include diff --git a/include/ext4_xattr.h b/include/ext4_xattr.h index d79febc..227b3a6 100644 --- a/include/ext4_xattr.h +++ b/include/ext4_xattr.h @@ -41,9 +41,9 @@ extern "C" { #endif -#include -#include -#include +#include "ext4_config.h" +#include "ext4_types.h" +#include "ext4_inode.h" struct ext4_xattr_info { uint8_t name_index; diff --git a/toolchain/generic.cmake b/toolchain/generic.cmake index 4b5e329..838a8be 100644 --- a/toolchain/generic.cmake +++ b/toolchain/generic.cmake @@ -8,7 +8,7 @@ set(AS as) set(AR ar) set(OBJCOPY objcopy) set(OBJDUMP objdump) -set(SIZE size) +# set(SIZE size) set(CMAKE_C_FLAGS "-std=gnu99 -fdata-sections -ffunction-sections" CACHE INTERNAL "c compiler flags") set(CMAKE_CXX_FLAGS "-fdata-sections -ffunction-sections" CACHE INTERNAL "cxx compiler flags") diff --git a/toolchain/mingw.cmake b/toolchain/mingw.cmake index b251acb..9efd933 100644 --- a/toolchain/mingw.cmake +++ b/toolchain/mingw.cmake @@ -1,6 +1,6 @@ # Name of the target set(CMAKE_SYSTEM_NAME Windows) -set(TOOLCHAIN_PREFIX x86_64-w64-mingw32) +set(TOOLCHAIN_PREFIX /opt/mxe/usr/bin/x86_64-w64-mingw32.shared) set(CMAKE_SYSTEM_PROCESSOR mingw) # Toolchain settings @@ -12,7 +12,7 @@ set(OBJCOPY objcopy) set(OBJDUMP objdump) set(SIZE size) -set(CMAKE_FIND_ROOT_PATH /usr/${TOOLCHAIN_PREFIX}) +set(CMAKE_FIND_ROOT_PATH /opt/mxe/usr/${TOOLCHAIN_PREFIX}) set(CMAKE_C_FLAGS "-std=gnu99 -fdata-sections -ffunction-sections" CACHE INTERNAL "c compiler flags") set(CMAKE_CXX_FLAGS "-fdata-sections -ffunction-sections" CACHE INTERNAL "cxx compiler flags") -- 2.30.2