From e286695f1c85055b4f6ce2668524aca396449086 Mon Sep 17 00:00:00 2001 From: coolsnowwolf Date: Sat, 1 Feb 2020 19:50:46 +0800 Subject: [PATCH] antfs: kernel mode driver based on NTFS-3G --- kernel/antfs/Makefile | 43 ++++++++++++++++ kernel/antfs/patches/001-4.18.patch | 76 +++++++++++++++++++++++++++++ 2 files changed, 119 insertions(+) create mode 100644 kernel/antfs/Makefile create mode 100644 kernel/antfs/patches/001-4.18.patch diff --git a/kernel/antfs/Makefile b/kernel/antfs/Makefile new file mode 100644 index 000000000..8a636f1d7 --- /dev/null +++ b/kernel/antfs/Makefile @@ -0,0 +1,43 @@ +include $(TOPDIR)/rules.mk +include $(INCLUDE_DIR)/kernel.mk + +PKG_NAME:=antfs +PKG_RELEASE:=1 + +PKG_SOURCE_URL:=https://github.com/Sembedded/antfs.git +PKG_SOURCE_PROTO:=git +PKG_SOURCE_DATE:=2018-08-14 +PKG_SOURCE_VERSION:=002407a1b4f1bc9ec19fb07a4c01fc5348d216a6 +PKG_MIRROR_HASH:=d1c44b2be92531c2caa4fa00b620591f95104436920640e94861f8207d6e9082 + +PKG_LICENSE:=GPL-2.0-only +PKG_LICENSE_FILES:=LICENSE + +include $(INCLUDE_DIR)/package.mk + +define KernelPackage/fs-antfs + SUBMENU:=Filesystems + TITLE:=AVM NTFS Read/Write Driver + FILES:=$(PKG_BUILD_DIR)/antfs.ko + AUTOLOAD:=$(call AutoLoad,30,antfs,1) + DEPENDS:=+kmod-nls-base +endef + +define KernelPackage/fs-antfs/description + Kernel module for NTFS Filesytem +endef + +MAKE_OPTS:= \ + ARCH="$(LINUX_KARCH)" \ + CROSS_COMPILE="$(TARGET_CROSS)" \ + M="$(PKG_BUILD_DIR)" + +define Build/Compile + $(MAKE) -C "$(LINUX_DIR)" \ + $(MAKE_OPTS) \ + CONFIG_ANTFS_FS=m \ + CONFIG_ANTFS_SYMLINKS=y \ + modules +endef + +$(eval $(call KernelPackage,fs-antfs)) diff --git a/kernel/antfs/patches/001-4.18.patch b/kernel/antfs/patches/001-4.18.patch new file mode 100644 index 000000000..20d3dc4de --- /dev/null +++ b/kernel/antfs/patches/001-4.18.patch @@ -0,0 +1,76 @@ +--- a/dir.c ++++ b/dir.c +@@ -1133,9 +1133,12 @@ static int antfs_setattr(struct dentry * + } + #if LINUX_VERSION_CODE < KERNEL_VERSION(4, 8, 0) + inode->i_mtime = inode->i_ctime = CURRENT_TIME_SEC; +-#else ++#elif LINUX_VERSION_CODE < KERNEL_VERSION(4, 18, 0) + ktime_get_real_ts(&inode->i_mtime); + ktime_get_real_ts(&inode->i_ctime); ++#else ++ ktime_get_real_ts64(&inode->i_mtime); ++ ktime_get_real_ts64(&inode->i_ctime); + #endif + if (inode_needs_sync(inode)) { + sync_mapping_buffers(inode->i_mapping); +--- a/include/ntfstime.h ++++ b/include/ntfstime.h +@@ -47,9 +47,15 @@ + * + * Return: A Unix time (number of seconds since 1970, and nanoseconds) + */ ++#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 18, 0) + static inline struct timespec ntfs2timespec(sle64 ntfstime) + { + struct timespec spec; ++#else ++static inline struct timespec64 ntfs2timespec(sle64 ntfstime) ++{ ++ struct timespec64 spec; ++#endif + uint64_t cputime; + + cputime = sle64_to_cpu(ntfstime) - NTFS_TIME_OFFSET; +@@ -79,7 +85,11 @@ static inline struct timespec ntfs2times + * + * Return: An NTFS time (100ns units since Jan 1601) + */ ++#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 18, 0) + static inline sle64 timespec2ntfs(struct timespec spec) ++#else ++static inline sle64 timespec2ntfs(struct timespec64 spec) ++#endif + { + s64 units; + +@@ -94,10 +104,15 @@ static inline sle64 timespec2ntfs(struct + + static inline sle64 ntfs_current_time(void) + { ++#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 18, 0) + struct timespec ts; + + getnstimeofday(&ts); ++#else ++ struct timespec64 ts; + ++ getnstimeofday64(&ts); ++#endif + return timespec2ntfs(ts); + } + +--- a/inode.c ++++ b/inode.c +@@ -435,7 +435,11 @@ int antfs_inode_init(struct inode *inode + inode->i_ino == + (unsigned long)FILE_ROOT))) { + struct antfs_sb_info *sbi = ANTFS_SB(inode->i_sb); ++#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 18, 0) + struct timespec ts; ++#else ++ struct timespec64 ts; ++#endif + + /* Init a base mft record ("regular" inode): + * this has to be done in context of either: