%global pkg ntfs3
%global driver_version 4.18.0-0.el8
%global kernel_version 4.18.0-394.el8
%global _use_internal_dependency_generator 0
%global __find_requires /usr/lib/rpm/redhat/find-requires
%global __find_provides /usr/lib/rpm/redhat/find-provides
%global debug_package %{nil}
%global __spec_install_post \
%{?__debug_package:%{__debug_install_post}} \
%{__arch_install_post} \
%{__os_install_post} \
%{__mod_compress_install_post}
%global __mod_compress_install_post find %{buildroot}/lib/modules -type f -name \*.ko -exec xz \{\} \\;
Name: kmod-%{pkg}
Version: 4.18.0.0
Release: 4%{?dist}
Summary: NTFS filesystem support
License: GPLv2 and GPLv2+
URL: https://www.kernel.org/
Source0: %{pkg}-%{driver_version}.tar.xz
Patch1: 0001-fs-ntfs3-Add-headers-and-misc-files.patch
Patch2: 0002-fs-ntfs3-Add-initialization-of-super-block.patch
Patch3: 0003-fs-ntfs3-Add-bitmap.patch
Patch4: 0004-fs-ntfs3-Add-file-operations-and-implementation.patch
Patch5: 0005-fs-ntfs3-Add-attrib-operations.patch
Patch6: 0006-fs-ntfs3-Add-compression.patch
Patch7: 0007-fs-ntfs3-Add-NTFS-journal.patch
Patch8: 0008-fs-ntfs3-Add-Kconfig-Makefile-and-doc.patch
Patch9: 0009-fs-ntfs3-Fix-various-spelling-mistakes.patch
Patch10: 0010-fs-ntfs3-Use-linux-log2-is_power_of_2-function.patch
Patch11: 0011-fs-ntfs3-Add-ifndef-define-to-all-header-files.patch
Patch12: 0012-fs-ntfs3-Fix-integer-overflow-in-multiplication.patch
Patch13: 0013-fs-ntfs3-Remove-unused-variable-cnt-in-ntfs_security.patch
Patch14: 0014-fs-ntfs3-Fix-one-none-utf8-char-in-source-file.patch
Patch15: 0015-fs-ntfs3-Fix-fall-through-warnings-for-Clang.patch
Patch16: 0016-fs-ntfs3-Remove-unused-including-linux-version.h.patch
Patch17: 0017-fs-ntfs3-Restyle-comment-block-in-ni_parse_reparse.patch
Patch18: 0018-fs-ntfs3-Use-kernel-ALIGN-macros-over-driver-specifi.patch
Patch19: 0019-fs-ntfs3-Do-not-use-driver-own-alloc-wrappers.patch
Patch20: 0020-fs-ntfs3-Use-kcalloc-kmalloc_array-over-kzalloc-kmal.patch
Patch21: 0021-fs-ntfs3-add-checks-for-allocation-failure.patch
Patch22: 0022-fs-ntfs3-fix-an-error-code-in-ntfs_get_acl_ex.patch
Patch23: 0023-fs-ntfs3-Fix-error-code-in-indx_add_allocate.patch
Patch24: 0024-fs-ntfs3-Potential-NULL-dereference-in-hdr_find_spli.patch
Patch25: 0025-fs-ntfs3-Fix-error-handling-in-indx_insert_into_root.patch
Patch26: 0026-fs-ntfs3-Restyle-comments-to-better-align-with-kerne.patch
Patch27: 0027-fs-ntfs3-Remove-fat-ioctl-s-from-ntfs3-driver-for-no.patch
Patch28: 0028-fs-ntfs3-Rework-file-operations.patch
Patch29: 0029-fs-ntfs3-Restyle-comments-to-better-align-with-kerne.patch
Patch30: 0030-fs-ntfs3-Fix-integer-overflow-in-ni_fiemap-with-fiem.patch
Patch31: 0031-fs-ntfs3-Remove-unnecessary-condition-checking-from-.patch
Patch32: 0032-fs-ntfs3-Remove-GPL-boilerplates-from-decompress-lib.patch
Patch33: 0033-fs-ntfs3-Change-how-module-init-info-messages-are-di.patch
Patch34: 0034-fs-ntfs3-Remove-unnecesarry-mount-option-noatime.patch
Patch35: 0035-fs-ntfs3-Remove-unnecesarry-remount-flag-handling.patch
Patch36: 0036-fs-ntfs3-Convert-mount-options-to-pointer-in-sbi.patch
Patch37: 0037-fs-ntfs3-Use-new-api-for-mounting.patch
Patch38: 0038-fs-ntfs3-Init-spi-more-in-init_fs_context-than-fill_.patch
Patch39: 0039-fs-ntfs3-Make-mount-option-nohidden-more-universal.patch
Patch40: 0040-fs-ntfs3-Add-iocharset-mount-option-as-alias-for-nls.patch
Patch41: 0041-fs-ntfs3-Rename-mount-option-no_acs_rules-no-acsrule.patch
Patch42: 0042-fs-ntfs3-Show-uid-gid-always-in-show_options.patch
Patch43: 0043-fs-ntfs3-Remove-redundant-initialization-of-variable.patch
Patch44: 0044-fs-ntfs3.-Add-forward-declarations-for-structs-to-de.patch
Patch45: 0045-fs-ntfs3-Add-missing-header-files-to-ntfs.h.patch
Patch46: 0046-fs-ntfs3-Add-missing-headers-and-forward-declaration.patch
Patch47: 0047-fs-ntfs3-Add-missing-header-and-guards-to-lib-header.patch
Patch48: 0048-fs-ntfs3-Change-right-headers-to-bitfunc.c.patch
Patch49: 0049-fs-ntfs3-Change-right-headers-to-upcase.c.patch
Patch50: 0050-fs-ntfs3-Change-right-headers-to-lznt.c.patch
Patch51: 0051-fs-ntfs3-Remove-unneeded-header-files-from-c-files.patch
Patch52: 0052-fs-ntfs3-Limit-binary-search-table-size.patch
Patch53: 0053-fs-ntfs3-Make-binary-search-to-search-smaller-chunks.patch
Patch54: 0054-fs-ntfs3-Always-use-binary-search-with-entry-search.patch
Patch55: 0055-fs-ntfs3-Remove-before-constant-in-ni_insert_residen.patch
Patch56: 0056-fs-ntfs3-Place-Comparisons-constant-right-side-of-th.patch
Patch57: 0057-fs-ntfs3-Remove-braces-from-single-statment-block.patch
Patch58: 0058-fs-ntfs3-Remove-tabs-before-spaces-from-comment.patch
Patch59: 0059-fs-ntfs3-Fix-ntfs_look_for_free_space-does-only-repo.patch
Patch60: 0060-fs-ntfs3-Remove-always-false-condition-check.patch
Patch61: 0061-fs-ntfs3-Use-clamp-max-macros-instead-of-comparisons.patch
Patch62: 0062-fs-ntfs3-Use-min-max-macros-instated-of-ternary-oper.patch
Patch63: 0063-fs-ntfs3-Fix-wrong-error-message-Logfile-UpCase.patch
Patch64: 0064-fs-ntfs3-Change-EINVAL-to-ENOMEM-when-d_make_root-fa.patch
Patch65: 0065-fs-ntfs3-Remove-impossible-fault-condition-in-fill_s.patch
Patch66: 0066-fs-ntfs3-Return-straight-without-goto-in-fill_super.patch
Patch67: 0067-fs-ntfs3-Remove-unnecessary-variable-loading-in-fill.patch
Patch68: 0068-fs-ntfs3-Use-sb-instead-of-sbi-sb-in-fill_super.patch
Patch69: 0069-fs-ntfs3-Remove-tmp-var-is_ro-in-ntfs_fill_super.patch
Patch70: 0070-fs-ntfs3-Remove-tmp-pointer-bd_inode-in-fill_super.patch
Patch71: 0071-fs-ntfs3-Remove-tmp-pointer-upcase-in-fill_super.patch
Patch72: 0072-fs-ntfs3-Initialize-pointer-before-use-place-in-fill.patch
Patch73: 0073-fs-ntfs3-Initiliaze-sb-blocksize-only-in-one-place-r.patch
Patch74: 0074-fs-ntfs3-Fix-a-memory-leak-on-object-opts.patch
Patch75: 0075-fs-ntfs3-Fix-insertion-of-attr-in-ni_ins_attr_ext.patch
Patch76: 0076-fs-ntfs3-Change-max-hardlinks-limit-to-4000.patch
Patch77: 0077-fs-ntfs3-Add-sync-flag-to-ntfs_sb_write_run-and-al_u.patch
Patch78: 0078-fs-ntfs3-Remove-a-useless-test-in-indx_find.patch
Patch79: 0079-fs-ntfs3-Remove-a-useless-shadowing-variable.patch
Patch80: 0080-fs-ntfs3-Remove-deprecated-mount-options-nls.patch
Patch81: 0081-fs-ntfs3-Fix-logical-error-in-ntfs_create_inode.patch
Patch82: 0082-fs-ntfs3-Move-ni_lock_dir-and-ni_unlock-into-ntfs_cr.patch
Patch83: 0083-fs-ntfs3-Refactor-ntfs_get_acl_ex-for-better-readabi.patch
Patch84: 0084-fs-ntfs3-Pass-flags-to-ntfs_set_ea-in-ntfs_set_acl_e.patch
Patch85: 0085-fs-ntfs3-Change-posix_acl_equiv_mode-to-posix_acl_up.patch
Patch86: 0086-fs-ntfs3-Refactoring-lock-in-ntfs_init_acl.patch
Patch87: 0087-fs-ntfs3-Reject-mount-if-boot-s-cluster-size-media-s.patch
Patch88: 0088-fs-ntfs3-Refactoring-of-ntfs_init_from_boot.patch
Patch89: 0089-fs-ntfs3-Check-for-NULL-if-ATTR_EA_INFO-is-incorrect.patch
Patch90: 0090-fs-ntfs3-Use-available-posix_acl_release-instead-of-.patch
Patch91: 0091-fs-ntfs3-Remove-locked-argument-in-ntfs_set_ea.patch
Patch92: 0092-fs-ntfs3-Refactoring-of-ntfs_set_ea.patch
Patch93: 0093-fs-ntfs3-Forbid-FALLOC_FL_PUNCH_HOLE-for-normal-file.patch
Patch94: 0094-fs-ntfs3-Remove-unnecessary-functions.patch
Patch95: 0095-fs-ntfs3-Keep-prealloc-for-all-types-of-files.patch
Patch96: 0096-fs-ntfs3-Fix-memory-leak-if-fill_super-failed.patch
Patch97: 0097-fs-ntfs3-Rework-ntfs_utf16_to_nls.patch
Patch98: 0098-fs-ntfs3-Refactor-ntfs_readlink_hlp.patch
Patch99: 0099-fs-ntfs3-Refactor-ntfs_create_inode.patch
Patch100: 0100-fs-ntfs3-Refactor-ni_parse_reparse.patch
Patch101: 0101-fs-ntfs3-Refactor-ntfs_read_mft.patch
Patch102: 0102-fs-ntfs3-Check-for-NULL-pointers-in-ni_try_remove_at.patch
Patch103: 0103-merge.patch
Patch9001: 9001-Remove-idmap-mount-support.patch
Patch9002: 9002-Compat-Replace-copy_page_from_iter_atomic-by-iov_ite.patch
Patch9003: 9003-Compat-Replace-BIO_MAX_VECS-by-BIO_MAX_PAGES.patch
Patch9004: 9004-Compat-Replace-readahead-by-readpages.patch
Patch9005: 9005-Compat-Add-fiemap_prep-function.patch
Patch9999: 9999-enable-ntfs3.patch
ExclusiveArch: x86_64 aarch64 ppc64le
BuildRequires: elfutils-libelf-devel
BuildRequires: gcc
BuildRequires: kernel-rpm-macros
BuildRequires: kmod
BuildRequires: make
BuildRequires: redhat-rpm-config
BuildRequires: xz
BuildRequires: kernel-abi-stablelists = %{kernel_version}
BuildRequires: kernel-devel = %{kernel_version}
BuildRequires: kernel-devel-uname-r = %{kernel_version}.%{_arch}
Requires: kernel >= %{kernel_version}
Requires: kernel-uname-r >= %{kernel_version}.%{_arch}
Requires: kernel-modules >= %{kernel_version}
Requires: kernel-modules-uname-r >= %{kernel_version}.%{_arch}
Provides: installonlypkg(kernel-module)
Provides: kernel-modules >= %{kernel_version}.%{_arch}
Requires(post): %{_sbindir}/depmod
Requires(postun): %{_sbindir}/depmod
Requires(post): %{_sbindir}/weak-modules
Requires(postun): %{_sbindir}/weak-modules
%if "%{version}" == "4.18.0.0" && "%{release}" == "2%{?dist}"
Obsoletes: kmod-%{pkg} = %{?epoch:%{epoch}:}%{version}-1%{?dist}
%endif
%description
This package provides the required kernel module (ntfs3) to mount devices
formatted with the Windows OS native file system (NTFS) up to version 3.1.
%prep
%autosetup -p1 -n %{pkg}-%{driver_version}
%build
pushd src
%{__make} -C /usr/src/kernels/%{kernel_version}.%{_arch} %{?_smp_mflags} M=$PWD modules
popd
%install
%{__install} -D -t %{buildroot}/lib/modules/%{kernel_version}.%{_arch}/extra/fs/%{pkg} src/%{pkg}.ko
# Make .ko objects temporarily executable for automatic stripping
find %{buildroot}/lib/modules -type f -name \*.ko -exec chmod u+x \{\} \+
%clean
%{__rm} -rf %{buildroot}
%post
mkdir -p %{_localstatedir}/lib/rpm-state/sig-kmods
printf '%s\n' "/lib/modules/%{kernel_version}.%{_arch}/extra/fs/%{pkg}/%{pkg}.ko.xz" >> %{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-add
%preun
mkdir -p %{_localstatedir}/lib/rpm-state/sig-kmods
rpm -ql kmod-%{pkg}-%{?epoch:%{epoch}:}%{version}-%{release}.%{_arch} | grep '/lib/modules/%{kernel_version}.%{_arch}/.*\.ko\.xz$' >> %{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-remove
%postun
if [ -f %{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-remove ]
then
modules=( $(cat %{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-remove) )
rm -f %{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-remove
rmdir --ignore-fail-on-non-empty %{_localstatedir}/lib/rpm-state/sig-kmods
printf '%s\n' "${modules[@]}" | %{_sbindir}/weak-modules --remove-modules
fi
%pretrans -p <lua>
posix.unlink("%{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-add")
posix.unlink("%{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-remove")
%posttrans
if [ -f %{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-add ]
then
modules=( $(cat %{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-add) )
rm -f %{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-add
rmdir --ignore-fail-on-non-empty %{_localstatedir}/lib/rpm-state/sig-kmods
printf '%s\n' "${modules[@]}" | %{_sbindir}/weak-modules --add-modules
fi
%files
%defattr(644,root,root,755)
/lib/modules/%{kernel_version}.%{_arch}
%license LICENSES
%changelog
* Fri Jun 03 2022 Kmods SIG <sig-kmods@centosproject.org> - 4.18.0.0-4
- Rebuild for 4.18.0-394.el8
* Sun Jan 23 2022 Kmods SIG <sig-kmods@centosproject.org> - 4.18.0.0-3
- Rebuild for 4.18.0-358.el8
* Sat Jan 22 2022 Peter Georg <peter.georg@physik.uni-regensburg.de> - 4.18.0.0-2
- Enable ppc64le
* Thu Jan 13 2022 Kmods SIG <sig-kmods@centosproject.org> - 4.18.0.0-1
- Switch to EL kernel source and versioning
- kABI tracking kmod package (kernel >= 4.18.0-348.el8)