forked from pool/util-linux
Accepting request 627977 from Base:System
OBS-URL: https://build.opensuse.org/request/show/627977 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/util-linux?expand=0&rev=231
This commit is contained in:
commit
503c332961
@ -1,11 +1,11 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
if test util-linux.spec -ot python-libmount.spec ; then
|
if test util-linux.spec -ot python3-libmount.spec ; then
|
||||||
echo "util-linux.spec is older than python-libmount.spec. Please merge changes manually and call pre-checkin.sh again."
|
echo "util-linux.spec is older than python3-libmount.spec. Please merge changes manually and call pre-checkin.sh again."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
if test util-linux.changes -ot python-libmount.changes ; then
|
if test util-linux.changes -ot python3-libmount.changes ; then
|
||||||
echo "util-linux.changes is older than python-libmount.changes. Please merge changes manually and call pre-checkin.sh again."
|
echo "util-linux.changes is older than python3-libmount.changes. Please merge changes manually and call pre-checkin.sh again."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -19,10 +19,10 @@ if test util-linux.changes -ot util-linux-systemd.changes ; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
sed '
|
sed '
|
||||||
s/spec file for package util-linux/spec file for package python-libmount/;
|
s/spec file for package util-linux/spec file for package python3-libmount/;
|
||||||
/^Name:/s/util-linux/python-libmount/;
|
/^Name:/s/util-linux/python3-libmount/;
|
||||||
s/WARNING: After editing this file please/WARNING: Never edit this file!!! Edit util-linux.spec and/
|
s/WARNING: After editing this file please/WARNING: Never edit this file!!! Edit util-linux.spec and/
|
||||||
' <util-linux.spec >python-libmount.spec
|
' <util-linux.spec >python3-libmount.spec
|
||||||
|
|
||||||
sed '
|
sed '
|
||||||
s/spec file for package util-linux/spec file for package util-linux-systemd/;
|
s/spec file for package util-linux/spec file for package util-linux-systemd/;
|
||||||
@ -30,7 +30,7 @@ sed '
|
|||||||
s/WARNING: After editing this file please/WARNING: Never edit this file!!! Edit util-linux.spec and/
|
s/WARNING: After editing this file please/WARNING: Never edit this file!!! Edit util-linux.spec and/
|
||||||
' <util-linux.spec >util-linux-systemd.spec
|
' <util-linux.spec >util-linux-systemd.spec
|
||||||
|
|
||||||
cp -a util-linux.changes python-libmount.changes
|
cp -a util-linux.changes python3-libmount.changes
|
||||||
|
|
||||||
cp -a util-linux.changes util-linux-systemd.changes
|
cp -a util-linux.changes util-linux-systemd.changes
|
||||||
|
|
||||||
|
@ -1,3 +1,41 @@
|
|||||||
|
-------------------------------------------------------------------
|
||||||
|
Mon Aug 6 15:21:35 CEST 2018 - sbrabec@suse.com
|
||||||
|
|
||||||
|
- Update to version 2.32.1:
|
||||||
|
* cal(1) has been improved and extended.
|
||||||
|
* libblkid has been extended to support LUKS2, Micron mpool, VDO
|
||||||
|
and Atari partition table.
|
||||||
|
* rfkill(8) has been moved to /usr/sbin.
|
||||||
|
* dmesg(1) provides better support for multi-line messages, new
|
||||||
|
command line option --force-prefix.
|
||||||
|
* fallocate(1) --dig-holes is faster and more effect now.
|
||||||
|
* fdisk(8) provides access to Protective MBR accessible from main
|
||||||
|
menu. Sun label support has been improved.
|
||||||
|
* lscpu(1) provides more details about ARM CPUs now
|
||||||
|
(FATE#326453).
|
||||||
|
* lsmem(1) supports memory zone awareness now (FATE#324252,
|
||||||
|
drop util-linux-lsmem-memory-zone-1.patch,
|
||||||
|
util-linux-lsmem-memory-zone-2.patch,
|
||||||
|
util-linux-lsmem-memory-zone-3.patch).
|
||||||
|
* lsns(8) provides netnsid and nsfs columns now.
|
||||||
|
* rtcwake(8) waits stdin to settle down before entering a system
|
||||||
|
sleep.
|
||||||
|
* Many fixes and improvements, see
|
||||||
|
https://www.kernel.org/pub/linux/utils/util-linux/v2.32/v2.32-ReleaseNotes
|
||||||
|
https://www.kernel.org/pub/linux/utils/util-linux/v2.32/v2.32.1-ReleaseNotes
|
||||||
|
(drop util_linux_bigendian.patch, util-linux-cramfs.patch,
|
||||||
|
util-linux-fincore-count.patch,
|
||||||
|
util-linux-sysfs-nvme-devno.patch, util-linux-lscpu-loop.patch,
|
||||||
|
util-linux-libmount-umount-a-segfault.patch,
|
||||||
|
util-linux-libmount-mount-a-nfs-bind-mount.patch,
|
||||||
|
util-linux-lscpu-chcpu-new-cpu-macros.patch,
|
||||||
|
util-linux-chcpu-cpu-count.patch).
|
||||||
|
|
||||||
|
-------------------------------------------------------------------
|
||||||
|
Tue Jul 3 16:27:27 CEST 2018 - sbrabec@suse.com
|
||||||
|
|
||||||
|
- Switch python-libmount to python3-libmount.
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Tue May 22 11:54:13 UTC 2018 - tchvatal@suse.com
|
Tue May 22 11:54:13 UTC 2018 - tchvatal@suse.com
|
||||||
|
|
@ -1,5 +1,5 @@
|
|||||||
#
|
#
|
||||||
# spec file for package python-libmount
|
# spec file for package python3-libmount
|
||||||
#
|
#
|
||||||
# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany.
|
# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany.
|
||||||
#
|
#
|
||||||
@ -22,7 +22,7 @@
|
|||||||
%bcond_with enable_last
|
%bcond_with enable_last
|
||||||
%endif
|
%endif
|
||||||
|
|
||||||
Name: python-libmount
|
Name: python3-libmount
|
||||||
%define _name util-linux
|
%define _name util-linux
|
||||||
# WARNING: Never edit this file!!! Edit util-linux.spec and call pre_checkin.sh to update spec files:
|
# WARNING: Never edit this file!!! Edit util-linux.spec and call pre_checkin.sh to update spec files:
|
||||||
%define _name util-linux
|
%define _name util-linux
|
||||||
@ -43,7 +43,7 @@ Name: python-libmount
|
|||||||
%define group_ul System/Base
|
%define group_ul System/Base
|
||||||
%define group_uls System/Base
|
%define group_uls System/Base
|
||||||
%define group_pl Development/Languages/Python
|
%define group_pl Development/Languages/Python
|
||||||
%if "%{name}" == "python-libmount"
|
%if "%{name}" == "python3-libmount"
|
||||||
%define build_util_linux 0
|
%define build_util_linux 0
|
||||||
%define build_util_linux_systemd 0
|
%define build_util_linux_systemd 0
|
||||||
%define build_python_libmount 1
|
%define build_python_libmount 1
|
||||||
@ -101,7 +101,7 @@ BuildRequires: systemd-rpm-macros
|
|||||||
BuildRequires: pkgconfig(libsystemd)
|
BuildRequires: pkgconfig(libsystemd)
|
||||||
%endif
|
%endif
|
||||||
%if %build_python_libmount
|
%if %build_python_libmount
|
||||||
BuildRequires: python-devel
|
BuildRequires: python3-devel
|
||||||
%endif
|
%endif
|
||||||
#BEGIN SECOND STAGE DEPENDENCIES
|
#BEGIN SECOND STAGE DEPENDENCIES
|
||||||
%if !%build_util_linux
|
%if !%build_util_linux
|
||||||
@ -116,7 +116,7 @@ BuildRequires: libmount-devel
|
|||||||
%endif
|
%endif
|
||||||
%endif
|
%endif
|
||||||
#END SECOND STAGE DEPENDENCIES
|
#END SECOND STAGE DEPENDENCIES
|
||||||
Version: 2.31.1
|
Version: 2.32.1
|
||||||
Release: 0
|
Release: 0
|
||||||
# util-linux is a base package and uuidd pre-requiring pwdutils pulls
|
# util-linux is a base package and uuidd pre-requiring pwdutils pulls
|
||||||
# that into the core build cycle. pwdutils also pulls in the whole
|
# that into the core build cycle. pwdutils also pulls in the whole
|
||||||
@ -125,7 +125,7 @@ Release: 0
|
|||||||
# these tools as well
|
# these tools as well
|
||||||
#!BuildIgnore: pwdutils
|
#!BuildIgnore: pwdutils
|
||||||
Url: https://www.kernel.org/pub/linux/utils/util-linux/
|
Url: https://www.kernel.org/pub/linux/utils/util-linux/
|
||||||
Source: https://www.kernel.org/pub/linux/utils/util-linux/v2.31/util-linux-%{version}.tar.xz
|
Source: https://www.kernel.org/pub/linux/utils/util-linux/v2.32/util-linux-%{version}.tar.xz
|
||||||
Source1: util-linux-rpmlintrc
|
Source1: util-linux-rpmlintrc
|
||||||
Source4: raw.service
|
Source4: raw.service
|
||||||
Source5: etc.raw
|
Source5: etc.raw
|
||||||
@ -135,7 +135,7 @@ Source8: login.pamd
|
|||||||
Source9: remote.pamd
|
Source9: remote.pamd
|
||||||
Source10: su.pamd
|
Source10: su.pamd
|
||||||
Source11: su.default
|
Source11: su.default
|
||||||
Source12: https://www.kernel.org/pub/linux/utils/util-linux/v2.31/util-linux-%{version}.tar.sign
|
Source12: https://www.kernel.org/pub/linux/utils/util-linux/v2.32/util-linux-%{version}.tar.sign
|
||||||
Source13: %{_name}.keyring
|
Source13: %{_name}.keyring
|
||||||
Source14: runuser.pamd
|
Source14: runuser.pamd
|
||||||
Source15: runuser-l.pamd
|
Source15: runuser-l.pamd
|
||||||
@ -160,30 +160,6 @@ Source51: blkid.conf
|
|||||||
##
|
##
|
||||||
# PATCH-EXTEND-UPSTREAM: Let `su' handle /sbin and /usr/sbin in path
|
# PATCH-EXTEND-UPSTREAM: Let `su' handle /sbin and /usr/sbin in path
|
||||||
Patch0: make-sure-sbin-resp-usr-sbin-are-in-PATH.diff
|
Patch0: make-sure-sbin-resp-usr-sbin-are-in-PATH.diff
|
||||||
# PATCH-FEATURE-UPSTREAM util-linux-lsmem-memory-zone-1.patch bsc1065471 FATE324252 sbrabec@suse.com -- lsmem: Add support for zone awareness.
|
|
||||||
Patch1: util-linux-lsmem-memory-zone-1.patch
|
|
||||||
# PATCH-FEATURE-UPSTREAM util-linux-lsmem-memory-zone-2.patch bsc1065471 FATE324252 sbrabec@suse.com -- lsmem: Add support for zone awareness.
|
|
||||||
Patch2: util-linux-lsmem-memory-zone-2.patch
|
|
||||||
# PATCH-FEATURE-UPSTREAM util-linux-lsmem-memory-zone-3.patch bsc1065471 FATE324252 sbrabec@suse.com -- lsmem: Add support for zone awareness.
|
|
||||||
Patch3: util-linux-lsmem-memory-zone-3.patch
|
|
||||||
# Add four commits from upstream to pass tests on ppc64
|
|
||||||
Patch4: util_linux_bigendian.patch
|
|
||||||
# PATCH-FIX-UPSTREAM util-linux-cramfs.patch sbrabec@suse.com -- Fix fsck.cramfs failure on ppc64le.
|
|
||||||
Patch5: util-linux-cramfs.patch
|
|
||||||
# PATCH-FIX-UPSTREAM util-linux-fincore-count.patch sbrabec@suse.com -- Disable bad test fincore/count.
|
|
||||||
Patch6: util-linux-fincore-count.patch
|
|
||||||
# PATCH-FIX-UPSTREAM util-linux-sysfs-nvme-devno.patch bsc1078662 sbrabec@suse.com -- Fix lsblk on NVMe.
|
|
||||||
Patch7: util-linux-sysfs-nvme-devno.patch
|
|
||||||
# PATCH-FIX-UPSTREAM util-linux-lscpu-loop.patch bsc1072947 sbrabec@suse.com -- Fix crash loop in lscpu.
|
|
||||||
Patch8: util-linux-lscpu-loop.patch
|
|
||||||
# PATCH-FIX-UPSTREAM util-linux-libmount-umount-a-segfault.patch sbrabec@suse.com -- Fix possible segfault of umount -a.
|
|
||||||
Patch9: util-linux-libmount-umount-a-segfault.patch
|
|
||||||
# PATCH-FIX-UPSTREAM util-linux-libmount-mount-a-nfs-bind-mount.patch bsc1080740 sbrabec@suse.com -- Fix mount -a on NFS bind mounts.
|
|
||||||
Patch10: util-linux-libmount-mount-a-nfs-bind-mount.patch
|
|
||||||
# PATCH-FIX-UPSTREAM util-linux-lscpu-chcpu-new-cpu-macros.patch bnc1091164 sbrabec@suse.com -- Fix lscpu and chcpu on systems with >1024 cores.
|
|
||||||
Patch11: util-linux-lscpu-chcpu-new-cpu-macros.patch
|
|
||||||
# PATCH-FIX-UPSTREAM util-linux-chcpu-cpu-count.patch bnc1091164 sbrabec@suse.com -- chcpu: Properly count CPUs.
|
|
||||||
Patch12: util-linux-chcpu-cpu-count.patch
|
|
||||||
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
||||||
#
|
#
|
||||||
%if %build_util_linux
|
%if %build_util_linux
|
||||||
@ -405,11 +381,11 @@ SMP systems.
|
|||||||
%endif
|
%endif
|
||||||
%if %build_python_libmount
|
%if %build_python_libmount
|
||||||
%if %build_util_linux
|
%if %build_util_linux
|
||||||
%package -n python-libmount
|
%package -n python3-libmount
|
||||||
Summary: %summary_pl
|
Summary: %summary_pl
|
||||||
Group: %group_pl
|
Group: %group_pl
|
||||||
|
|
||||||
%description -n python-libmount
|
%description -n python3-libmount
|
||||||
%else
|
%else
|
||||||
%description
|
%description
|
||||||
%endif
|
%endif
|
||||||
@ -420,18 +396,6 @@ library.
|
|||||||
%prep
|
%prep
|
||||||
%setup -q -n %{_name}-%{version} -b 40
|
%setup -q -n %{_name}-%{version} -b 40
|
||||||
%patch0 -p1
|
%patch0 -p1
|
||||||
%patch1 -p1
|
|
||||||
%patch2 -p1
|
|
||||||
%patch3 -p1
|
|
||||||
%patch4 -p1
|
|
||||||
%patch5 -p1
|
|
||||||
%patch6 -p1
|
|
||||||
%patch7 -p1
|
|
||||||
%patch8 -p1
|
|
||||||
%patch9 -p1
|
|
||||||
%patch10 -p1
|
|
||||||
%patch11 -p1
|
|
||||||
%patch12 -p1
|
|
||||||
#
|
#
|
||||||
# setctsid
|
# setctsid
|
||||||
cp -p %{S:22} %{S:23} .
|
cp -p %{S:22} %{S:23} .
|
||||||
@ -674,7 +638,7 @@ install -Dm644 %{SOURCE42} %{buildroot}%{_unitdir}/rfkill-unblock@.service
|
|||||||
# util-linux install
|
# util-linux install
|
||||||
#
|
#
|
||||||
%make_install
|
%make_install
|
||||||
rm -f %{buildroot}%{python_sitearch}/libmount/*.*a
|
rm -f %{buildroot}%{python3_sitearch}/libmount/*.*a
|
||||||
%if %build_util_linux
|
%if %build_util_linux
|
||||||
#UsrMerge
|
#UsrMerge
|
||||||
ln -s %{_bindir}/kill %{buildroot}/bin
|
ln -s %{_bindir}/kill %{buildroot}/bin
|
||||||
@ -1376,12 +1340,12 @@ getent passwd uuidd >/dev/null || \
|
|||||||
|
|
||||||
%if %build_python_libmount
|
%if %build_python_libmount
|
||||||
%if %build_util_linux
|
%if %build_util_linux
|
||||||
%files -n python-libmount
|
%files -n python3-libmount
|
||||||
%else
|
%else
|
||||||
%files
|
%files
|
||||||
%endif
|
%endif
|
||||||
%defattr(-, root, root)
|
%defattr(-, root, root)
|
||||||
%{python_sitearch}/libmount
|
%{python3_sitearch}/libmount
|
||||||
%endif
|
%endif
|
||||||
|
|
||||||
%changelog
|
%changelog
|
@ -1,16 +0,0 @@
|
|||||||
-----BEGIN PGP SIGNATURE-----
|
|
||||||
|
|
||||||
iQIzBAABCAAdFiEEsMZNFDAcxu+u32Dk5LcdXuw5woQFAlo5LQkACgkQ5LcdXuw5
|
|
||||||
woSyww//djBJmPc3Jvy7eJSVjC3xbFgro7wHaAM0BSFYgiW1aSsR04sSwGIEMtbv
|
|
||||||
EMOyF83qVKSoiWb57VOeJGSCWXUPkMPaTzretEyaD5IH3rHBDp7Q5oTUMlNmLnoT
|
|
||||||
q86oYBKNXox5bbLHPqpQaLUGGJWIjz9suRtT1Uau+ZKRudO3f9YZCJBnCkqTpqX+
|
|
||||||
7TqPK53Gen1jw3u7kz1CRDMsTllfV1Gw+hhq8YI/xPApTLRIcBWq9DUVu9v5PHjQ
|
|
||||||
M8rh9d3693mgkhtPQAGShKpC8nz0013AOG8bJm0yL69YWlVdhFDR2DColxZE1nEe
|
|
||||||
3T7aZPZCseObHR1rqMUngKMD6B6D7XPfexWuWXRHgr7Aayz6S/IOYTvTjtBkgNri
|
|
||||||
KJ+QDn/6Xs5xTsWu6wSh7wXfjtwk7NuLY1pVo9pL3r4KmfIBbODwE80FKSqCwHJm
|
|
||||||
kI7J2QIiaKGWfry6vqrUgECGY48f1W0PNfgCbdJDW1HsVCvTaUiXfIc++HTxgxpv
|
|
||||||
6IcU1a4ikVT9zRMVE5ypgZPIkwSaGJgeV1YwCa9qanM3dx86D/DTzLVdr/Nhvn96
|
|
||||||
uPdp287aebllU+O1QK/79q5pf/UcBofgNc9GsVgtqlKNYN+REuoqYsDQ/Sz12kor
|
|
||||||
SdF/tR3qtdTucdD/4fUcF2Uv8RLmc4cknZdz37ld6q0TSeyZShE=
|
|
||||||
=uflt
|
|
||||||
-----END PGP SIGNATURE-----
|
|
@ -1,3 +0,0 @@
|
|||||||
version https://git-lfs.github.com/spec/v1
|
|
||||||
oid sha256:1a51b16fa9cd51d26ef9ab52d2f1de12403b810fc8252bf7d478df91b3cddf11
|
|
||||||
size 4510096
|
|
16
util-linux-2.32.1.tar.sign
Normal file
16
util-linux-2.32.1.tar.sign
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
-----BEGIN PGP SIGNATURE-----
|
||||||
|
|
||||||
|
iQIzBAABCAAdFiEEsMZNFDAcxu+u32Dk5LcdXuw5woQFAltMdfIACgkQ5LcdXuw5
|
||||||
|
woRrBw//aQiUjq1kJ5ilwNxhuRHqCwltM8aIEsV5KxT2QG71ZSaAAJy/9+T9HTjW
|
||||||
|
/Olv2jzf2dOYsY0pZ7+mhXxiMe/Oh5IQcsoeq1AwefriMNf7CMwWmOqnR/ijSF1j
|
||||||
|
2Ij8wCpCkroqZj1o+YYX8paaDRpfany6yahSMbBCRD6SW+e1huMuSzMp2O6KRhMG
|
||||||
|
k8xR0Oxq+Ok4R2VW9gUrHAwDIu54D48h77Pcp9hZ4Jn86ay6i3VBvJ7AsZW62lUu
|
||||||
|
E1Qk4P/QIXk7W5PLAcbIdaznmSDfbJmnnDln9t269fq50IKyj/fp8oYkIO5VOVZL
|
||||||
|
PJJh7cn2uAGY5C8RCmpt6f5GpDDMVyn/K/5fSgRsYge1hRJ+Z3l/buCGr5jI3vjt
|
||||||
|
65UuFg7eKnqHLZEp7EVB7GlMjsKT83Pllz5tVvbmP/+wH4hihYEyxcmWkFvU/ZbC
|
||||||
|
xntvp4ciSEyXJNkNyPwhprjuUx47MqipkTXDE8OSW7LhfHcrCpDKVNBljxWhTKqP
|
||||||
|
UUGHq1nj18RtyNz9vRtwdLh0wDmyy2pNen12qcqLVRqoJAM05C1wl3eRwEKTvThz
|
||||||
|
ZXLEQGbuf7EIDh50hg/MXn9S4bVh4S9wnWfx5qgwGBMVZzUrAWJ7c+SLWocvaEOQ
|
||||||
|
LoYOKTVelY12+yPUNBHmNQl3e6dtFu+e9kRRc08whdNdIi6ILBw=
|
||||||
|
=PX83
|
||||||
|
-----END PGP SIGNATURE-----
|
3
util-linux-2.32.1.tar.xz
Normal file
3
util-linux-2.32.1.tar.xz
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:86e6707a379c7ff5489c218cfaf1e3464b0b95acf7817db0bc5f179e356a67b2
|
||||||
|
size 4561088
|
@ -1,72 +0,0 @@
|
|||||||
From 607274943bfd3d4856b872bc4278b36903fb2182 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Stanislav Brabec <sbrabec@suse.cz>
|
|
||||||
Date: Wed, 9 May 2018 22:13:07 +0200
|
|
||||||
Subject: [PATCH] chcpu: Fix maximal number of CPUs
|
|
||||||
|
|
||||||
chcpu.c mixed maxcpus (number of cpus) and setsize (size of CPU bit
|
|
||||||
mask). It effectively limits number of CPUs to 1/8 of the supported
|
|
||||||
amount.
|
|
||||||
|
|
||||||
Signed-off-by: Stanislav Brabec <sbrabec@suse.cz>
|
|
||||||
Cc: Michael Matz <matz@suse.de>
|
|
||||||
Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
|
|
||||||
---
|
|
||||||
sys-utils/chcpu.c | 16 ++++++++--------
|
|
||||||
1 file changed, 8 insertions(+), 8 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/sys-utils/chcpu.c b/sys-utils/chcpu.c
|
|
||||||
index f32b7a6fc..4b5c7579a 100644
|
|
||||||
--- a/sys-utils/chcpu.c
|
|
||||||
+++ b/sys-utils/chcpu.c
|
|
||||||
@@ -75,12 +75,12 @@ enum {
|
|
||||||
*/
|
|
||||||
static int cpu_enable(cpu_set_t *cpu_set, size_t setsize, int enable)
|
|
||||||
{
|
|
||||||
- unsigned int cpu;
|
|
||||||
+ int cpu;
|
|
||||||
int online, rc;
|
|
||||||
int configured = -1;
|
|
||||||
- size_t fails = 0;
|
|
||||||
+ int fails = 0;
|
|
||||||
|
|
||||||
- for (cpu = 0; cpu < setsize; cpu++) {
|
|
||||||
+ for (cpu = 0; cpu < maxcpus; cpu++) {
|
|
||||||
if (!CPU_ISSET_S(cpu, setsize, cpu_set))
|
|
||||||
continue;
|
|
||||||
if (!path_exist(_PATH_SYS_CPU "/cpu%d", cpu)) {
|
|
||||||
@@ -132,7 +132,7 @@ static int cpu_enable(cpu_set_t *cpu_set, size_t setsize, int enable)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
- return fails == 0 ? 0 : fails == setsize ? -1 : 1;
|
|
||||||
+ return fails == 0 ? 0 : fails == maxcpus ? -1 : 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int cpu_rescan(void)
|
|
||||||
@@ -168,11 +168,11 @@ static int cpu_set_dispatch(int mode)
|
|
||||||
*/
|
|
||||||
static int cpu_configure(cpu_set_t *cpu_set, size_t setsize, int configure)
|
|
||||||
{
|
|
||||||
- unsigned int cpu;
|
|
||||||
+ int cpu;
|
|
||||||
int rc, current;
|
|
||||||
- size_t fails = 0;
|
|
||||||
+ int fails = 0;
|
|
||||||
|
|
||||||
- for (cpu = 0; cpu < setsize; cpu++) {
|
|
||||||
+ for (cpu = 0; cpu < maxcpus; cpu++) {
|
|
||||||
if (!CPU_ISSET_S(cpu, setsize, cpu_set))
|
|
||||||
continue;
|
|
||||||
if (!path_exist(_PATH_SYS_CPU "/cpu%d", cpu)) {
|
|
||||||
@@ -217,7 +217,7 @@ static int cpu_configure(cpu_set_t *cpu_set, size_t setsize, int configure)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
- return fails == 0 ? 0 : fails == setsize ? -1 : 1;
|
|
||||||
+ return fails == 0 ? 0 : fails == maxcpus ? -1 : 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void cpu_parse(char *cpu_string, cpu_set_t *cpu_set, size_t setsize)
|
|
||||||
--
|
|
||||||
2.16.3
|
|
||||||
|
|
@ -1,406 +0,0 @@
|
|||||||
commit 68ac426949170bb3802a6d610f366f24aa0bb734
|
|
||||||
Author: Ruediger Meier <ruediger.meier@ga-group.nl>
|
|
||||||
Date: Tue Jan 23 16:59:25 2018 +0100
|
|
||||||
|
|
||||||
fsck.cramfs: fix error message
|
|
||||||
|
|
||||||
errno is invalid in case that we just read(3) too short.
|
|
||||||
|
|
||||||
Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
|
|
||||||
|
|
||||||
commit c990f94cbcc68c7bab47458a09e361ce0791b6d8
|
|
||||||
Author: Ruediger Meier <ruediger.meier@ga-group.nl>
|
|
||||||
Date: Tue Jan 23 16:59:24 2018 +0100
|
|
||||||
|
|
||||||
tests: rewrite fsck-bad-header
|
|
||||||
|
|
||||||
Fix test for systems with pagesize != 4096
|
|
||||||
Loop over many combinations of sizes, endianness and blocksizes.
|
|
||||||
|
|
||||||
Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
|
|
||||||
|
|
||||||
commit 2374b1ab75c66c9ecea86fc97abb6d6c048bcf45
|
|
||||||
Author: Ruediger Meier <ruediger.meier@ga-group.nl>
|
|
||||||
Date: Tue Jan 23 16:59:23 2018 +0100
|
|
||||||
|
|
||||||
fsck.cramfs: fix crash when superblock size is too small
|
|
||||||
|
|
||||||
This hopefully fixes the original problem addressed by the reverted
|
|
||||||
patch 7cb962c7.
|
|
||||||
|
|
||||||
The bug was introduced by myself in
|
|
||||||
f991dbd3 "fsck.cramfs: allow smaller superblock sizes"
|
|
||||||
|
|
||||||
CC: Tobias Stoeckmann <tobias@stoeckmann.org>
|
|
||||||
Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
|
|
||||||
|
|
||||||
commit 919e372da872bcc37502783e80564654569edb22
|
|
||||||
Author: Ruediger Meier <ruediger.meier@ga-group.nl>
|
|
||||||
Date: Tue Jan 23 16:59:22 2018 +0100
|
|
||||||
|
|
||||||
Revert "fsck.cramfs: Fix bus error on broken file system."
|
|
||||||
|
|
||||||
This reverts commit 7cb962c77015e9383b53eeb22ce732cb5216bbc3.
|
|
||||||
|
|
||||||
It can't be right that we mmap (start + super.size) bytes from a file
|
|
||||||
which is usually only super.size bytes large. The patch "fixed" a
|
|
||||||
problem when super.size is bad but now it fails for the correct case:
|
|
||||||
|
|
||||||
$ mkdir -p root/subdir
|
|
||||||
$ ./mkfs.cramfs -p root cramfs
|
|
||||||
$ ./fsck.cramfs cramfs
|
|
||||||
Bus error (core dumped)
|
|
||||||
|
|
||||||
We will fix the original problem later.
|
|
||||||
|
|
||||||
CC: Tobias Stoeckmann <tobias@stoeckmann.org>
|
|
||||||
Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
|
|
||||||
|
|
||||||
diff -urN util-linux-2.31.1.orig/disk-utils/fsck.cramfs.c util-linux-2.31.1/disk-utils/fsck.cramfs.c
|
|
||||||
--- util-linux-2.31.1.orig/disk-utils/fsck.cramfs.c 2017-12-14 15:26:35.141144200 +0100
|
|
||||||
+++ util-linux-2.31.1/disk-utils/fsck.cramfs.c 2018-01-26 18:41:01.001095311 +0100
|
|
||||||
@@ -192,7 +192,7 @@
|
|
||||||
errx(FSCK_EX_ERROR, _("unsupported filesystem features"));
|
|
||||||
|
|
||||||
/* What are valid superblock sizes? */
|
|
||||||
- if (super.size < sizeof(struct cramfs_super))
|
|
||||||
+ if (super.size < *start + sizeof(struct cramfs_super))
|
|
||||||
errx(FSCK_EX_UNCORRECTED, _("superblock size (%d) too small"),
|
|
||||||
super.size);
|
|
||||||
|
|
||||||
@@ -220,24 +220,28 @@
|
|
||||||
crc = crc32(0L, NULL, 0);
|
|
||||||
|
|
||||||
buf =
|
|
||||||
- mmap(NULL, start + super.size, PROT_READ | PROT_WRITE, MAP_PRIVATE, fd, 0);
|
|
||||||
+ mmap(NULL, super.size, PROT_READ | PROT_WRITE, MAP_PRIVATE, fd, 0);
|
|
||||||
if (buf == MAP_FAILED) {
|
|
||||||
buf =
|
|
||||||
- mmap(NULL, start + super.size, PROT_READ | PROT_WRITE,
|
|
||||||
+ mmap(NULL, super.size, PROT_READ | PROT_WRITE,
|
|
||||||
MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
|
|
||||||
if (buf != MAP_FAILED) {
|
|
||||||
- if (lseek(fd, start, SEEK_SET) == (off_t) -1)
|
|
||||||
+ ssize_t tmp;
|
|
||||||
+ if (lseek(fd, 0, SEEK_SET) == (off_t) -1)
|
|
||||||
err(FSCK_EX_ERROR, _("seek on %s failed"), filename);
|
|
||||||
- if (read(fd, (unsigned char *) buf + start, super.size) !=
|
|
||||||
- (ssize_t) super.size)
|
|
||||||
+ tmp = read(fd, buf, super.size);
|
|
||||||
+ if (tmp < 0)
|
|
||||||
err(FSCK_EX_ERROR, _("cannot read %s"), filename);
|
|
||||||
+ if (tmp != (ssize_t) super.size)
|
|
||||||
+ errx(FSCK_EX_ERROR, _("failed to read %"PRIu32" bytes from file %s"),
|
|
||||||
+ super.size, filename);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (buf != MAP_FAILED) {
|
|
||||||
((struct cramfs_super *)((unsigned char *) buf + start))->fsid.crc =
|
|
||||||
crc32(0L, NULL, 0);
|
|
||||||
- crc = crc32(crc, (unsigned char *) buf + start, super.size);
|
|
||||||
- munmap(buf, start + super.size);
|
|
||||||
+ crc = crc32(crc, (unsigned char *) buf + start, super.size - start);
|
|
||||||
+ munmap(buf, super.size);
|
|
||||||
} else {
|
|
||||||
int retval;
|
|
||||||
size_t length = 0;
|
|
||||||
diff -urN util-linux-2.31.1.orig/tests/expected/cramfs/fsck-bad-header util-linux-2.31.1/tests/expected/cramfs/fsck-bad-header
|
|
||||||
--- util-linux-2.31.1.orig/tests/expected/cramfs/fsck-bad-header 2017-12-14 15:26:46.585066844 +0100
|
|
||||||
+++ util-linux-2.31.1/tests/expected/cramfs/fsck-bad-header 1970-01-01 01:00:00.000000000 +0100
|
|
||||||
@@ -1,2 +0,0 @@
|
|
||||||
-fsck.cramfs: file extends past end of filesystem
|
|
||||||
-fsck.cramfs: crc error
|
|
||||||
diff -urN util-linux-2.31.1.orig/tests/expected/cramfs/fsck-bad-header-nopad-4K-be util-linux-2.31.1/tests/expected/cramfs/fsck-bad-header-nopad-4K-be
|
|
||||||
--- util-linux-2.31.1.orig/tests/expected/cramfs/fsck-bad-header-nopad-4K-be 1970-01-01 01:00:00.000000000 +0100
|
|
||||||
+++ util-linux-2.31.1/tests/expected/cramfs/fsck-bad-header-nopad-4K-be 2018-01-26 18:40:57.401031690 +0100
|
|
||||||
@@ -0,0 +1,29 @@
|
|
||||||
+## size: 0
|
|
||||||
+fsck.cramfs: superblock size (0) too small
|
|
||||||
+ret: 4
|
|
||||||
+
|
|
||||||
+## size: 75
|
|
||||||
+fsck.cramfs: superblock size (75) too small
|
|
||||||
+ret: 4
|
|
||||||
+
|
|
||||||
+## size: 76
|
|
||||||
+fsck.cramfs: file extends past end of filesystem
|
|
||||||
+fsck.cramfs: crc error
|
|
||||||
+ret: 4
|
|
||||||
+
|
|
||||||
+## size: 4095
|
|
||||||
+fsck.cramfs: file extends past end of filesystem
|
|
||||||
+fsck.cramfs: crc error
|
|
||||||
+ret: 4
|
|
||||||
+
|
|
||||||
+## size: 4096
|
|
||||||
+ret: 0
|
|
||||||
+
|
|
||||||
+## size: 4097
|
|
||||||
+fsck.cramfs: file length too short
|
|
||||||
+ret: 4
|
|
||||||
+
|
|
||||||
+## size: 4294967295
|
|
||||||
+fsck.cramfs: file length too short
|
|
||||||
+ret: 4
|
|
||||||
+
|
|
||||||
diff -urN util-linux-2.31.1.orig/tests/expected/cramfs/fsck-bad-header-nopad-4K-le util-linux-2.31.1/tests/expected/cramfs/fsck-bad-header-nopad-4K-le
|
|
||||||
--- util-linux-2.31.1.orig/tests/expected/cramfs/fsck-bad-header-nopad-4K-le 1970-01-01 01:00:00.000000000 +0100
|
|
||||||
+++ util-linux-2.31.1/tests/expected/cramfs/fsck-bad-header-nopad-4K-le 2018-01-26 18:40:57.401031690 +0100
|
|
||||||
@@ -0,0 +1,29 @@
|
|
||||||
+## size: 0
|
|
||||||
+fsck.cramfs: superblock size (0) too small
|
|
||||||
+ret: 4
|
|
||||||
+
|
|
||||||
+## size: 75
|
|
||||||
+fsck.cramfs: superblock size (75) too small
|
|
||||||
+ret: 4
|
|
||||||
+
|
|
||||||
+## size: 76
|
|
||||||
+fsck.cramfs: file extends past end of filesystem
|
|
||||||
+fsck.cramfs: crc error
|
|
||||||
+ret: 4
|
|
||||||
+
|
|
||||||
+## size: 4095
|
|
||||||
+fsck.cramfs: file extends past end of filesystem
|
|
||||||
+fsck.cramfs: crc error
|
|
||||||
+ret: 4
|
|
||||||
+
|
|
||||||
+## size: 4096
|
|
||||||
+ret: 0
|
|
||||||
+
|
|
||||||
+## size: 4097
|
|
||||||
+fsck.cramfs: file length too short
|
|
||||||
+ret: 4
|
|
||||||
+
|
|
||||||
+## size: 4294967295
|
|
||||||
+fsck.cramfs: file length too short
|
|
||||||
+ret: 4
|
|
||||||
+
|
|
||||||
diff -urN util-linux-2.31.1.orig/tests/expected/cramfs/fsck-bad-header-pad-4K-be util-linux-2.31.1/tests/expected/cramfs/fsck-bad-header-pad-4K-be
|
|
||||||
--- util-linux-2.31.1.orig/tests/expected/cramfs/fsck-bad-header-pad-4K-be 1970-01-01 01:00:00.000000000 +0100
|
|
||||||
+++ util-linux-2.31.1/tests/expected/cramfs/fsck-bad-header-pad-4K-be 2018-01-26 18:40:57.401031690 +0100
|
|
||||||
@@ -0,0 +1,29 @@
|
|
||||||
+## size: 76
|
|
||||||
+fsck.cramfs: superblock size (76) too small
|
|
||||||
+ret: 4
|
|
||||||
+
|
|
||||||
+## size: 587
|
|
||||||
+fsck.cramfs: superblock size (587) too small
|
|
||||||
+ret: 4
|
|
||||||
+
|
|
||||||
+## size: 588
|
|
||||||
+fsck.cramfs: file extends past end of filesystem
|
|
||||||
+fsck.cramfs: crc error
|
|
||||||
+ret: 4
|
|
||||||
+
|
|
||||||
+## size: 4095
|
|
||||||
+fsck.cramfs: file extends past end of filesystem
|
|
||||||
+fsck.cramfs: crc error
|
|
||||||
+ret: 4
|
|
||||||
+
|
|
||||||
+## size: 4096
|
|
||||||
+ret: 0
|
|
||||||
+
|
|
||||||
+## size: 4097
|
|
||||||
+fsck.cramfs: file length too short
|
|
||||||
+ret: 4
|
|
||||||
+
|
|
||||||
+## size: 4294967295
|
|
||||||
+fsck.cramfs: file length too short
|
|
||||||
+ret: 4
|
|
||||||
+
|
|
||||||
diff -urN util-linux-2.31.1.orig/tests/expected/cramfs/fsck-bad-header-pad-4K-le util-linux-2.31.1/tests/expected/cramfs/fsck-bad-header-pad-4K-le
|
|
||||||
--- util-linux-2.31.1.orig/tests/expected/cramfs/fsck-bad-header-pad-4K-le 1970-01-01 01:00:00.000000000 +0100
|
|
||||||
+++ util-linux-2.31.1/tests/expected/cramfs/fsck-bad-header-pad-4K-le 2018-01-26 18:40:57.401031690 +0100
|
|
||||||
@@ -0,0 +1,29 @@
|
|
||||||
+## size: 76
|
|
||||||
+fsck.cramfs: superblock size (76) too small
|
|
||||||
+ret: 4
|
|
||||||
+
|
|
||||||
+## size: 587
|
|
||||||
+fsck.cramfs: superblock size (587) too small
|
|
||||||
+ret: 4
|
|
||||||
+
|
|
||||||
+## size: 588
|
|
||||||
+fsck.cramfs: file extends past end of filesystem
|
|
||||||
+fsck.cramfs: crc error
|
|
||||||
+ret: 4
|
|
||||||
+
|
|
||||||
+## size: 4095
|
|
||||||
+fsck.cramfs: file extends past end of filesystem
|
|
||||||
+fsck.cramfs: crc error
|
|
||||||
+ret: 4
|
|
||||||
+
|
|
||||||
+## size: 4096
|
|
||||||
+ret: 0
|
|
||||||
+
|
|
||||||
+## size: 4097
|
|
||||||
+fsck.cramfs: file length too short
|
|
||||||
+ret: 4
|
|
||||||
+
|
|
||||||
+## size: 4294967295
|
|
||||||
+fsck.cramfs: file length too short
|
|
||||||
+ret: 4
|
|
||||||
+
|
|
||||||
diff -urN util-linux-2.31.1.orig/tests/expected/cramfs/fsck-bad-header-pad-64K-be util-linux-2.31.1/tests/expected/cramfs/fsck-bad-header-pad-64K-be
|
|
||||||
--- util-linux-2.31.1.orig/tests/expected/cramfs/fsck-bad-header-pad-64K-be 1970-01-01 01:00:00.000000000 +0100
|
|
||||||
+++ util-linux-2.31.1/tests/expected/cramfs/fsck-bad-header-pad-64K-be 2018-01-26 18:40:57.401031690 +0100
|
|
||||||
@@ -0,0 +1,29 @@
|
|
||||||
+## size: 76
|
|
||||||
+fsck.cramfs: superblock size (76) too small
|
|
||||||
+ret: 4
|
|
||||||
+
|
|
||||||
+## size: 587
|
|
||||||
+fsck.cramfs: superblock size (587) too small
|
|
||||||
+ret: 4
|
|
||||||
+
|
|
||||||
+## size: 588
|
|
||||||
+fsck.cramfs: file extends past end of filesystem
|
|
||||||
+fsck.cramfs: crc error
|
|
||||||
+ret: 4
|
|
||||||
+
|
|
||||||
+## size: 65535
|
|
||||||
+fsck.cramfs: file extends past end of filesystem
|
|
||||||
+fsck.cramfs: crc error
|
|
||||||
+ret: 4
|
|
||||||
+
|
|
||||||
+## size: 65536
|
|
||||||
+ret: 0
|
|
||||||
+
|
|
||||||
+## size: 65537
|
|
||||||
+fsck.cramfs: file length too short
|
|
||||||
+ret: 4
|
|
||||||
+
|
|
||||||
+## size: 4294967295
|
|
||||||
+fsck.cramfs: file length too short
|
|
||||||
+ret: 4
|
|
||||||
+
|
|
||||||
diff -urN util-linux-2.31.1.orig/tests/expected/cramfs/fsck-bad-header-pad-64K-le util-linux-2.31.1/tests/expected/cramfs/fsck-bad-header-pad-64K-le
|
|
||||||
--- util-linux-2.31.1.orig/tests/expected/cramfs/fsck-bad-header-pad-64K-le 1970-01-01 01:00:00.000000000 +0100
|
|
||||||
+++ util-linux-2.31.1/tests/expected/cramfs/fsck-bad-header-pad-64K-le 2018-01-26 18:40:57.401031690 +0100
|
|
||||||
@@ -0,0 +1,29 @@
|
|
||||||
+## size: 76
|
|
||||||
+fsck.cramfs: superblock size (76) too small
|
|
||||||
+ret: 4
|
|
||||||
+
|
|
||||||
+## size: 587
|
|
||||||
+fsck.cramfs: superblock size (587) too small
|
|
||||||
+ret: 4
|
|
||||||
+
|
|
||||||
+## size: 588
|
|
||||||
+fsck.cramfs: file extends past end of filesystem
|
|
||||||
+fsck.cramfs: crc error
|
|
||||||
+ret: 4
|
|
||||||
+
|
|
||||||
+## size: 65535
|
|
||||||
+fsck.cramfs: file extends past end of filesystem
|
|
||||||
+fsck.cramfs: crc error
|
|
||||||
+ret: 4
|
|
||||||
+
|
|
||||||
+## size: 65536
|
|
||||||
+ret: 0
|
|
||||||
+
|
|
||||||
+## size: 65537
|
|
||||||
+fsck.cramfs: file length too short
|
|
||||||
+ret: 4
|
|
||||||
+
|
|
||||||
+## size: 4294967295
|
|
||||||
+fsck.cramfs: file length too short
|
|
||||||
+ret: 4
|
|
||||||
+
|
|
||||||
diff -urN util-linux-2.31.1.orig/tests/ts/cramfs/fsck-bad-header util-linux-2.31.1/tests/ts/cramfs/fsck-bad-header
|
|
||||||
--- util-linux-2.31.1.orig/tests/ts/cramfs/fsck-bad-header 2017-12-14 15:26:46.585066844 +0100
|
|
||||||
+++ util-linux-2.31.1/tests/ts/cramfs/fsck-bad-header 2018-01-26 18:40:57.401031690 +0100
|
|
||||||
@@ -16,7 +16,7 @@
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
TS_TOPDIR="${0%/*}/../.."
|
|
||||||
-TS_DESC="fsck endianness"
|
|
||||||
+TS_DESC="fsck bad header"
|
|
||||||
|
|
||||||
. $TS_TOPDIR/functions.sh
|
|
||||||
ts_init "$*"
|
|
||||||
@@ -25,14 +25,78 @@
|
|
||||||
ts_check_test_command "$TS_CMD_FSCKCRAMFS"
|
|
||||||
ts_check_prog "dd"
|
|
||||||
|
|
||||||
-IMAGE_SOURCE="$TS_OUTDIR/${TS_TESTNAME}-data/root"
|
|
||||||
+function num2binary()
|
|
||||||
+{
|
|
||||||
+ local num=$1
|
|
||||||
+ local endian=$2
|
|
||||||
+
|
|
||||||
+ test "$num" -ge 0 -a "$num" -le 4294967295 || return 1
|
|
||||||
+ test "$endian" = "be" -o "$endian" = "le" || return 1
|
|
||||||
+
|
|
||||||
+ # how to do that easier?
|
|
||||||
+ if test "$endian" = "be"; then
|
|
||||||
+ echo -en "$(printf "%08x" "$1" | sed 's/\(..\)/\\x\1/g')"
|
|
||||||
+ else
|
|
||||||
+ echo -en "$(printf "%08x" "$1" | sed 's/^\(..\)\(..\)\(..\)\(..\)$/\\x\4\\x\3\\x\2\\x\1/')"
|
|
||||||
+ fi
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+function fsck_loop_sizes()
|
|
||||||
+{
|
|
||||||
+ local endian=$1 # be, le
|
|
||||||
+ local seek=$2 # 4 for nopad, 516 for pad
|
|
||||||
+ shift 2 # the rest are sizes to loop over
|
|
||||||
+
|
|
||||||
+ for size in "$@"; do
|
|
||||||
+ ts_log "## size: $size"
|
|
||||||
+ cp -a "$IMAGE_FILE" "$IMAGE_FILE.tmp"
|
|
||||||
+ num2binary "$size" $endian |
|
|
||||||
+ dd of="$IMAGE_FILE.tmp" bs=1 seek="$seek" count=4 conv=notrunc &> /dev/null
|
|
||||||
+ $TS_CMD_FSCKCRAMFS "$IMAGE_FILE.tmp" >> $TS_OUTPUT 2>&1
|
|
||||||
+ ts_log "ret: $?
|
|
||||||
+"
|
|
||||||
+ done
|
|
||||||
+ rm -f "$IMAGE_FILE"
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+
|
|
||||||
+IMAGE_SOURCE="$TS_OUTDIR/${TS_TESTNAME}-data"
|
|
||||||
IMAGE_FILE="$TS_OUTDIR/${TS_TESTNAME}-cramfs.img"
|
|
||||||
|
|
||||||
mkdir -p "${IMAGE_SOURCE}/subdir" &> /dev/null
|
|
||||||
-$TS_CMD_MKCRAMFS -p -N big $IMAGE_SOURCE $IMAGE_FILE &> /dev/null
|
|
||||||
-echo -ne \\00\\x4c |
|
|
||||||
- dd of=$IMAGE_FILE bs=1 seek=518 count=2 conv=notrunc &> /dev/null
|
|
||||||
-$TS_CMD_FSCKCRAMFS $IMAGE_FILE >> $TS_OUTPUT 2>&1
|
|
||||||
+
|
|
||||||
+ts_init_subtest "nopad-4K-be"
|
|
||||||
+$TS_CMD_MKCRAMFS -N big -b 4096 $IMAGE_SOURCE $IMAGE_FILE &> /dev/null
|
|
||||||
+fsck_loop_sizes be 4 0 75 76 4095 4096 4097 4294967295
|
|
||||||
+rm -f "$IMAGE_FILE"
|
|
||||||
+ts_finalize_subtest
|
|
||||||
+
|
|
||||||
+ts_init_subtest "nopad-4K-le"
|
|
||||||
+$TS_CMD_MKCRAMFS -N little -b 4096 $IMAGE_SOURCE $IMAGE_FILE &> /dev/null
|
|
||||||
+fsck_loop_sizes le 4 0 75 76 4095 4096 4097 4294967295
|
|
||||||
+ts_finalize_subtest
|
|
||||||
+
|
|
||||||
+ts_init_subtest "pad-4K-be"
|
|
||||||
+$TS_CMD_MKCRAMFS -p -N big -b 4096 $IMAGE_SOURCE $IMAGE_FILE &> /dev/null
|
|
||||||
+fsck_loop_sizes be 516 76 587 588 4095 4096 4097 4294967295
|
|
||||||
+ts_finalize_subtest
|
|
||||||
+
|
|
||||||
+ts_init_subtest "pad-4K-le"
|
|
||||||
+$TS_CMD_MKCRAMFS -p -N little -b 4096 $IMAGE_SOURCE $IMAGE_FILE &> /dev/null
|
|
||||||
+fsck_loop_sizes le 516 76 587 588 4095 4096 4097 4294967295
|
|
||||||
+ts_finalize_subtest
|
|
||||||
+
|
|
||||||
+ts_init_subtest "pad-64K-be"
|
|
||||||
+$TS_CMD_MKCRAMFS -p -N big -b 65536 $IMAGE_SOURCE $IMAGE_FILE &> /dev/null
|
|
||||||
+fsck_loop_sizes be 516 76 587 588 65535 65536 65537 4294967295
|
|
||||||
+ts_finalize_subtest
|
|
||||||
+
|
|
||||||
+ts_init_subtest "pad-64K-le"
|
|
||||||
+$TS_CMD_MKCRAMFS -p -N little -b 65536 $IMAGE_SOURCE $IMAGE_FILE &> /dev/null
|
|
||||||
+fsck_loop_sizes le 516 76 587 588 65535 65536 65537 4294967295
|
|
||||||
+ts_finalize_subtest
|
|
||||||
+
|
|
||||||
+rm -rf "$IMAGE_SOURCE" "$IMAGE_FILE.tmp"
|
|
||||||
|
|
||||||
ts_finalize
|
|
||||||
|
|
@ -1,34 +0,0 @@
|
|||||||
commit 839203c00ecb6b3dffd0d3eb8c77dac87584c241
|
|
||||||
Author: Ruediger Meier <ruediger.meier@ga-group.nl>
|
|
||||||
Date: Tue Jan 23 16:59:27 2018 +0100
|
|
||||||
|
|
||||||
tests: fix fincore/count KNOWN_FAIL
|
|
||||||
|
|
||||||
It has to be set after calling ts_init.
|
|
||||||
|
|
||||||
Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
|
|
||||||
|
|
||||||
commit 88e5d289d5dcec3dfb7bc8f8fac89ce789e69d3f
|
|
||||||
Author: Karel Zak <kzak@redhat.com>
|
|
||||||
Date: Wed Jan 17 14:41:56 2018 +0100
|
|
||||||
|
|
||||||
tests: mark fincore/count as KNOWN_FAIL
|
|
||||||
|
|
||||||
The test (or our expectations about Direct-IO) seems not robust
|
|
||||||
enough. I guess this is not fincore problem.
|
|
||||||
|
|
||||||
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|
||||||
|
|
||||||
diff -urN util-linux-2.31.1.orig/tests/ts/fincore/count util-linux-2.31.1/tests/ts/fincore/count
|
|
||||||
--- util-linux-2.31.1.orig/tests/ts/fincore/count 2017-11-23 13:42:05.508423452 +0100
|
|
||||||
+++ util-linux-2.31.1/tests/ts/fincore/count 2018-01-31 20:33:12.838715727 +0100
|
|
||||||
@@ -8,6 +8,9 @@
|
|
||||||
|
|
||||||
ts_check_test_command "$TS_HELPER_SYSINFO"
|
|
||||||
|
|
||||||
+# Send patch if you know how to keep it portable and robust. Thanks.
|
|
||||||
+TS_KNOWN_FAIL="yes"
|
|
||||||
+
|
|
||||||
function header
|
|
||||||
{
|
|
||||||
echo "[" "$1" "]"
|
|
@ -1,73 +0,0 @@
|
|||||||
From 7966cbba53890e1010861b75bd9923e793bbc975 Mon Sep 17 00:00:00 2001
|
|
||||||
From: NeilBrown <neilb@suse.com>
|
|
||||||
Date: Wed, 18 Apr 2018 13:31:38 +1000
|
|
||||||
Subject: [PATCH] libmount: fix mnt_table_is_fs_mounted() for NFS bind mounts.
|
|
||||||
|
|
||||||
When you bind-mount a subdirectory of a local filesystem, the
|
|
||||||
path to that subdirectory appears as the fourth field in mountinfo.
|
|
||||||
|
|
||||||
For nfs mounts, the fourth field is always "/", and the subdirectory
|
|
||||||
part is appended to the "special" (aka "device") field. This is
|
|
||||||
consistent with historical NFS usage which always includes a path in
|
|
||||||
the fs_spec field.
|
|
||||||
|
|
||||||
libmount needs to know about this when "mount -a" checks to see if
|
|
||||||
a filesystem is already mounted.
|
|
||||||
|
|
||||||
Without this fix, fstab lines like:
|
|
||||||
|
|
||||||
server::/path /dir nfs defaults 0 0
|
|
||||||
/dir/subdir /mnt/test none bind 0 0
|
|
||||||
|
|
||||||
result in a new mount at /mnt/test every time "mount -a" is run.
|
|
||||||
|
|
||||||
[kzak@redhat.com: - use strappend() rather than asprintf()]
|
|
||||||
|
|
||||||
Signed-off-by: NeilBrown <neilb@suse.com>
|
|
||||||
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|
||||||
---
|
|
||||||
libmount/src/tab.c | 13 ++++++++++++-
|
|
||||||
1 file changed, 12 insertions(+), 1 deletion(-)
|
|
||||||
|
|
||||||
diff --git a/libmount/src/tab.c b/libmount/src/tab.c
|
|
||||||
index 968057e42..eb61dd33e 100644
|
|
||||||
--- a/libmount/src/tab.c
|
|
||||||
+++ b/libmount/src/tab.c
|
|
||||||
@@ -1542,6 +1542,7 @@ int mnt_table_is_fs_mounted(struct libmnt_table *tb, struct libmnt_fs *fstab_fs)
|
|
||||||
struct libmnt_fs *fs;
|
|
||||||
|
|
||||||
char *root = NULL;
|
|
||||||
+ char *src2 = NULL;
|
|
||||||
const char *src = NULL, *tgt = NULL;
|
|
||||||
char *xtgt = NULL;
|
|
||||||
int rc = 0;
|
|
||||||
@@ -1566,8 +1567,17 @@ int mnt_table_is_fs_mounted(struct libmnt_table *tb, struct libmnt_fs *fstab_fs)
|
|
||||||
flags = MS_BIND;
|
|
||||||
|
|
||||||
rootfs = mnt_table_get_fs_root(tb, fstab_fs, flags, &root);
|
|
||||||
- if (rootfs)
|
|
||||||
+ if (rootfs) {
|
|
||||||
+ const char *fstype = mnt_fs_get_fstype(rootfs);
|
|
||||||
+
|
|
||||||
src = mnt_fs_get_srcpath(rootfs);
|
|
||||||
+ if (fstype && strncmp(fstype, "nfs", 3) == 0 && root) {
|
|
||||||
+ /* NFS stores the root at the end of the source */
|
|
||||||
+ src = src2 = strappend(src, root);
|
|
||||||
+ free(root);
|
|
||||||
+ root = NULL;
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!src)
|
|
||||||
@@ -1667,6 +1677,7 @@ done:
|
|
||||||
free(root);
|
|
||||||
|
|
||||||
DBG(TAB, ul_debugobj(tb, "mnt_table_is_fs_mounted: %s [rc=%d]", src, rc));
|
|
||||||
+ free(src2);
|
|
||||||
return rc;
|
|
||||||
}
|
|
||||||
|
|
||||||
--
|
|
||||||
2.16.3
|
|
||||||
|
|
@ -1,34 +0,0 @@
|
|||||||
From f958101d2ea55174f8cd584efe41d4cefa9578c6 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Richard Fuchs <rfuchs@sipwise.com>
|
|
||||||
Date: Tue, 17 Apr 2018 09:40:20 -0400
|
|
||||||
Subject: [PATCH] bugfix: fix possible segfault during umount -a
|
|
||||||
|
|
||||||
mnt_context_get_mtab() doesn't set its return **tb argument on error,
|
|
||||||
and so in mnt_context_next_umount() mtab will remain uninitialized on
|
|
||||||
error, later resulting in cxt->mtab containing garbage, possibly
|
|
||||||
resulting in segfault on exit.
|
|
||||||
---
|
|
||||||
libmount/src/context_umount.c | 3 ++-
|
|
||||||
1 file changed, 2 insertions(+), 1 deletion(-)
|
|
||||||
|
|
||||||
diff --git a/libmount/src/context_umount.c b/libmount/src/context_umount.c
|
|
||||||
index 45651b58e..240ec3be6 100644
|
|
||||||
--- a/libmount/src/context_umount.c
|
|
||||||
+++ b/libmount/src/context_umount.c
|
|
||||||
@@ -1003,11 +1003,12 @@ int mnt_context_next_umount(struct libmnt_context *cxt,
|
|
||||||
rc = mnt_context_get_mtab(cxt, &mtab);
|
|
||||||
cxt->mtab = NULL; /* do not reset mtab */
|
|
||||||
mnt_reset_context(cxt);
|
|
||||||
- cxt->mtab = mtab;
|
|
||||||
|
|
||||||
if (rc)
|
|
||||||
return rc;
|
|
||||||
|
|
||||||
+ cxt->mtab = mtab;
|
|
||||||
+
|
|
||||||
do {
|
|
||||||
rc = mnt_table_next_fs(mtab, itr, fs);
|
|
||||||
if (rc != 0)
|
|
||||||
--
|
|
||||||
2.16.3
|
|
||||||
|
|
@ -1,110 +0,0 @@
|
|||||||
From 538b50cb0a4aac56b6b3b6e4d1e8ce886854c6d8 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Stanislav Brabec <sbrabec@suse.cz>
|
|
||||||
Date: Wed, 9 May 2018 18:08:32 +0200
|
|
||||||
Subject: [PATCH] lscpu, chcpu: Avoid use of the old CPU macros
|
|
||||||
|
|
||||||
The old CPU macros are limited to 1024 cores. As a result, lscpu cannot
|
|
||||||
count sockets on large systems. Use new scalable macros.
|
|
||||||
|
|
||||||
Signed-off-by: Stanislav Brabec <sbrabec@suse.cz>
|
|
||||||
Cc: Michael Matz <matz@suse.de>
|
|
||||||
---
|
|
||||||
sys-utils/chcpu.c | 6 +++---
|
|
||||||
sys-utils/lscpu.c | 13 +++++++++----
|
|
||||||
2 files changed, 12 insertions(+), 7 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/sys-utils/chcpu.c b/sys-utils/chcpu.c
|
|
||||||
index 12e52d887..f32b7a6fc 100644
|
|
||||||
--- a/sys-utils/chcpu.c
|
|
||||||
+++ b/sys-utils/chcpu.c
|
|
||||||
@@ -81,7 +81,7 @@ static int cpu_enable(cpu_set_t *cpu_set, size_t setsize, int enable)
|
|
||||||
size_t fails = 0;
|
|
||||||
|
|
||||||
for (cpu = 0; cpu < setsize; cpu++) {
|
|
||||||
- if (!CPU_ISSET(cpu, cpu_set))
|
|
||||||
+ if (!CPU_ISSET_S(cpu, setsize, cpu_set))
|
|
||||||
continue;
|
|
||||||
if (!path_exist(_PATH_SYS_CPU "/cpu%d", cpu)) {
|
|
||||||
warnx(_("CPU %u does not exist"), cpu);
|
|
||||||
@@ -127,7 +127,7 @@ static int cpu_enable(cpu_set_t *cpu_set, size_t setsize, int enable)
|
|
||||||
} else {
|
|
||||||
printf(_("CPU %u disabled\n"), cpu);
|
|
||||||
if (onlinecpus)
|
|
||||||
- CPU_CLR(cpu, onlinecpus);
|
|
||||||
+ CPU_CLR_S(cpu, setsize, onlinecpus);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -173,7 +173,7 @@ static int cpu_configure(cpu_set_t *cpu_set, size_t setsize, int configure)
|
|
||||||
size_t fails = 0;
|
|
||||||
|
|
||||||
for (cpu = 0; cpu < setsize; cpu++) {
|
|
||||||
- if (!CPU_ISSET(cpu, cpu_set))
|
|
||||||
+ if (!CPU_ISSET_S(cpu, setsize, cpu_set))
|
|
||||||
continue;
|
|
||||||
if (!path_exist(_PATH_SYS_CPU "/cpu%d", cpu)) {
|
|
||||||
warnx(_("CPU %u does not exist"), cpu);
|
|
||||||
diff --git a/sys-utils/lscpu.c b/sys-utils/lscpu.c
|
|
||||||
index 2132511a5..fd6d63bbf 100644
|
|
||||||
--- a/sys-utils/lscpu.c
|
|
||||||
+++ b/sys-utils/lscpu.c
|
|
||||||
@@ -478,7 +478,7 @@ read_basicinfo(struct lscpu_desc *desc, struct lscpu_modifier *mod)
|
|
||||||
desc->idx2cpunum = xcalloc(desc->ncpuspos, sizeof(int));
|
|
||||||
|
|
||||||
for (num = 0, idx = 0; num < maxcpus; num++) {
|
|
||||||
- if (CPU_ISSET(num, tmp))
|
|
||||||
+ if (CPU_ISSET_S(num, setsize, tmp))
|
|
||||||
desc->idx2cpunum[idx++] = num;
|
|
||||||
}
|
|
||||||
cpuset_free(tmp);
|
|
||||||
@@ -1109,10 +1109,11 @@ cpu_max_mhz(struct lscpu_desc *desc, char *buf, size_t bufsz)
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
float cpu_freq = 0.0;
|
|
||||||
+ size_t setsize = CPU_ALLOC_SIZE(maxcpus);
|
|
||||||
|
|
||||||
if (desc->present) {
|
|
||||||
for (i = 0; i < desc->ncpuspos; i++) {
|
|
||||||
- if (CPU_ISSET(real_cpu_num(desc, i), desc->present)
|
|
||||||
+ if (CPU_ISSET_S(real_cpu_num(desc, i), setsize, desc->present)
|
|
||||||
&& desc->maxmhz[i]) {
|
|
||||||
float freq = atof(desc->maxmhz[i]);
|
|
||||||
|
|
||||||
@@ -1131,10 +1132,11 @@ cpu_min_mhz(struct lscpu_desc *desc, char *buf, size_t bufsz)
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
float cpu_freq = -1.0;
|
|
||||||
+ size_t setsize = CPU_ALLOC_SIZE(maxcpus);
|
|
||||||
|
|
||||||
if (desc->present) {
|
|
||||||
for (i = 0; i < desc->ncpuspos; i++) {
|
|
||||||
- if (CPU_ISSET(real_cpu_num(desc, i), desc->present)
|
|
||||||
+ if (CPU_ISSET_S(real_cpu_num(desc, i), setsize, desc->present)
|
|
||||||
&& desc->minmhz[i]) {
|
|
||||||
float freq = atof(desc->minmhz[i]);
|
|
||||||
|
|
||||||
@@ -1931,6 +1933,7 @@ int main(int argc, char *argv[])
|
|
||||||
int c, i;
|
|
||||||
int columns[ARRAY_SIZE(coldescs)], ncolumns = 0;
|
|
||||||
int cpu_modifier_specified = 0;
|
|
||||||
+ size_t setsize;
|
|
||||||
|
|
||||||
static const struct option longopts[] = {
|
|
||||||
{ "all", no_argument, NULL, 'a' },
|
|
||||||
@@ -2034,10 +2037,12 @@ int main(int argc, char *argv[])
|
|
||||||
|
|
||||||
read_basicinfo(desc, mod);
|
|
||||||
|
|
||||||
+ setsize = CPU_ALLOC_SIZE(maxcpus);
|
|
||||||
+
|
|
||||||
for (i = 0; i < desc->ncpuspos; i++) {
|
|
||||||
/* only consider present CPUs */
|
|
||||||
if (desc->present &&
|
|
||||||
- !CPU_ISSET(real_cpu_num(desc, i), desc->present))
|
|
||||||
+ !CPU_ISSET_S(real_cpu_num(desc, i), setsize, desc->present))
|
|
||||||
continue;
|
|
||||||
read_topology(desc, i);
|
|
||||||
read_cache(desc, i);
|
|
||||||
--
|
|
||||||
2.16.3
|
|
||||||
|
|
@ -1,55 +0,0 @@
|
|||||||
From 95f09bc63c564c50ec2c393352801cc056faaea2 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Dirk Mueller <dmueller@suse.com>
|
|
||||||
Date: Sat, 17 Mar 2018 13:18:38 +0100
|
|
||||||
Subject: [PATCH] Avoid crash in min/max caculation when cpu#0 being offline
|
|
||||||
|
|
||||||
When cpu#0 is offline, atof(NULL) is called which causes
|
|
||||||
a segfault or endless loop depending on implementation
|
|
||||||
circumstances. So instead of implicitely assumping that the
|
|
||||||
first cpu is always available, do the presence checks for
|
|
||||||
all including the first one.
|
|
||||||
---
|
|
||||||
sys-utils/lscpu.c | 12 ++++++------
|
|
||||||
1 file changed, 6 insertions(+), 6 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/sys-utils/lscpu.c b/sys-utils/lscpu.c
|
|
||||||
index 6d1fde555..2132511a5 100644
|
|
||||||
--- a/sys-utils/lscpu.c
|
|
||||||
+++ b/sys-utils/lscpu.c
|
|
||||||
@@ -1108,10 +1108,10 @@ static char *
|
|
||||||
cpu_max_mhz(struct lscpu_desc *desc, char *buf, size_t bufsz)
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
- float cpu_freq = atof(desc->maxmhz[0]);
|
|
||||||
+ float cpu_freq = 0.0;
|
|
||||||
|
|
||||||
if (desc->present) {
|
|
||||||
- for (i = 1; i < desc->ncpuspos; i++) {
|
|
||||||
+ for (i = 0; i < desc->ncpuspos; i++) {
|
|
||||||
if (CPU_ISSET(real_cpu_num(desc, i), desc->present)
|
|
||||||
&& desc->maxmhz[i]) {
|
|
||||||
float freq = atof(desc->maxmhz[i]);
|
|
||||||
@@ -1129,16 +1129,16 @@ cpu_max_mhz(struct lscpu_desc *desc, char *buf, size_t bufsz)
|
|
||||||
static char *
|
|
||||||
cpu_min_mhz(struct lscpu_desc *desc, char *buf, size_t bufsz)
|
|
||||||
{
|
|
||||||
- int i;
|
|
||||||
- float cpu_freq = atof(desc->minmhz[0]);
|
|
||||||
+ int i;
|
|
||||||
+ float cpu_freq = -1.0;
|
|
||||||
|
|
||||||
if (desc->present) {
|
|
||||||
- for (i = 1; i < desc->ncpuspos; i++) {
|
|
||||||
+ for (i = 0; i < desc->ncpuspos; i++) {
|
|
||||||
if (CPU_ISSET(real_cpu_num(desc, i), desc->present)
|
|
||||||
&& desc->minmhz[i]) {
|
|
||||||
float freq = atof(desc->minmhz[i]);
|
|
||||||
|
|
||||||
- if (freq < cpu_freq)
|
|
||||||
+ if (cpu_freq < 0.0 || freq < cpu_freq)
|
|
||||||
cpu_freq = freq;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
--
|
|
||||||
2.16.3
|
|
||||||
|
|
@ -1,536 +0,0 @@
|
|||||||
From 60a7e9e94e49215b1e6ac6e33b69c3bd0a426b5e Mon Sep 17 00:00:00 2001
|
|
||||||
From: Gerald Schaefer <gerald.schaefer@de.ibm.com>
|
|
||||||
Date: Wed, 27 Sep 2017 19:44:44 +0200
|
|
||||||
Subject: [PATCH 1/3] lsmem/chmem: add memory zone awareness
|
|
||||||
|
|
||||||
With this patch, valid memory zones can be shown with lsmem, and chmem can
|
|
||||||
set memory online/offline in a specific memory zone, if allowed by the
|
|
||||||
kernel. The valid memory zones are read from the "valid_zones" sysfs
|
|
||||||
attribute, and setting memory online to a specific zone is done by
|
|
||||||
echoing "online_kernel" or "online_movable" to the "state" sysfs
|
|
||||||
attribute, in addition to the previous "online".
|
|
||||||
|
|
||||||
This patch also changes the default behavior of chmem, when setting memory
|
|
||||||
online without specifying a memory zone. If valid, memory will be set
|
|
||||||
online to the zone Movable. This zone is preferable for memory hotplug, as
|
|
||||||
it makes memory offline much more likely to succeed.
|
|
||||||
|
|
||||||
Signed-off-by: Gerald Schaefer <gerald.schaefer@de.ibm.com>
|
|
||||||
---
|
|
||||||
sys-utils/chmem.8 | 19 ++++++++
|
|
||||||
sys-utils/chmem.c | 136 ++++++++++++++++++++++++++++++++++++++++++++++++++----
|
|
||||||
sys-utils/lsmem.1 | 4 +-
|
|
||||||
sys-utils/lsmem.c | 98 ++++++++++++++++++++++++++++++++++++++-
|
|
||||||
4 files changed, 246 insertions(+), 11 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/sys-utils/chmem.8 b/sys-utils/chmem.8
|
|
||||||
index a116bc9e7..dae7413d4 100644
|
|
||||||
--- a/sys-utils/chmem.8
|
|
||||||
+++ b/sys-utils/chmem.8
|
|
||||||
@@ -5,6 +5,7 @@ chmem \- configure memory
|
|
||||||
.B chmem
|
|
||||||
.RB [ \-h "] [" \-V "] [" \-v "] [" \-e | \-d "]"
|
|
||||||
[\fISIZE\fP|\fIRANGE\fP|\fB\-b\fP \fIBLOCKRANGE\fP]
|
|
||||||
+[-z ZONE]
|
|
||||||
.SH DESCRIPTION
|
|
||||||
The chmem command sets a particular size or range of memory online or offline.
|
|
||||||
.
|
|
||||||
@@ -25,6 +26,19 @@ and <last> is the number of the last memory block in the memory
|
|
||||||
range. Alternatively a single block can be specified. \fIBLOCKRANGE\fP requires
|
|
||||||
the \fB--blocks\fP option.
|
|
||||||
.
|
|
||||||
+.IP "\(hy" 2
|
|
||||||
+Specify \fIZONE\fP as the name of a memory zone, as shown in the output of the
|
|
||||||
+\fBlsmem -o +ZONES\fP command. The output shows one or more valid memory zones
|
|
||||||
+for each memory range. If multiple zones are shown, then the memory range
|
|
||||||
+currently belongs to the first zone. By default, chmem will set memory online
|
|
||||||
+to the zone Movable, if this is among the valid zones. This default can be
|
|
||||||
+changed by specifying the \fB--zone\fP option with another valid zone.
|
|
||||||
+For memory ballooning, it is recommended to select the zone Movable for memory
|
|
||||||
+online and offline, if possible. Memory in this zone is much more likely to be
|
|
||||||
+able to be offlined again, but it cannot be used for arbitrary kernel
|
|
||||||
+allocations, only for migratable pages (e.g. anonymous and page cache pages).
|
|
||||||
+Use the \fB\-\-help\fR option to see all available zones.
|
|
||||||
+.
|
|
||||||
.PP
|
|
||||||
\fISIZE\fP and \fIRANGE\fP must be aligned to the Linux memory block size, as
|
|
||||||
shown in the output of the \fBlsmem\fP command.
|
|
||||||
@@ -51,6 +65,11 @@ Set the specified \fIRANGE\fP, \fISIZE\fP, or \fIBLOCKRANGE\fP of memory offline
|
|
||||||
.BR \-e ", " \-\-enable
|
|
||||||
Set the specified \fIRANGE\fP, \fISIZE\fP, or \fIBLOCKRANGE\fP of memory online.
|
|
||||||
.TP
|
|
||||||
+.BR \-z ", " \-\-zone
|
|
||||||
+Select the memory \fIZONE\fP where to set the specified \fIRANGE\fP, \fISIZE\fP,
|
|
||||||
+or \fIBLOCKRANGE\fP of memory online or offline. By default, memory will be set
|
|
||||||
+online to the zone Movable, if possible.
|
|
||||||
+.TP
|
|
||||||
.BR \-h ", " \-\-help
|
|
||||||
Print a short help text, then exit.
|
|
||||||
.TP
|
|
||||||
diff --git a/sys-utils/chmem.c b/sys-utils/chmem.c
|
|
||||||
index d9bc95cc1..2f0680de8 100644
|
|
||||||
--- a/sys-utils/chmem.c
|
|
||||||
+++ b/sys-utils/chmem.c
|
|
||||||
@@ -49,6 +49,7 @@ struct chmem_desc {
|
|
||||||
unsigned int use_blocks : 1;
|
|
||||||
unsigned int is_size : 1;
|
|
||||||
unsigned int verbose : 1;
|
|
||||||
+ unsigned int have_zones : 1;
|
|
||||||
};
|
|
||||||
|
|
||||||
enum {
|
|
||||||
@@ -57,6 +58,38 @@ enum {
|
|
||||||
CMD_NONE
|
|
||||||
};
|
|
||||||
|
|
||||||
+enum zone_id {
|
|
||||||
+ ZONE_DMA = 0,
|
|
||||||
+ ZONE_DMA32,
|
|
||||||
+ ZONE_NORMAL,
|
|
||||||
+ ZONE_HIGHMEM,
|
|
||||||
+ ZONE_MOVABLE,
|
|
||||||
+ ZONE_DEVICE,
|
|
||||||
+};
|
|
||||||
+
|
|
||||||
+static char *zone_names[] = {
|
|
||||||
+ [ZONE_DMA] = "DMA",
|
|
||||||
+ [ZONE_DMA32] = "DMA32",
|
|
||||||
+ [ZONE_NORMAL] = "Normal",
|
|
||||||
+ [ZONE_HIGHMEM] = "Highmem",
|
|
||||||
+ [ZONE_MOVABLE] = "Movable",
|
|
||||||
+ [ZONE_DEVICE] = "Device",
|
|
||||||
+};
|
|
||||||
+
|
|
||||||
+/*
|
|
||||||
+ * name must be null-terminated
|
|
||||||
+ */
|
|
||||||
+static int zone_name_to_id(const char *name)
|
|
||||||
+{
|
|
||||||
+ size_t i;
|
|
||||||
+
|
|
||||||
+ for (i = 0; i < ARRAY_SIZE(zone_names); i++) {
|
|
||||||
+ if (!strcasecmp(name, zone_names[i]))
|
|
||||||
+ return i;
|
|
||||||
+ }
|
|
||||||
+ return -1;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
static void idxtostr(struct chmem_desc *desc, uint64_t idx, char *buf, size_t bufsz)
|
|
||||||
{
|
|
||||||
uint64_t start, end;
|
|
||||||
@@ -68,22 +101,49 @@ static void idxtostr(struct chmem_desc *desc, uint64_t idx, char *buf, size_t bu
|
|
||||||
idx, start, end);
|
|
||||||
}
|
|
||||||
|
|
||||||
-static int chmem_size(struct chmem_desc *desc, int enable)
|
|
||||||
+static int chmem_size(struct chmem_desc *desc, int enable, int zone_id)
|
|
||||||
{
|
|
||||||
char *name, *onoff, line[BUFSIZ], str[BUFSIZ];
|
|
||||||
uint64_t size, index;
|
|
||||||
+ const char *zn;
|
|
||||||
int i, rc;
|
|
||||||
|
|
||||||
size = desc->size;
|
|
||||||
onoff = enable ? "online" : "offline";
|
|
||||||
i = enable ? 0 : desc->ndirs - 1;
|
|
||||||
|
|
||||||
+ if (enable && zone_id >= 0) {
|
|
||||||
+ if (zone_id == ZONE_MOVABLE)
|
|
||||||
+ onoff = "online_movable";
|
|
||||||
+ else
|
|
||||||
+ onoff = "online_kernel";
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
for (; i >= 0 && i < desc->ndirs && size; i += enable ? 1 : -1) {
|
|
||||||
name = desc->dirs[i]->d_name;
|
|
||||||
index = strtou64_or_err(name + 6, _("Failed to parse index"));
|
|
||||||
path_read_str(line, sizeof(line), _PATH_SYS_MEMORY "/%s/state", name);
|
|
||||||
- if (strcmp(onoff, line) == 0)
|
|
||||||
+ if (strncmp(onoff, line, 6) == 0)
|
|
||||||
continue;
|
|
||||||
+
|
|
||||||
+ if (desc->have_zones) {
|
|
||||||
+ path_read_str(line, sizeof(line),
|
|
||||||
+ _PATH_SYS_MEMORY "/%s/valid_zones", name);
|
|
||||||
+ if (zone_id >= 0) {
|
|
||||||
+ zn = zone_names[zone_id];
|
|
||||||
+ if (enable && !strcasestr(line, zn))
|
|
||||||
+ continue;
|
|
||||||
+ if (!enable && strncasecmp(line, zn, strlen(zn)))
|
|
||||||
+ continue;
|
|
||||||
+ } else if (enable) {
|
|
||||||
+ /* By default, use zone Movable for online, if valid */
|
|
||||||
+ if (strcasestr(line, zone_names[ZONE_MOVABLE]))
|
|
||||||
+ onoff = "online_movable";
|
|
||||||
+ else
|
|
||||||
+ onoff = "online";
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
idxtostr(desc, index, str, sizeof(str));
|
|
||||||
rc = path_write_str(onoff, _PATH_SYS_MEMORY"/%s/state", name);
|
|
||||||
if (rc == -1 && desc->verbose) {
|
|
||||||
@@ -115,15 +175,23 @@ static int chmem_size(struct chmem_desc *desc, int enable)
|
|
||||||
return size == 0 ? 0 : size == desc->size ? -1 : 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
-static int chmem_range(struct chmem_desc *desc, int enable)
|
|
||||||
+static int chmem_range(struct chmem_desc *desc, int enable, int zone_id)
|
|
||||||
{
|
|
||||||
char *name, *onoff, line[BUFSIZ], str[BUFSIZ];
|
|
||||||
uint64_t index, todo;
|
|
||||||
+ const char *zn;
|
|
||||||
int i, rc;
|
|
||||||
|
|
||||||
todo = desc->end - desc->start + 1;
|
|
||||||
onoff = enable ? "online" : "offline";
|
|
||||||
|
|
||||||
+ if (enable && zone_id >= 0) {
|
|
||||||
+ if (zone_id == ZONE_MOVABLE)
|
|
||||||
+ onoff = "online_movable";
|
|
||||||
+ else
|
|
||||||
+ onoff = "online_kernel";
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
for (i = 0; i < desc->ndirs; i++) {
|
|
||||||
name = desc->dirs[i]->d_name;
|
|
||||||
index = strtou64_or_err(name + 6, _("Failed to parse index"));
|
|
||||||
@@ -133,7 +201,7 @@ static int chmem_range(struct chmem_desc *desc, int enable)
|
|
||||||
break;
|
|
||||||
idxtostr(desc, index, str, sizeof(str));
|
|
||||||
path_read_str(line, sizeof(line), _PATH_SYS_MEMORY "/%s/state", name);
|
|
||||||
- if (strcmp(onoff, line) == 0) {
|
|
||||||
+ if (strncmp(onoff, line, 6) == 0) {
|
|
||||||
if (desc->verbose && enable)
|
|
||||||
fprintf(stdout, _("%s already enabled\n"), str);
|
|
||||||
else if (desc->verbose && !enable)
|
|
||||||
@@ -141,6 +209,29 @@ static int chmem_range(struct chmem_desc *desc, int enable)
|
|
||||||
todo--;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
+
|
|
||||||
+ if (desc->have_zones) {
|
|
||||||
+ path_read_str(line, sizeof(line),
|
|
||||||
+ _PATH_SYS_MEMORY "/%s/valid_zones", name);
|
|
||||||
+ if (zone_id >= 0) {
|
|
||||||
+ zn = zone_names[zone_id];
|
|
||||||
+ if (enable && !strcasestr(line, zn)) {
|
|
||||||
+ warnx(_("%s enable failed: Zone mismatch"), str);
|
|
||||||
+ continue;
|
|
||||||
+ }
|
|
||||||
+ if (!enable && strncasecmp(line, zn, strlen(zn))) {
|
|
||||||
+ warnx(_("%s disable failed: Zone mismatch"), str);
|
|
||||||
+ continue;
|
|
||||||
+ }
|
|
||||||
+ } else if (enable) {
|
|
||||||
+ /* By default, use zone Movable for online, if valid */
|
|
||||||
+ if (strcasestr(line, zone_names[ZONE_MOVABLE]))
|
|
||||||
+ onoff = "online_movable";
|
|
||||||
+ else
|
|
||||||
+ onoff = "online";
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
rc = path_write_str(onoff, _PATH_SYS_MEMORY"/%s/state", name);
|
|
||||||
if (rc == -1) {
|
|
||||||
if (enable)
|
|
||||||
@@ -237,6 +328,8 @@ static void parse_parameter(struct chmem_desc *desc, char *param)
|
|
||||||
static void __attribute__((__noreturn__)) usage(void)
|
|
||||||
{
|
|
||||||
FILE *out = stdout;
|
|
||||||
+ unsigned int i;
|
|
||||||
+
|
|
||||||
fputs(USAGE_HEADER, out);
|
|
||||||
fprintf(out, _(" %s [options] [SIZE|RANGE|BLOCKRANGE]\n"), program_invocation_short_name);
|
|
||||||
|
|
||||||
@@ -247,6 +340,14 @@ static void __attribute__((__noreturn__)) usage(void)
|
|
||||||
fputs(_(" -e, --enable enable memory\n"), out);
|
|
||||||
fputs(_(" -d, --disable disable memory\n"), out);
|
|
||||||
fputs(_(" -b, --blocks use memory blocks\n"), out);
|
|
||||||
+ fputs(_(" -z, --zone select memory zone ("), out);
|
|
||||||
+ for (i = 0; i < ARRAY_SIZE(zone_names); i++) {
|
|
||||||
+ fputs(zone_names[i], out);
|
|
||||||
+ if (i < ARRAY_SIZE(zone_names) - 1)
|
|
||||||
+ fputc('|', out);
|
|
||||||
+ }
|
|
||||||
+ fputs(")\n", out);
|
|
||||||
+
|
|
||||||
fputs(_(" -v, --verbose verbose output\n"), out);
|
|
||||||
fputs(USAGE_SEPARATOR, out);
|
|
||||||
printf(USAGE_HELP_OPTIONS(16));
|
|
||||||
@@ -259,7 +360,8 @@ static void __attribute__((__noreturn__)) usage(void)
|
|
||||||
int main(int argc, char **argv)
|
|
||||||
{
|
|
||||||
struct chmem_desc _desc = { }, *desc = &_desc;
|
|
||||||
- int cmd = CMD_NONE;
|
|
||||||
+ int cmd = CMD_NONE, zone_id = -1;
|
|
||||||
+ char *zone = NULL;
|
|
||||||
int c, rc;
|
|
||||||
|
|
||||||
static const struct option longopts[] = {
|
|
||||||
@@ -269,6 +371,7 @@ int main(int argc, char **argv)
|
|
||||||
{"help", no_argument, NULL, 'h'},
|
|
||||||
{"verbose", no_argument, NULL, 'v'},
|
|
||||||
{"version", no_argument, NULL, 'V'},
|
|
||||||
+ {"zone", required_argument, NULL, 'z'},
|
|
||||||
{NULL, 0, NULL, 0}
|
|
||||||
};
|
|
||||||
|
|
||||||
@@ -285,7 +388,7 @@ int main(int argc, char **argv)
|
|
||||||
|
|
||||||
read_info(desc);
|
|
||||||
|
|
||||||
- while ((c = getopt_long(argc, argv, "bdehvV", longopts, NULL)) != -1) {
|
|
||||||
+ while ((c = getopt_long(argc, argv, "bdehvVz:", longopts, NULL)) != -1) {
|
|
||||||
|
|
||||||
err_exclusive_options(c, longopts, excl, excl_st);
|
|
||||||
|
|
||||||
@@ -308,6 +411,9 @@ int main(int argc, char **argv)
|
|
||||||
case 'V':
|
|
||||||
printf(UTIL_LINUX_VERSION);
|
|
||||||
return EXIT_SUCCESS;
|
|
||||||
+ case 'z':
|
|
||||||
+ zone = xstrdup(optarg);
|
|
||||||
+ break;
|
|
||||||
default:
|
|
||||||
errtryhelp(EXIT_FAILURE);
|
|
||||||
}
|
|
||||||
@@ -320,10 +426,24 @@ int main(int argc, char **argv)
|
|
||||||
|
|
||||||
parse_parameter(desc, argv[optind]);
|
|
||||||
|
|
||||||
+ /* The valid_zones sysfs attribute was introduced with kernel 3.18 */
|
|
||||||
+ if (path_exist(_PATH_SYS_MEMORY "/memory0/valid_zones"))
|
|
||||||
+ desc->have_zones = 1;
|
|
||||||
+ else if (zone)
|
|
||||||
+ warnx(_("zone ignored, no valid_zones sysfs attribute present"));
|
|
||||||
+
|
|
||||||
+ if (zone && desc->have_zones) {
|
|
||||||
+ zone_id = zone_name_to_id(zone);
|
|
||||||
+ if (zone_id == -1) {
|
|
||||||
+ warnx(_("unknown memory zone: %s"), zone);
|
|
||||||
+ errtryhelp(EXIT_FAILURE);
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
if (desc->is_size)
|
|
||||||
- rc = chmem_size(desc, cmd == CMD_MEMORY_ENABLE ? 1 : 0);
|
|
||||||
+ rc = chmem_size(desc, cmd == CMD_MEMORY_ENABLE ? 1 : 0, zone_id);
|
|
||||||
else
|
|
||||||
- rc = chmem_range(desc, cmd == CMD_MEMORY_ENABLE ? 1 : 0);
|
|
||||||
+ rc = chmem_range(desc, cmd == CMD_MEMORY_ENABLE ? 1 : 0, zone_id);
|
|
||||||
|
|
||||||
return rc == 0 ? EXIT_SUCCESS :
|
|
||||||
rc < 0 ? EXIT_FAILURE : CHMEM_EXIT_SOMEOK;
|
|
||||||
diff --git a/sys-utils/lsmem.1 b/sys-utils/lsmem.1
|
|
||||||
index be2862d94..e7df50a4e 100644
|
|
||||||
--- a/sys-utils/lsmem.1
|
|
||||||
+++ b/sys-utils/lsmem.1
|
|
||||||
@@ -41,12 +41,12 @@ Do not print a header line.
|
|
||||||
.BR \-o , " \-\-output " \fIlist\fP
|
|
||||||
Specify which output columns to print. Use \fB\-\-help\fR
|
|
||||||
to get a list of all supported columns.
|
|
||||||
+The default list of columns may be extended if \fIlist\fP is
|
|
||||||
+specified in the format \fB+\fIlist\fP (e.g. \fBlsmem \-o +NODE\fP).
|
|
||||||
.TP
|
|
||||||
.BR \-P , " \-\-pairs"
|
|
||||||
Produce output in the form of key="value" pairs.
|
|
||||||
All potentially unsafe characters are hex-escaped (\\x<code>).
|
|
||||||
-The default list of columns may be extended if \fIlist\fP is
|
|
||||||
-specified in the format \fB+\fIlist\fP (e.g. \fBlsmem \-o +NODE\fP).
|
|
||||||
.TP
|
|
||||||
.BR \-r , " \-\-raw"
|
|
||||||
Produce output in raw format. All potentially unsafe characters are hex-escaped
|
|
||||||
diff --git a/sys-utils/lsmem.c b/sys-utils/lsmem.c
|
|
||||||
index aeffd29dd..1d26579fd 100644
|
|
||||||
--- a/sys-utils/lsmem.c
|
|
||||||
+++ b/sys-utils/lsmem.c
|
|
||||||
@@ -42,11 +42,25 @@
|
|
||||||
#define MEMORY_STATE_GOING_OFFLINE 2
|
|
||||||
#define MEMORY_STATE_UNKNOWN 3
|
|
||||||
|
|
||||||
+enum zone_id {
|
|
||||||
+ ZONE_DMA = 0,
|
|
||||||
+ ZONE_DMA32,
|
|
||||||
+ ZONE_NORMAL,
|
|
||||||
+ ZONE_HIGHMEM,
|
|
||||||
+ ZONE_MOVABLE,
|
|
||||||
+ ZONE_DEVICE,
|
|
||||||
+ ZONE_NONE,
|
|
||||||
+ ZONE_UNKNOWN,
|
|
||||||
+ MAX_NR_ZONES,
|
|
||||||
+};
|
|
||||||
+
|
|
||||||
struct memory_block {
|
|
||||||
uint64_t index;
|
|
||||||
uint64_t count;
|
|
||||||
int state;
|
|
||||||
int node;
|
|
||||||
+ int nr_zones;
|
|
||||||
+ int zones[MAX_NR_ZONES];
|
|
||||||
unsigned int removable:1;
|
|
||||||
};
|
|
||||||
|
|
||||||
@@ -72,7 +86,9 @@ struct lsmem {
|
|
||||||
want_state : 1,
|
|
||||||
want_removable : 1,
|
|
||||||
want_summary : 1,
|
|
||||||
- want_table : 1;
|
|
||||||
+ want_table : 1,
|
|
||||||
+ want_zones : 1,
|
|
||||||
+ have_zones : 1;
|
|
||||||
};
|
|
||||||
|
|
||||||
enum {
|
|
||||||
@@ -82,6 +98,18 @@ enum {
|
|
||||||
COL_REMOVABLE,
|
|
||||||
COL_BLOCK,
|
|
||||||
COL_NODE,
|
|
||||||
+ COL_ZONES,
|
|
||||||
+};
|
|
||||||
+
|
|
||||||
+static char *zone_names[] = {
|
|
||||||
+ [ZONE_DMA] = "DMA",
|
|
||||||
+ [ZONE_DMA32] = "DMA32",
|
|
||||||
+ [ZONE_NORMAL] = "Normal",
|
|
||||||
+ [ZONE_HIGHMEM] = "Highmem",
|
|
||||||
+ [ZONE_MOVABLE] = "Movable",
|
|
||||||
+ [ZONE_DEVICE] = "Device",
|
|
||||||
+ [ZONE_NONE] = "None", /* block contains more than one zone, can't be offlined */
|
|
||||||
+ [ZONE_UNKNOWN] = "Unknown",
|
|
||||||
};
|
|
||||||
|
|
||||||
/* column names */
|
|
||||||
@@ -102,6 +130,7 @@ static struct coldesc coldescs[] = {
|
|
||||||
[COL_REMOVABLE] = { "REMOVABLE", 0, SCOLS_FL_RIGHT, N_("memory is removable")},
|
|
||||||
[COL_BLOCK] = { "BLOCK", 0, SCOLS_FL_RIGHT, N_("memory block number or blocks range")},
|
|
||||||
[COL_NODE] = { "NODE", 0, SCOLS_FL_RIGHT, N_("numa node of memory")},
|
|
||||||
+ [COL_ZONES] = { "ZONES", 0, SCOLS_FL_RIGHT, N_("valid zones for the memory range")},
|
|
||||||
};
|
|
||||||
|
|
||||||
/* columns[] array specifies all currently wanted output column. The columns
|
|
||||||
@@ -120,6 +149,20 @@ static inline size_t err_columns_index(size_t arysz, size_t idx)
|
|
||||||
return idx;
|
|
||||||
}
|
|
||||||
|
|
||||||
+/*
|
|
||||||
+ * name must be null-terminated
|
|
||||||
+ */
|
|
||||||
+static int zone_name_to_id(const char *name)
|
|
||||||
+{
|
|
||||||
+ size_t i;
|
|
||||||
+
|
|
||||||
+ for (i = 0; i < ARRAY_SIZE(zone_names); i++) {
|
|
||||||
+ if (!strcasecmp(name, zone_names[i]))
|
|
||||||
+ return i;
|
|
||||||
+ }
|
|
||||||
+ return ZONE_UNKNOWN;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
#define add_column(ary, n, id) \
|
|
||||||
((ary)[ err_columns_index(ARRAY_SIZE(ary), (n)) ] = (id))
|
|
||||||
|
|
||||||
@@ -214,6 +257,25 @@ static void add_scols_line(struct lsmem *lsmem, struct memory_block *blk)
|
|
||||||
else
|
|
||||||
str = xstrdup("-");
|
|
||||||
break;
|
|
||||||
+ case COL_ZONES:
|
|
||||||
+ if (lsmem->have_zones) {
|
|
||||||
+ char valid_zones[BUFSIZ];
|
|
||||||
+ int j, zone_id;
|
|
||||||
+
|
|
||||||
+ valid_zones[0] = '\0';
|
|
||||||
+ for (j = 0; j < blk->nr_zones; j++) {
|
|
||||||
+ zone_id = blk->zones[j];
|
|
||||||
+ if (strlen(valid_zones) +
|
|
||||||
+ strlen(zone_names[zone_id]) > BUFSIZ - 2)
|
|
||||||
+ break;
|
|
||||||
+ strcat(valid_zones, zone_names[zone_id]);
|
|
||||||
+ if (j + 1 < blk->nr_zones)
|
|
||||||
+ strcat(valid_zones, "/");
|
|
||||||
+ }
|
|
||||||
+ str = xstrdup(valid_zones);
|
|
||||||
+ } else
|
|
||||||
+ str = xstrdup("-");
|
|
||||||
+ break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (str && scols_line_refer_data(line, i, str) != 0)
|
|
||||||
@@ -272,7 +334,9 @@ static int memory_block_get_node(char *name)
|
|
||||||
static void memory_block_read_attrs(struct lsmem *lsmem, char *name,
|
|
||||||
struct memory_block *blk)
|
|
||||||
{
|
|
||||||
+ char *token = NULL;
|
|
||||||
char line[BUFSIZ];
|
|
||||||
+ int i;
|
|
||||||
|
|
||||||
blk->count = 1;
|
|
||||||
blk->index = strtoumax(name + 6, NULL, 10); /* get <num> of "memory<num>" */
|
|
||||||
@@ -287,11 +351,26 @@ static void memory_block_read_attrs(struct lsmem *lsmem, char *name,
|
|
||||||
blk->state = MEMORY_STATE_GOING_OFFLINE;
|
|
||||||
if (lsmem->have_nodes)
|
|
||||||
blk->node = memory_block_get_node(name);
|
|
||||||
+
|
|
||||||
+ blk->nr_zones = 0;
|
|
||||||
+ if (lsmem->have_zones) {
|
|
||||||
+ path_read_str(line, sizeof(line), _PATH_SYS_MEMORY"/%s/%s", name,
|
|
||||||
+ "valid_zones");
|
|
||||||
+ token = strtok(line, " ");
|
|
||||||
+ }
|
|
||||||
+ for (i = 0; i < MAX_NR_ZONES; i++) {
|
|
||||||
+ if (token) {
|
|
||||||
+ blk->zones[i] = zone_name_to_id(token);
|
|
||||||
+ blk->nr_zones++;
|
|
||||||
+ token = strtok(NULL, " ");
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
}
|
|
||||||
|
|
||||||
static int is_mergeable(struct lsmem *lsmem, struct memory_block *blk)
|
|
||||||
{
|
|
||||||
struct memory_block *curr;
|
|
||||||
+ int i;
|
|
||||||
|
|
||||||
if (!lsmem->nblocks)
|
|
||||||
return 0;
|
|
||||||
@@ -308,6 +387,15 @@ static int is_mergeable(struct lsmem *lsmem, struct memory_block *blk)
|
|
||||||
if (curr->node != blk->node)
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
+ if (lsmem->want_zones && lsmem->have_zones) {
|
|
||||||
+ if (curr->nr_zones != blk->nr_zones)
|
|
||||||
+ return 0;
|
|
||||||
+ for (i = 0; i < curr->nr_zones; i++) {
|
|
||||||
+ if (curr->zones[i] == ZONE_UNKNOWN ||
|
|
||||||
+ curr->zones[i] != blk->zones[i])
|
|
||||||
+ return 0;
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -362,6 +450,12 @@ static void read_basic_info(struct lsmem *lsmem)
|
|
||||||
|
|
||||||
if (memory_block_get_node(lsmem->dirs[0]->d_name) != -1)
|
|
||||||
lsmem->have_nodes = 1;
|
|
||||||
+
|
|
||||||
+ /* The valid_zones sysfs attribute was introduced with kernel 3.18 */
|
|
||||||
+ if (path_exist(_PATH_SYS_MEMORY "/memory0/valid_zones"))
|
|
||||||
+ lsmem->have_zones = 1;
|
|
||||||
+ else if (lsmem->want_zones)
|
|
||||||
+ warnx(_("Cannot read zones, no valid_zones sysfs attribute present"));
|
|
||||||
}
|
|
||||||
|
|
||||||
static void __attribute__((__noreturn__)) usage(void)
|
|
||||||
@@ -553,6 +647,8 @@ int main(int argc, char **argv)
|
|
||||||
lsmem->want_node = 1;
|
|
||||||
if (has_column(COL_REMOVABLE))
|
|
||||||
lsmem->want_removable = 1;
|
|
||||||
+ if (has_column(COL_ZONES))
|
|
||||||
+ lsmem->want_zones = 1;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Read data and print output
|
|
||||||
--
|
|
||||||
2.15.0
|
|
||||||
|
|
@ -1,107 +0,0 @@
|
|||||||
From 0a4320f5e785e82337c3a657c55651004e3fd08d Mon Sep 17 00:00:00 2001
|
|
||||||
From: Gerald Schaefer <gerald.schaefer@de.ibm.com>
|
|
||||||
Date: Wed, 27 Sep 2017 19:44:45 +0200
|
|
||||||
Subject: [PATCH 2/3] tests/lsmem: update lsmem test with ZONES column
|
|
||||||
|
|
||||||
The existing s390 and x86_64 dumps already contain the valid_zones sysfs
|
|
||||||
attribute, so just add a new "lsmem -o +ZONES" test command and update
|
|
||||||
the expected results.
|
|
||||||
|
|
||||||
Signed-off-by: Gerald Schaefer <gerald.schaefer@de.ibm.com>
|
|
||||||
---
|
|
||||||
tests/expected/lsmem/lsmem-s390-zvm-6g | 21 ++++++++++++++++++
|
|
||||||
tests/expected/lsmem/lsmem-x86_64-16g | 39 ++++++++++++++++++++++++++++++++++
|
|
||||||
tests/ts/lsmem/lsmem | 1 +
|
|
||||||
3 files changed, 61 insertions(+)
|
|
||||||
|
|
||||||
diff --git a/tests/expected/lsmem/lsmem-s390-zvm-6g b/tests/expected/lsmem/lsmem-s390-zvm-6g
|
|
||||||
index 05af40d4d..9f4c805ad 100644
|
|
||||||
--- a/tests/expected/lsmem/lsmem-s390-zvm-6g
|
|
||||||
+++ b/tests/expected/lsmem/lsmem-s390-zvm-6g
|
|
||||||
@@ -106,3 +106,24 @@ $ lsmem --json --output RANGE,SIZE,STATE,REMOVABLE,BLOCK,NODE
|
|
||||||
{"range": "0x0000000140000000-0x000000017fffffff", "size": "1G", "state": "offline", "removable": "-", "block": "20-23", "node": "0"}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
+
|
|
||||||
+---
|
|
||||||
+
|
|
||||||
+$ lsmem -o +ZONES
|
|
||||||
+RANGE SIZE STATE REMOVABLE BLOCK ZONES
|
|
||||||
+0x0000000000000000-0x000000006fffffff 1.8G online yes 0-6 DMA
|
|
||||||
+0x0000000070000000-0x000000007fffffff 256M online no 7 DMA/Normal
|
|
||||||
+0x0000000080000000-0x000000009fffffff 512M online yes 8-9 Normal
|
|
||||||
+0x00000000a0000000-0x00000000bfffffff 512M online no 10-11 Normal
|
|
||||||
+0x00000000c0000000-0x00000000dfffffff 512M online yes 12-13 Normal
|
|
||||||
+0x00000000e0000000-0x00000000efffffff 256M offline - 14 Normal
|
|
||||||
+0x00000000f0000000-0x00000000ffffffff 256M online yes 15 Normal
|
|
||||||
+0x0000000100000000-0x000000010fffffff 256M online no 16 Normal
|
|
||||||
+0x0000000110000000-0x000000011fffffff 256M online no 17 Normal/Movable
|
|
||||||
+0x0000000120000000-0x000000012fffffff 256M online yes 18 Movable/Normal
|
|
||||||
+0x0000000130000000-0x000000013fffffff 256M online yes 19 Movable
|
|
||||||
+0x0000000140000000-0x000000017fffffff 1G offline - 20-23 Movable
|
|
||||||
+
|
|
||||||
+Memory block size: 256M
|
|
||||||
+Total online memory: 4.8G
|
|
||||||
+Total offline memory: 1.3G
|
|
||||||
diff --git a/tests/expected/lsmem/lsmem-x86_64-16g b/tests/expected/lsmem/lsmem-x86_64-16g
|
|
||||||
index 14d7d84f6..40316a584 100644
|
|
||||||
--- a/tests/expected/lsmem/lsmem-x86_64-16g
|
|
||||||
+++ b/tests/expected/lsmem/lsmem-x86_64-16g
|
|
||||||
@@ -269,3 +269,42 @@ $ lsmem --json --output RANGE,SIZE,STATE,REMOVABLE,BLOCK,NODE
|
|
||||||
{"range": "0x0000000438000000-0x000000043fffffff", "size": "128M", "state": "online", "removable": "no", "block": "135", "node": "0"}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
+
|
|
||||||
+---
|
|
||||||
+
|
|
||||||
+$ lsmem -o +ZONES
|
|
||||||
+RANGE SIZE STATE REMOVABLE BLOCK ZONES
|
|
||||||
+0x0000000000000000-0x0000000007ffffff 128M online no 0 None
|
|
||||||
+0x0000000008000000-0x0000000037ffffff 768M online yes 1-6 DMA32
|
|
||||||
+0x0000000038000000-0x000000003fffffff 128M online no 7 DMA32
|
|
||||||
+0x0000000040000000-0x0000000077ffffff 896M online yes 8-14 DMA32
|
|
||||||
+0x0000000078000000-0x000000007fffffff 128M online no 15 DMA32
|
|
||||||
+0x0000000080000000-0x00000000afffffff 768M online yes 16-21 DMA32
|
|
||||||
+0x00000000b0000000-0x00000000bfffffff 256M online no 22-23 DMA32
|
|
||||||
+0x0000000100000000-0x00000001a7ffffff 2.6G online no 32-52 Normal
|
|
||||||
+0x00000001a8000000-0x00000001afffffff 128M online yes 53 Normal
|
|
||||||
+0x00000001b0000000-0x00000001bfffffff 256M online no 54-55 Normal
|
|
||||||
+0x00000001c0000000-0x00000001ffffffff 1G online yes 56-63 Normal
|
|
||||||
+0x0000000200000000-0x0000000207ffffff 128M online no 64 Normal
|
|
||||||
+0x0000000208000000-0x000000021fffffff 384M online yes 65-67 Normal
|
|
||||||
+0x0000000220000000-0x0000000237ffffff 384M online no 68-70 Normal
|
|
||||||
+0x0000000238000000-0x0000000277ffffff 1G online yes 71-78 Normal
|
|
||||||
+0x0000000278000000-0x000000028fffffff 384M online no 79-81 Normal
|
|
||||||
+0x0000000290000000-0x0000000297ffffff 128M online yes 82 Normal
|
|
||||||
+0x0000000298000000-0x00000002a7ffffff 256M online no 83-84 Normal
|
|
||||||
+0x00000002a8000000-0x00000002c7ffffff 512M online yes 85-88 Normal
|
|
||||||
+0x00000002c8000000-0x00000002dfffffff 384M online no 89-91 Normal
|
|
||||||
+0x00000002e0000000-0x00000002efffffff 256M online yes 92-93 Normal
|
|
||||||
+0x00000002f0000000-0x000000034fffffff 1.5G online no 94-105 Normal
|
|
||||||
+0x0000000350000000-0x0000000357ffffff 128M online yes 106 Normal
|
|
||||||
+0x0000000358000000-0x000000036fffffff 384M online no 107-109 Normal
|
|
||||||
+0x0000000370000000-0x0000000377ffffff 128M online yes 110 Normal
|
|
||||||
+0x0000000378000000-0x00000003c7ffffff 1.3G online no 111-120 Normal
|
|
||||||
+0x00000003c8000000-0x00000003e7ffffff 512M online yes 121-124 Normal
|
|
||||||
+0x00000003e8000000-0x000000042fffffff 1.1G online no 125-133 Normal
|
|
||||||
+0x0000000430000000-0x0000000437ffffff 128M online yes 134 Normal
|
|
||||||
+0x0000000438000000-0x000000043fffffff 128M online no 135 None
|
|
||||||
+
|
|
||||||
+Memory block size: 128M
|
|
||||||
+Total online memory: 16G
|
|
||||||
+Total offline memory: 0B
|
|
||||||
diff --git a/tests/ts/lsmem/lsmem b/tests/ts/lsmem/lsmem
|
|
||||||
index 79c0523b9..b1313773e 100755
|
|
||||||
--- a/tests/ts/lsmem/lsmem
|
|
||||||
+++ b/tests/ts/lsmem/lsmem
|
|
||||||
@@ -49,6 +49,7 @@ for dump in $(ls $TS_SELF/dumps/*.tar.bz2 | sort); do
|
|
||||||
do_lsmem --all --output $LSCOLUMNS
|
|
||||||
do_lsmem --raw --output $LSCOLUMNS
|
|
||||||
do_lsmem --json --output $LSCOLUMNS
|
|
||||||
+ do_lsmem -o +ZONES
|
|
||||||
|
|
||||||
ts_finalize_subtest
|
|
||||||
done
|
|
||||||
--
|
|
||||||
2.15.0
|
|
||||||
|
|
@ -1,44 +0,0 @@
|
|||||||
From afee3f204247fbc8e4cfaa1698f3d98762544dd8 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Andre Wild <wild@linux.vnet.ibm.com>
|
|
||||||
Date: Wed, 27 Sep 2017 19:44:46 +0200
|
|
||||||
Subject: [PATCH 3/3] lsmem/chmem: add memory zone awareness to bash-completion
|
|
||||||
|
|
||||||
This patch extends the valid --output values with ZONES for the
|
|
||||||
lsmem bash-completion, and adds the --zone option for the chmem
|
|
||||||
bash-completion.
|
|
||||||
|
|
||||||
Signed-off-by: Andre Wild <wild@linux.vnet.ibm.com>
|
|
||||||
Signed-off-by: Gerald Schaefer <gerald.schaefer@de.ibm.com>
|
|
||||||
---
|
|
||||||
bash-completion/chmem | 1 +
|
|
||||||
bash-completion/lsmem | 2 +-
|
|
||||||
2 files changed, 2 insertions(+), 1 deletion(-)
|
|
||||||
|
|
||||||
diff --git a/bash-completion/chmem b/bash-completion/chmem
|
|
||||||
index 00b870dbd..3e3af87ac 100644
|
|
||||||
--- a/bash-completion/chmem
|
|
||||||
+++ b/bash-completion/chmem
|
|
||||||
@@ -16,6 +16,7 @@ _chmem_module()
|
|
||||||
--disable
|
|
||||||
--blocks
|
|
||||||
--verbose
|
|
||||||
+ --zone
|
|
||||||
--help
|
|
||||||
--version
|
|
||||||
"
|
|
||||||
diff --git a/bash-completion/lsmem b/bash-completion/lsmem
|
|
||||||
index 8f7a46ec3..9aa124569 100644
|
|
||||||
--- a/bash-completion/lsmem
|
|
||||||
+++ b/bash-completion/lsmem
|
|
||||||
@@ -9,7 +9,7 @@ _lsmem_module()
|
|
||||||
local prefix realcur OUTPUT_ALL OUTPUT
|
|
||||||
realcur="${cur##*,}"
|
|
||||||
prefix="${cur%$realcur}"
|
|
||||||
- OUTPUT_ALL='RANGE SIZE STATE REMOVABLE BLOCK NODE'
|
|
||||||
+ OUTPUT_ALL='RANGE SIZE STATE REMOVABLE BLOCK NODE ZONES'
|
|
||||||
for WORD in $OUTPUT_ALL; do
|
|
||||||
if ! [[ $prefix == *"$WORD"* ]]; then
|
|
||||||
OUTPUT="$WORD ${OUTPUT:-""}"
|
|
||||||
--
|
|
||||||
2.15.0
|
|
||||||
|
|
@ -1,157 +0,0 @@
|
|||||||
From d51f05bfecb299a830897106460bf395be440c0a Mon Sep 17 00:00:00 2001
|
|
||||||
From: Karel Zak <kzak@redhat.com>
|
|
||||||
Date: Fri, 9 Feb 2018 14:18:18 +0100
|
|
||||||
Subject: [PATCH] lsblk: try device/dev to read devno
|
|
||||||
|
|
||||||
Now sysfs_devname_to_devno() reads devno from /dev or
|
|
||||||
/sys/block/<name>/dev, but it seems that NVME uses
|
|
||||||
/sys/block/<name>/device/dev.
|
|
||||||
|
|
||||||
Reported-by: Potnuri Bharat Teja <bharat@chelsio.com>
|
|
||||||
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|
||||||
---
|
|
||||||
lib/sysfs.c | 97 ++++++++++++++++++++++++++++++++++---------------------------
|
|
||||||
1 file changed, 54 insertions(+), 43 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/lib/sysfs.c b/lib/sysfs.c
|
|
||||||
index e8125e511..b1b67c59f 100644
|
|
||||||
--- a/lib/sysfs.c
|
|
||||||
+++ b/lib/sysfs.c
|
|
||||||
@@ -48,10 +48,28 @@ char *sysfs_devno_path(dev_t devno, char *buf, size_t bufsiz)
|
|
||||||
return sysfs_devno_attribute_path(devno, buf, bufsiz, NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
+static dev_t read_devno(const char *path)
|
|
||||||
+{
|
|
||||||
+ FILE *f;
|
|
||||||
+ int maj = 0, min = 0;
|
|
||||||
+ dev_t dev = 0;
|
|
||||||
+
|
|
||||||
+ f = fopen(path, "r" UL_CLOEXECSTR);
|
|
||||||
+ if (!f)
|
|
||||||
+ return 0;
|
|
||||||
+
|
|
||||||
+ if (fscanf(f, "%d:%d", &maj, &min) == 2)
|
|
||||||
+ dev = makedev(maj, min);
|
|
||||||
+ fclose(f);
|
|
||||||
+ return dev;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
dev_t sysfs_devname_to_devno(const char *name, const char *parent)
|
|
||||||
{
|
|
||||||
- char buf[PATH_MAX], *path = NULL;
|
|
||||||
+ char buf[PATH_MAX];
|
|
||||||
+ char *_name = NULL; /* name as encoded in sysfs */
|
|
||||||
dev_t dev = 0;
|
|
||||||
+ int len;
|
|
||||||
|
|
||||||
if (strncmp("/dev/", name, 5) == 0) {
|
|
||||||
/*
|
|
||||||
@@ -59,69 +77,62 @@ dev_t sysfs_devname_to_devno(const char *name, const char *parent)
|
|
||||||
*/
|
|
||||||
struct stat st;
|
|
||||||
|
|
||||||
- if (stat(name, &st) == 0)
|
|
||||||
+ if (stat(name, &st) == 0) {
|
|
||||||
dev = st.st_rdev;
|
|
||||||
- else
|
|
||||||
- name += 5; /* unaccesible, or not node in /dev */
|
|
||||||
+ goto done;
|
|
||||||
+ }
|
|
||||||
+ name += 5; /* unaccesible, or not node in /dev */
|
|
||||||
}
|
|
||||||
|
|
||||||
- if (!dev && parent && strncmp("dm-", name, 3)) {
|
|
||||||
+ _name = strdup(name);
|
|
||||||
+ if (!_name)
|
|
||||||
+ goto done;
|
|
||||||
+ sysfs_devname_dev_to_sys(_name);
|
|
||||||
+
|
|
||||||
+ if (parent && strncmp("dm-", name, 3)) {
|
|
||||||
/*
|
|
||||||
* Create path to /sys/block/<parent>/<name>/dev
|
|
||||||
*/
|
|
||||||
- char *_name = strdup(name), *_parent = strdup(parent);
|
|
||||||
- int len;
|
|
||||||
+ char *_parent = strdup(parent);
|
|
||||||
|
|
||||||
- if (!_name || !_parent) {
|
|
||||||
- free(_name);
|
|
||||||
+ if (!_parent) {
|
|
||||||
free(_parent);
|
|
||||||
- return 0;
|
|
||||||
+ goto done;
|
|
||||||
}
|
|
||||||
- sysfs_devname_dev_to_sys(_name);
|
|
||||||
sysfs_devname_dev_to_sys(_parent);
|
|
||||||
|
|
||||||
len = snprintf(buf, sizeof(buf),
|
|
||||||
_PATH_SYS_BLOCK "/%s/%s/dev", _parent, _name);
|
|
||||||
- free(_name);
|
|
||||||
free(_parent);
|
|
||||||
if (len < 0 || (size_t) len >= sizeof(buf))
|
|
||||||
- return 0;
|
|
||||||
- path = buf;
|
|
||||||
+ goto done;
|
|
||||||
|
|
||||||
- } else if (!dev) {
|
|
||||||
- /*
|
|
||||||
- * Create path to /sys/block/<sysname>/dev
|
|
||||||
- */
|
|
||||||
- char *_name = strdup(name);
|
|
||||||
- int len;
|
|
||||||
-
|
|
||||||
- if (!_name)
|
|
||||||
- return 0;
|
|
||||||
-
|
|
||||||
- sysfs_devname_dev_to_sys(_name);
|
|
||||||
- len = snprintf(buf, sizeof(buf),
|
|
||||||
- _PATH_SYS_BLOCK "/%s/dev", _name);
|
|
||||||
- free(_name);
|
|
||||||
- if (len < 0 || (size_t) len >= sizeof(buf))
|
|
||||||
- return 0;
|
|
||||||
- path = buf;
|
|
||||||
+ /* don't try anything else for dm-* */
|
|
||||||
+ dev = read_devno(buf);
|
|
||||||
+ goto done;
|
|
||||||
}
|
|
||||||
|
|
||||||
- if (path) {
|
|
||||||
+ /*
|
|
||||||
+ * Read from /sys/block/<sysname>/dev
|
|
||||||
+ */
|
|
||||||
+ len = snprintf(buf, sizeof(buf),
|
|
||||||
+ _PATH_SYS_BLOCK "/%s/dev", _name);
|
|
||||||
+ if (len < 0 || (size_t) len >= sizeof(buf))
|
|
||||||
+ goto done;
|
|
||||||
+ dev = read_devno(buf);
|
|
||||||
+
|
|
||||||
+ if (!dev) {
|
|
||||||
/*
|
|
||||||
- * read devno from sysfs
|
|
||||||
+ * Read from /sys/block/<sysname>/device/dev
|
|
||||||
*/
|
|
||||||
- FILE *f;
|
|
||||||
- int maj = 0, min = 0;
|
|
||||||
-
|
|
||||||
- f = fopen(path, "r" UL_CLOEXECSTR);
|
|
||||||
- if (!f)
|
|
||||||
- return 0;
|
|
||||||
-
|
|
||||||
- if (fscanf(f, "%d:%d", &maj, &min) == 2)
|
|
||||||
- dev = makedev(maj, min);
|
|
||||||
- fclose(f);
|
|
||||||
+ len = snprintf(buf, sizeof(buf),
|
|
||||||
+ _PATH_SYS_BLOCK "/%s/device/dev", _name);
|
|
||||||
+ if (len < 0 || (size_t) len >= sizeof(buf))
|
|
||||||
+ goto done;
|
|
||||||
+ dev = read_devno(buf);
|
|
||||||
}
|
|
||||||
+done:
|
|
||||||
+ free(_name);
|
|
||||||
return dev;
|
|
||||||
}
|
|
||||||
|
|
||||||
--
|
|
||||||
2.16.1
|
|
||||||
|
|
@ -1,3 +1,41 @@
|
|||||||
|
-------------------------------------------------------------------
|
||||||
|
Mon Aug 6 15:21:35 CEST 2018 - sbrabec@suse.com
|
||||||
|
|
||||||
|
- Update to version 2.32.1:
|
||||||
|
* cal(1) has been improved and extended.
|
||||||
|
* libblkid has been extended to support LUKS2, Micron mpool, VDO
|
||||||
|
and Atari partition table.
|
||||||
|
* rfkill(8) has been moved to /usr/sbin.
|
||||||
|
* dmesg(1) provides better support for multi-line messages, new
|
||||||
|
command line option --force-prefix.
|
||||||
|
* fallocate(1) --dig-holes is faster and more effect now.
|
||||||
|
* fdisk(8) provides access to Protective MBR accessible from main
|
||||||
|
menu. Sun label support has been improved.
|
||||||
|
* lscpu(1) provides more details about ARM CPUs now
|
||||||
|
(FATE#326453).
|
||||||
|
* lsmem(1) supports memory zone awareness now (FATE#324252,
|
||||||
|
drop util-linux-lsmem-memory-zone-1.patch,
|
||||||
|
util-linux-lsmem-memory-zone-2.patch,
|
||||||
|
util-linux-lsmem-memory-zone-3.patch).
|
||||||
|
* lsns(8) provides netnsid and nsfs columns now.
|
||||||
|
* rtcwake(8) waits stdin to settle down before entering a system
|
||||||
|
sleep.
|
||||||
|
* Many fixes and improvements, see
|
||||||
|
https://www.kernel.org/pub/linux/utils/util-linux/v2.32/v2.32-ReleaseNotes
|
||||||
|
https://www.kernel.org/pub/linux/utils/util-linux/v2.32/v2.32.1-ReleaseNotes
|
||||||
|
(drop util_linux_bigendian.patch, util-linux-cramfs.patch,
|
||||||
|
util-linux-fincore-count.patch,
|
||||||
|
util-linux-sysfs-nvme-devno.patch, util-linux-lscpu-loop.patch,
|
||||||
|
util-linux-libmount-umount-a-segfault.patch,
|
||||||
|
util-linux-libmount-mount-a-nfs-bind-mount.patch,
|
||||||
|
util-linux-lscpu-chcpu-new-cpu-macros.patch,
|
||||||
|
util-linux-chcpu-cpu-count.patch).
|
||||||
|
|
||||||
|
-------------------------------------------------------------------
|
||||||
|
Tue Jul 3 16:27:27 CEST 2018 - sbrabec@suse.com
|
||||||
|
|
||||||
|
- Switch python-libmount to python3-libmount.
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Tue May 22 11:54:13 UTC 2018 - tchvatal@suse.com
|
Tue May 22 11:54:13 UTC 2018 - tchvatal@suse.com
|
||||||
|
|
||||||
|
@ -43,7 +43,7 @@ Name: util-linux-systemd
|
|||||||
%define group_ul System/Base
|
%define group_ul System/Base
|
||||||
%define group_uls System/Base
|
%define group_uls System/Base
|
||||||
%define group_pl Development/Languages/Python
|
%define group_pl Development/Languages/Python
|
||||||
%if "%{name}" == "python-libmount"
|
%if "%{name}" == "python3-libmount"
|
||||||
%define build_util_linux 0
|
%define build_util_linux 0
|
||||||
%define build_util_linux_systemd 0
|
%define build_util_linux_systemd 0
|
||||||
%define build_python_libmount 1
|
%define build_python_libmount 1
|
||||||
@ -101,7 +101,7 @@ BuildRequires: systemd-rpm-macros
|
|||||||
BuildRequires: pkgconfig(libsystemd)
|
BuildRequires: pkgconfig(libsystemd)
|
||||||
%endif
|
%endif
|
||||||
%if %build_python_libmount
|
%if %build_python_libmount
|
||||||
BuildRequires: python-devel
|
BuildRequires: python3-devel
|
||||||
%endif
|
%endif
|
||||||
#BEGIN SECOND STAGE DEPENDENCIES
|
#BEGIN SECOND STAGE DEPENDENCIES
|
||||||
%if !%build_util_linux
|
%if !%build_util_linux
|
||||||
@ -116,7 +116,7 @@ BuildRequires: libmount-devel
|
|||||||
%endif
|
%endif
|
||||||
%endif
|
%endif
|
||||||
#END SECOND STAGE DEPENDENCIES
|
#END SECOND STAGE DEPENDENCIES
|
||||||
Version: 2.31.1
|
Version: 2.32.1
|
||||||
Release: 0
|
Release: 0
|
||||||
# util-linux is a base package and uuidd pre-requiring pwdutils pulls
|
# util-linux is a base package and uuidd pre-requiring pwdutils pulls
|
||||||
# that into the core build cycle. pwdutils also pulls in the whole
|
# that into the core build cycle. pwdutils also pulls in the whole
|
||||||
@ -125,7 +125,7 @@ Release: 0
|
|||||||
# these tools as well
|
# these tools as well
|
||||||
#!BuildIgnore: pwdutils
|
#!BuildIgnore: pwdutils
|
||||||
Url: https://www.kernel.org/pub/linux/utils/util-linux/
|
Url: https://www.kernel.org/pub/linux/utils/util-linux/
|
||||||
Source: https://www.kernel.org/pub/linux/utils/util-linux/v2.31/util-linux-%{version}.tar.xz
|
Source: https://www.kernel.org/pub/linux/utils/util-linux/v2.32/util-linux-%{version}.tar.xz
|
||||||
Source1: util-linux-rpmlintrc
|
Source1: util-linux-rpmlintrc
|
||||||
Source4: raw.service
|
Source4: raw.service
|
||||||
Source5: etc.raw
|
Source5: etc.raw
|
||||||
@ -135,7 +135,7 @@ Source8: login.pamd
|
|||||||
Source9: remote.pamd
|
Source9: remote.pamd
|
||||||
Source10: su.pamd
|
Source10: su.pamd
|
||||||
Source11: su.default
|
Source11: su.default
|
||||||
Source12: https://www.kernel.org/pub/linux/utils/util-linux/v2.31/util-linux-%{version}.tar.sign
|
Source12: https://www.kernel.org/pub/linux/utils/util-linux/v2.32/util-linux-%{version}.tar.sign
|
||||||
Source13: %{_name}.keyring
|
Source13: %{_name}.keyring
|
||||||
Source14: runuser.pamd
|
Source14: runuser.pamd
|
||||||
Source15: runuser-l.pamd
|
Source15: runuser-l.pamd
|
||||||
@ -160,30 +160,6 @@ Source51: blkid.conf
|
|||||||
##
|
##
|
||||||
# PATCH-EXTEND-UPSTREAM: Let `su' handle /sbin and /usr/sbin in path
|
# PATCH-EXTEND-UPSTREAM: Let `su' handle /sbin and /usr/sbin in path
|
||||||
Patch0: make-sure-sbin-resp-usr-sbin-are-in-PATH.diff
|
Patch0: make-sure-sbin-resp-usr-sbin-are-in-PATH.diff
|
||||||
# PATCH-FEATURE-UPSTREAM util-linux-lsmem-memory-zone-1.patch bsc1065471 FATE324252 sbrabec@suse.com -- lsmem: Add support for zone awareness.
|
|
||||||
Patch1: util-linux-lsmem-memory-zone-1.patch
|
|
||||||
# PATCH-FEATURE-UPSTREAM util-linux-lsmem-memory-zone-2.patch bsc1065471 FATE324252 sbrabec@suse.com -- lsmem: Add support for zone awareness.
|
|
||||||
Patch2: util-linux-lsmem-memory-zone-2.patch
|
|
||||||
# PATCH-FEATURE-UPSTREAM util-linux-lsmem-memory-zone-3.patch bsc1065471 FATE324252 sbrabec@suse.com -- lsmem: Add support for zone awareness.
|
|
||||||
Patch3: util-linux-lsmem-memory-zone-3.patch
|
|
||||||
# Add four commits from upstream to pass tests on ppc64
|
|
||||||
Patch4: util_linux_bigendian.patch
|
|
||||||
# PATCH-FIX-UPSTREAM util-linux-cramfs.patch sbrabec@suse.com -- Fix fsck.cramfs failure on ppc64le.
|
|
||||||
Patch5: util-linux-cramfs.patch
|
|
||||||
# PATCH-FIX-UPSTREAM util-linux-fincore-count.patch sbrabec@suse.com -- Disable bad test fincore/count.
|
|
||||||
Patch6: util-linux-fincore-count.patch
|
|
||||||
# PATCH-FIX-UPSTREAM util-linux-sysfs-nvme-devno.patch bsc1078662 sbrabec@suse.com -- Fix lsblk on NVMe.
|
|
||||||
Patch7: util-linux-sysfs-nvme-devno.patch
|
|
||||||
# PATCH-FIX-UPSTREAM util-linux-lscpu-loop.patch bsc1072947 sbrabec@suse.com -- Fix crash loop in lscpu.
|
|
||||||
Patch8: util-linux-lscpu-loop.patch
|
|
||||||
# PATCH-FIX-UPSTREAM util-linux-libmount-umount-a-segfault.patch sbrabec@suse.com -- Fix possible segfault of umount -a.
|
|
||||||
Patch9: util-linux-libmount-umount-a-segfault.patch
|
|
||||||
# PATCH-FIX-UPSTREAM util-linux-libmount-mount-a-nfs-bind-mount.patch bsc1080740 sbrabec@suse.com -- Fix mount -a on NFS bind mounts.
|
|
||||||
Patch10: util-linux-libmount-mount-a-nfs-bind-mount.patch
|
|
||||||
# PATCH-FIX-UPSTREAM util-linux-lscpu-chcpu-new-cpu-macros.patch bnc1091164 sbrabec@suse.com -- Fix lscpu and chcpu on systems with >1024 cores.
|
|
||||||
Patch11: util-linux-lscpu-chcpu-new-cpu-macros.patch
|
|
||||||
# PATCH-FIX-UPSTREAM util-linux-chcpu-cpu-count.patch bnc1091164 sbrabec@suse.com -- chcpu: Properly count CPUs.
|
|
||||||
Patch12: util-linux-chcpu-cpu-count.patch
|
|
||||||
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
||||||
#
|
#
|
||||||
%if %build_util_linux
|
%if %build_util_linux
|
||||||
@ -405,11 +381,11 @@ SMP systems.
|
|||||||
%endif
|
%endif
|
||||||
%if %build_python_libmount
|
%if %build_python_libmount
|
||||||
%if %build_util_linux
|
%if %build_util_linux
|
||||||
%package -n python-libmount
|
%package -n python3-libmount
|
||||||
Summary: %summary_pl
|
Summary: %summary_pl
|
||||||
Group: %group_pl
|
Group: %group_pl
|
||||||
|
|
||||||
%description -n python-libmount
|
%description -n python3-libmount
|
||||||
%else
|
%else
|
||||||
%description
|
%description
|
||||||
%endif
|
%endif
|
||||||
@ -420,18 +396,6 @@ library.
|
|||||||
%prep
|
%prep
|
||||||
%setup -q -n %{_name}-%{version} -b 40
|
%setup -q -n %{_name}-%{version} -b 40
|
||||||
%patch0 -p1
|
%patch0 -p1
|
||||||
%patch1 -p1
|
|
||||||
%patch2 -p1
|
|
||||||
%patch3 -p1
|
|
||||||
%patch4 -p1
|
|
||||||
%patch5 -p1
|
|
||||||
%patch6 -p1
|
|
||||||
%patch7 -p1
|
|
||||||
%patch8 -p1
|
|
||||||
%patch9 -p1
|
|
||||||
%patch10 -p1
|
|
||||||
%patch11 -p1
|
|
||||||
%patch12 -p1
|
|
||||||
#
|
#
|
||||||
# setctsid
|
# setctsid
|
||||||
cp -p %{S:22} %{S:23} .
|
cp -p %{S:22} %{S:23} .
|
||||||
@ -674,7 +638,7 @@ install -Dm644 %{SOURCE42} %{buildroot}%{_unitdir}/rfkill-unblock@.service
|
|||||||
# util-linux install
|
# util-linux install
|
||||||
#
|
#
|
||||||
%make_install
|
%make_install
|
||||||
rm -f %{buildroot}%{python_sitearch}/libmount/*.*a
|
rm -f %{buildroot}%{python3_sitearch}/libmount/*.*a
|
||||||
%if %build_util_linux
|
%if %build_util_linux
|
||||||
#UsrMerge
|
#UsrMerge
|
||||||
ln -s %{_bindir}/kill %{buildroot}/bin
|
ln -s %{_bindir}/kill %{buildroot}/bin
|
||||||
@ -1376,12 +1340,12 @@ getent passwd uuidd >/dev/null || \
|
|||||||
|
|
||||||
%if %build_python_libmount
|
%if %build_python_libmount
|
||||||
%if %build_util_linux
|
%if %build_util_linux
|
||||||
%files -n python-libmount
|
%files -n python3-libmount
|
||||||
%else
|
%else
|
||||||
%files
|
%files
|
||||||
%endif
|
%endif
|
||||||
%defattr(-, root, root)
|
%defattr(-, root, root)
|
||||||
%{python_sitearch}/libmount
|
%{python3_sitearch}/libmount
|
||||||
%endif
|
%endif
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
@ -1,3 +1,41 @@
|
|||||||
|
-------------------------------------------------------------------
|
||||||
|
Mon Aug 6 15:21:35 CEST 2018 - sbrabec@suse.com
|
||||||
|
|
||||||
|
- Update to version 2.32.1:
|
||||||
|
* cal(1) has been improved and extended.
|
||||||
|
* libblkid has been extended to support LUKS2, Micron mpool, VDO
|
||||||
|
and Atari partition table.
|
||||||
|
* rfkill(8) has been moved to /usr/sbin.
|
||||||
|
* dmesg(1) provides better support for multi-line messages, new
|
||||||
|
command line option --force-prefix.
|
||||||
|
* fallocate(1) --dig-holes is faster and more effect now.
|
||||||
|
* fdisk(8) provides access to Protective MBR accessible from main
|
||||||
|
menu. Sun label support has been improved.
|
||||||
|
* lscpu(1) provides more details about ARM CPUs now
|
||||||
|
(FATE#326453).
|
||||||
|
* lsmem(1) supports memory zone awareness now (FATE#324252,
|
||||||
|
drop util-linux-lsmem-memory-zone-1.patch,
|
||||||
|
util-linux-lsmem-memory-zone-2.patch,
|
||||||
|
util-linux-lsmem-memory-zone-3.patch).
|
||||||
|
* lsns(8) provides netnsid and nsfs columns now.
|
||||||
|
* rtcwake(8) waits stdin to settle down before entering a system
|
||||||
|
sleep.
|
||||||
|
* Many fixes and improvements, see
|
||||||
|
https://www.kernel.org/pub/linux/utils/util-linux/v2.32/v2.32-ReleaseNotes
|
||||||
|
https://www.kernel.org/pub/linux/utils/util-linux/v2.32/v2.32.1-ReleaseNotes
|
||||||
|
(drop util_linux_bigendian.patch, util-linux-cramfs.patch,
|
||||||
|
util-linux-fincore-count.patch,
|
||||||
|
util-linux-sysfs-nvme-devno.patch, util-linux-lscpu-loop.patch,
|
||||||
|
util-linux-libmount-umount-a-segfault.patch,
|
||||||
|
util-linux-libmount-mount-a-nfs-bind-mount.patch,
|
||||||
|
util-linux-lscpu-chcpu-new-cpu-macros.patch,
|
||||||
|
util-linux-chcpu-cpu-count.patch).
|
||||||
|
|
||||||
|
-------------------------------------------------------------------
|
||||||
|
Tue Jul 3 16:27:27 CEST 2018 - sbrabec@suse.com
|
||||||
|
|
||||||
|
- Switch python-libmount to python3-libmount.
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Tue May 22 11:54:13 UTC 2018 - tchvatal@suse.com
|
Tue May 22 11:54:13 UTC 2018 - tchvatal@suse.com
|
||||||
|
|
||||||
|
@ -43,7 +43,7 @@ Name: util-linux
|
|||||||
%define group_ul System/Base
|
%define group_ul System/Base
|
||||||
%define group_uls System/Base
|
%define group_uls System/Base
|
||||||
%define group_pl Development/Languages/Python
|
%define group_pl Development/Languages/Python
|
||||||
%if "%{name}" == "python-libmount"
|
%if "%{name}" == "python3-libmount"
|
||||||
%define build_util_linux 0
|
%define build_util_linux 0
|
||||||
%define build_util_linux_systemd 0
|
%define build_util_linux_systemd 0
|
||||||
%define build_python_libmount 1
|
%define build_python_libmount 1
|
||||||
@ -101,7 +101,7 @@ BuildRequires: systemd-rpm-macros
|
|||||||
BuildRequires: pkgconfig(libsystemd)
|
BuildRequires: pkgconfig(libsystemd)
|
||||||
%endif
|
%endif
|
||||||
%if %build_python_libmount
|
%if %build_python_libmount
|
||||||
BuildRequires: python-devel
|
BuildRequires: python3-devel
|
||||||
%endif
|
%endif
|
||||||
#BEGIN SECOND STAGE DEPENDENCIES
|
#BEGIN SECOND STAGE DEPENDENCIES
|
||||||
%if !%build_util_linux
|
%if !%build_util_linux
|
||||||
@ -116,7 +116,7 @@ BuildRequires: libmount-devel
|
|||||||
%endif
|
%endif
|
||||||
%endif
|
%endif
|
||||||
#END SECOND STAGE DEPENDENCIES
|
#END SECOND STAGE DEPENDENCIES
|
||||||
Version: 2.31.1
|
Version: 2.32.1
|
||||||
Release: 0
|
Release: 0
|
||||||
# util-linux is a base package and uuidd pre-requiring pwdutils pulls
|
# util-linux is a base package and uuidd pre-requiring pwdutils pulls
|
||||||
# that into the core build cycle. pwdutils also pulls in the whole
|
# that into the core build cycle. pwdutils also pulls in the whole
|
||||||
@ -125,7 +125,7 @@ Release: 0
|
|||||||
# these tools as well
|
# these tools as well
|
||||||
#!BuildIgnore: pwdutils
|
#!BuildIgnore: pwdutils
|
||||||
Url: https://www.kernel.org/pub/linux/utils/util-linux/
|
Url: https://www.kernel.org/pub/linux/utils/util-linux/
|
||||||
Source: https://www.kernel.org/pub/linux/utils/util-linux/v2.31/util-linux-%{version}.tar.xz
|
Source: https://www.kernel.org/pub/linux/utils/util-linux/v2.32/util-linux-%{version}.tar.xz
|
||||||
Source1: util-linux-rpmlintrc
|
Source1: util-linux-rpmlintrc
|
||||||
Source4: raw.service
|
Source4: raw.service
|
||||||
Source5: etc.raw
|
Source5: etc.raw
|
||||||
@ -135,7 +135,7 @@ Source8: login.pamd
|
|||||||
Source9: remote.pamd
|
Source9: remote.pamd
|
||||||
Source10: su.pamd
|
Source10: su.pamd
|
||||||
Source11: su.default
|
Source11: su.default
|
||||||
Source12: https://www.kernel.org/pub/linux/utils/util-linux/v2.31/util-linux-%{version}.tar.sign
|
Source12: https://www.kernel.org/pub/linux/utils/util-linux/v2.32/util-linux-%{version}.tar.sign
|
||||||
Source13: %{_name}.keyring
|
Source13: %{_name}.keyring
|
||||||
Source14: runuser.pamd
|
Source14: runuser.pamd
|
||||||
Source15: runuser-l.pamd
|
Source15: runuser-l.pamd
|
||||||
@ -160,30 +160,6 @@ Source51: blkid.conf
|
|||||||
##
|
##
|
||||||
# PATCH-EXTEND-UPSTREAM: Let `su' handle /sbin and /usr/sbin in path
|
# PATCH-EXTEND-UPSTREAM: Let `su' handle /sbin and /usr/sbin in path
|
||||||
Patch0: make-sure-sbin-resp-usr-sbin-are-in-PATH.diff
|
Patch0: make-sure-sbin-resp-usr-sbin-are-in-PATH.diff
|
||||||
# PATCH-FEATURE-UPSTREAM util-linux-lsmem-memory-zone-1.patch bsc1065471 FATE324252 sbrabec@suse.com -- lsmem: Add support for zone awareness.
|
|
||||||
Patch1: util-linux-lsmem-memory-zone-1.patch
|
|
||||||
# PATCH-FEATURE-UPSTREAM util-linux-lsmem-memory-zone-2.patch bsc1065471 FATE324252 sbrabec@suse.com -- lsmem: Add support for zone awareness.
|
|
||||||
Patch2: util-linux-lsmem-memory-zone-2.patch
|
|
||||||
# PATCH-FEATURE-UPSTREAM util-linux-lsmem-memory-zone-3.patch bsc1065471 FATE324252 sbrabec@suse.com -- lsmem: Add support for zone awareness.
|
|
||||||
Patch3: util-linux-lsmem-memory-zone-3.patch
|
|
||||||
# Add four commits from upstream to pass tests on ppc64
|
|
||||||
Patch4: util_linux_bigendian.patch
|
|
||||||
# PATCH-FIX-UPSTREAM util-linux-cramfs.patch sbrabec@suse.com -- Fix fsck.cramfs failure on ppc64le.
|
|
||||||
Patch5: util-linux-cramfs.patch
|
|
||||||
# PATCH-FIX-UPSTREAM util-linux-fincore-count.patch sbrabec@suse.com -- Disable bad test fincore/count.
|
|
||||||
Patch6: util-linux-fincore-count.patch
|
|
||||||
# PATCH-FIX-UPSTREAM util-linux-sysfs-nvme-devno.patch bsc1078662 sbrabec@suse.com -- Fix lsblk on NVMe.
|
|
||||||
Patch7: util-linux-sysfs-nvme-devno.patch
|
|
||||||
# PATCH-FIX-UPSTREAM util-linux-lscpu-loop.patch bsc1072947 sbrabec@suse.com -- Fix crash loop in lscpu.
|
|
||||||
Patch8: util-linux-lscpu-loop.patch
|
|
||||||
# PATCH-FIX-UPSTREAM util-linux-libmount-umount-a-segfault.patch sbrabec@suse.com -- Fix possible segfault of umount -a.
|
|
||||||
Patch9: util-linux-libmount-umount-a-segfault.patch
|
|
||||||
# PATCH-FIX-UPSTREAM util-linux-libmount-mount-a-nfs-bind-mount.patch bsc1080740 sbrabec@suse.com -- Fix mount -a on NFS bind mounts.
|
|
||||||
Patch10: util-linux-libmount-mount-a-nfs-bind-mount.patch
|
|
||||||
# PATCH-FIX-UPSTREAM util-linux-lscpu-chcpu-new-cpu-macros.patch bnc1091164 sbrabec@suse.com -- Fix lscpu and chcpu on systems with >1024 cores.
|
|
||||||
Patch11: util-linux-lscpu-chcpu-new-cpu-macros.patch
|
|
||||||
# PATCH-FIX-UPSTREAM util-linux-chcpu-cpu-count.patch bnc1091164 sbrabec@suse.com -- chcpu: Properly count CPUs.
|
|
||||||
Patch12: util-linux-chcpu-cpu-count.patch
|
|
||||||
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
||||||
#
|
#
|
||||||
%if %build_util_linux
|
%if %build_util_linux
|
||||||
@ -405,11 +381,11 @@ SMP systems.
|
|||||||
%endif
|
%endif
|
||||||
%if %build_python_libmount
|
%if %build_python_libmount
|
||||||
%if %build_util_linux
|
%if %build_util_linux
|
||||||
%package -n python-libmount
|
%package -n python3-libmount
|
||||||
Summary: %summary_pl
|
Summary: %summary_pl
|
||||||
Group: %group_pl
|
Group: %group_pl
|
||||||
|
|
||||||
%description -n python-libmount
|
%description -n python3-libmount
|
||||||
%else
|
%else
|
||||||
%description
|
%description
|
||||||
%endif
|
%endif
|
||||||
@ -420,18 +396,6 @@ library.
|
|||||||
%prep
|
%prep
|
||||||
%setup -q -n %{_name}-%{version} -b 40
|
%setup -q -n %{_name}-%{version} -b 40
|
||||||
%patch0 -p1
|
%patch0 -p1
|
||||||
%patch1 -p1
|
|
||||||
%patch2 -p1
|
|
||||||
%patch3 -p1
|
|
||||||
%patch4 -p1
|
|
||||||
%patch5 -p1
|
|
||||||
%patch6 -p1
|
|
||||||
%patch7 -p1
|
|
||||||
%patch8 -p1
|
|
||||||
%patch9 -p1
|
|
||||||
%patch10 -p1
|
|
||||||
%patch11 -p1
|
|
||||||
%patch12 -p1
|
|
||||||
#
|
#
|
||||||
# setctsid
|
# setctsid
|
||||||
cp -p %{S:22} %{S:23} .
|
cp -p %{S:22} %{S:23} .
|
||||||
@ -674,7 +638,7 @@ install -Dm644 %{SOURCE42} %{buildroot}%{_unitdir}/rfkill-unblock@.service
|
|||||||
# util-linux install
|
# util-linux install
|
||||||
#
|
#
|
||||||
%make_install
|
%make_install
|
||||||
rm -f %{buildroot}%{python_sitearch}/libmount/*.*a
|
rm -f %{buildroot}%{python3_sitearch}/libmount/*.*a
|
||||||
%if %build_util_linux
|
%if %build_util_linux
|
||||||
#UsrMerge
|
#UsrMerge
|
||||||
ln -s %{_bindir}/kill %{buildroot}/bin
|
ln -s %{_bindir}/kill %{buildroot}/bin
|
||||||
@ -1376,12 +1340,12 @@ getent passwd uuidd >/dev/null || \
|
|||||||
|
|
||||||
%if %build_python_libmount
|
%if %build_python_libmount
|
||||||
%if %build_util_linux
|
%if %build_util_linux
|
||||||
%files -n python-libmount
|
%files -n python3-libmount
|
||||||
%else
|
%else
|
||||||
%files
|
%files
|
||||||
%endif
|
%endif
|
||||||
%defattr(-, root, root)
|
%defattr(-, root, root)
|
||||||
%{python_sitearch}/libmount
|
%{python3_sitearch}/libmount
|
||||||
%endif
|
%endif
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
@ -1,512 +0,0 @@
|
|||||||
commit 3ae2cb49d9a8c20de1892c691b7cc86f4deb280c
|
|
||||||
Author: Karel Zak <kzak@redhat.com>
|
|
||||||
Date: Tue Dec 12 11:42:28 2017 +0100
|
|
||||||
|
|
||||||
lib/sha1: fix indention
|
|
||||||
|
|
||||||
* indent -linux -psl -blf lib/sha1.c
|
|
||||||
* manually fix comments
|
|
||||||
|
|
||||||
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|
||||||
|
|
||||||
commit 4ff4b1106e8c6a71cce59ca40a2019342a92d47d
|
|
||||||
Author: Karel Zak <kzak@redhat.com>
|
|
||||||
Date: Tue Jan 2 11:08:03 2018 +0100
|
|
||||||
|
|
||||||
lib/sha1: use proper WORDS_BIGENDIAN macro
|
|
||||||
|
|
||||||
The original code uses BYTE_ORDER, but we use WORDS_BIGENDIAN in
|
|
||||||
utl-linux.
|
|
||||||
|
|
||||||
Reported-by: Andreas Schwab <schwab@linux-m68k.org>
|
|
||||||
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|
||||||
|
|
||||||
--- util-linux-2.31.1/lib/sha1.c 2017-12-19 13:52:18.459949048 +0100
|
|
||||||
+++ util-linux-2.31.1/lib/sha1.c 2018-01-26 17:51:47.456559746 +0100
|
|
||||||
@@ -1,43 +1,31 @@
|
|
||||||
/*
|
|
||||||
-SHA-1 in C
|
|
||||||
-By Steve Reid <steve@edmweb.com>
|
|
||||||
-100% Public Domain
|
|
||||||
-
|
|
||||||
-Test Vectors (from FIPS PUB 180-1)
|
|
||||||
-"abc"
|
|
||||||
- A9993E36 4706816A BA3E2571 7850C26C 9CD0D89D
|
|
||||||
-"abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq"
|
|
||||||
- 84983E44 1C3BD26E BAAE4AA1 F95129E5 E54670F1
|
|
||||||
-A million repetitions of "a"
|
|
||||||
- 34AA973C D4C4DAA4 F61EEB2B DBAD2731 6534016F
|
|
||||||
-*/
|
|
||||||
+ * SHA-1 in C by Steve Reid <steve@edmweb.com>
|
|
||||||
+ * 100% Public Domain
|
|
||||||
+ *
|
|
||||||
+ * Test Vectors (from FIPS PUB 180-1)
|
|
||||||
+ * 1) "abc": A9993E36 4706816A BA3E2571 7850C26C 9CD0D89D
|
|
||||||
+ * 2) "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq": 84983E44 1C3BD26E BAAE4AA1 F95129E5 E54670F1
|
|
||||||
+ * 3) A million repetitions of "a": 34AA973C D4C4DAA4 F61EEB2B DBAD2731 6534016F
|
|
||||||
+ */
|
|
||||||
|
|
||||||
-/* #define LITTLE_ENDIAN * This should be #define'd already, if true. */
|
|
||||||
-/* #define SHA1HANDSOFF * Copies data before messing with it. */
|
|
||||||
-
|
|
||||||
-#define SHA1HANDSOFF
|
|
||||||
+#define UL_SHA1HANDSOFF
|
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <string.h>
|
|
||||||
-
|
|
||||||
-/* for uint32_t */
|
|
||||||
#include <stdint.h>
|
|
||||||
|
|
||||||
#include "sha1.h"
|
|
||||||
|
|
||||||
-
|
|
||||||
#define rol(value, bits) (((value) << (bits)) | ((value) >> (32 - (bits))))
|
|
||||||
|
|
||||||
/* blk0() and blk() perform the initial expand. */
|
|
||||||
-/* I got the idea of expanding during the round function from SSLeay */
|
|
||||||
-#if BYTE_ORDER == LITTLE_ENDIAN
|
|
||||||
-#define blk0(i) (block->l[i] = (rol(block->l[i],24)&0xFF00FF00) \
|
|
||||||
- |(rol(block->l[i],8)&0x00FF00FF))
|
|
||||||
-#elif BYTE_ORDER == BIG_ENDIAN
|
|
||||||
-#define blk0(i) block->l[i]
|
|
||||||
+#ifdef WORDS_BIGENDIAN
|
|
||||||
+# define blk0(i) block->l[i]
|
|
||||||
#else
|
|
||||||
-#error "Endianness not defined!"
|
|
||||||
+# define blk0(i) (block->l[i] = (rol(block->l[i],24)&0xFF00FF00) \
|
|
||||||
+ |(rol(block->l[i],8)&0x00FF00FF))
|
|
||||||
#endif
|
|
||||||
+
|
|
||||||
#define blk(i) (block->l[i&15] = rol(block->l[(i+13)&15]^block->l[(i+8)&15] \
|
|
||||||
^block->l[(i+2)&15]^block->l[i&15],1))
|
|
||||||
|
|
||||||
@@ -48,249 +36,221 @@
|
|
||||||
#define R3(v,w,x,y,z,i) z+=(((w|x)&y)|(w&x))+blk(i)+0x8F1BBCDC+rol(v,5);w=rol(w,30);
|
|
||||||
#define R4(v,w,x,y,z,i) z+=(w^x^y)+blk(i)+0xCA62C1D6+rol(v,5);w=rol(w,30);
|
|
||||||
|
|
||||||
-
|
|
||||||
/* Hash a single 512-bit block. This is the core of the algorithm. */
|
|
||||||
|
|
||||||
-void ul_SHA1Transform(
|
|
||||||
- uint32_t state[5],
|
|
||||||
- const unsigned char buffer[64]
|
|
||||||
-)
|
|
||||||
+void ul_SHA1Transform(uint32_t state[5], const unsigned char buffer[64])
|
|
||||||
{
|
|
||||||
- uint32_t a, b, c, d, e;
|
|
||||||
+ uint32_t a, b, c, d, e;
|
|
||||||
|
|
||||||
- typedef union
|
|
||||||
- {
|
|
||||||
- unsigned char c[64];
|
|
||||||
- uint32_t l[16];
|
|
||||||
- } CHAR64LONG16;
|
|
||||||
+ typedef union {
|
|
||||||
+ unsigned char c[64];
|
|
||||||
+ uint32_t l[16];
|
|
||||||
+ } CHAR64LONG16;
|
|
||||||
|
|
||||||
-#ifdef SHA1HANDSOFF
|
|
||||||
- CHAR64LONG16 block[1]; /* use array to appear as a pointer */
|
|
||||||
+#ifdef UL_SHA1HANDSOFF
|
|
||||||
+ CHAR64LONG16 block[1]; /* use array to appear as a pointer */
|
|
||||||
|
|
||||||
- memcpy(block, buffer, 64);
|
|
||||||
+ memcpy(block, buffer, 64);
|
|
||||||
#else
|
|
||||||
- /* The following had better never be used because it causes the
|
|
||||||
- * pointer-to-const buffer to be cast into a pointer to non-const.
|
|
||||||
- * And the result is written through. I threw a "const" in, hoping
|
|
||||||
- * this will cause a diagnostic.
|
|
||||||
- */
|
|
||||||
- CHAR64LONG16 *block = (const CHAR64LONG16 *) buffer;
|
|
||||||
+ /* The following had better never be used because it causes the
|
|
||||||
+ * pointer-to-const buffer to be cast into a pointer to non-const.
|
|
||||||
+ * And the result is written through. I threw a "const" in, hoping
|
|
||||||
+ * this will cause a diagnostic.
|
|
||||||
+ */
|
|
||||||
+ CHAR64LONG16 *block = (const CHAR64LONG16 *)buffer;
|
|
||||||
#endif
|
|
||||||
- /* Copy context->state[] to working vars */
|
|
||||||
- a = state[0];
|
|
||||||
- b = state[1];
|
|
||||||
- c = state[2];
|
|
||||||
- d = state[3];
|
|
||||||
- e = state[4];
|
|
||||||
- /* 4 rounds of 20 operations each. Loop unrolled. */
|
|
||||||
- R0(a, b, c, d, e, 0);
|
|
||||||
- R0(e, a, b, c, d, 1);
|
|
||||||
- R0(d, e, a, b, c, 2);
|
|
||||||
- R0(c, d, e, a, b, 3);
|
|
||||||
- R0(b, c, d, e, a, 4);
|
|
||||||
- R0(a, b, c, d, e, 5);
|
|
||||||
- R0(e, a, b, c, d, 6);
|
|
||||||
- R0(d, e, a, b, c, 7);
|
|
||||||
- R0(c, d, e, a, b, 8);
|
|
||||||
- R0(b, c, d, e, a, 9);
|
|
||||||
- R0(a, b, c, d, e, 10);
|
|
||||||
- R0(e, a, b, c, d, 11);
|
|
||||||
- R0(d, e, a, b, c, 12);
|
|
||||||
- R0(c, d, e, a, b, 13);
|
|
||||||
- R0(b, c, d, e, a, 14);
|
|
||||||
- R0(a, b, c, d, e, 15);
|
|
||||||
- R1(e, a, b, c, d, 16);
|
|
||||||
- R1(d, e, a, b, c, 17);
|
|
||||||
- R1(c, d, e, a, b, 18);
|
|
||||||
- R1(b, c, d, e, a, 19);
|
|
||||||
- R2(a, b, c, d, e, 20);
|
|
||||||
- R2(e, a, b, c, d, 21);
|
|
||||||
- R2(d, e, a, b, c, 22);
|
|
||||||
- R2(c, d, e, a, b, 23);
|
|
||||||
- R2(b, c, d, e, a, 24);
|
|
||||||
- R2(a, b, c, d, e, 25);
|
|
||||||
- R2(e, a, b, c, d, 26);
|
|
||||||
- R2(d, e, a, b, c, 27);
|
|
||||||
- R2(c, d, e, a, b, 28);
|
|
||||||
- R2(b, c, d, e, a, 29);
|
|
||||||
- R2(a, b, c, d, e, 30);
|
|
||||||
- R2(e, a, b, c, d, 31);
|
|
||||||
- R2(d, e, a, b, c, 32);
|
|
||||||
- R2(c, d, e, a, b, 33);
|
|
||||||
- R2(b, c, d, e, a, 34);
|
|
||||||
- R2(a, b, c, d, e, 35);
|
|
||||||
- R2(e, a, b, c, d, 36);
|
|
||||||
- R2(d, e, a, b, c, 37);
|
|
||||||
- R2(c, d, e, a, b, 38);
|
|
||||||
- R2(b, c, d, e, a, 39);
|
|
||||||
- R3(a, b, c, d, e, 40);
|
|
||||||
- R3(e, a, b, c, d, 41);
|
|
||||||
- R3(d, e, a, b, c, 42);
|
|
||||||
- R3(c, d, e, a, b, 43);
|
|
||||||
- R3(b, c, d, e, a, 44);
|
|
||||||
- R3(a, b, c, d, e, 45);
|
|
||||||
- R3(e, a, b, c, d, 46);
|
|
||||||
- R3(d, e, a, b, c, 47);
|
|
||||||
- R3(c, d, e, a, b, 48);
|
|
||||||
- R3(b, c, d, e, a, 49);
|
|
||||||
- R3(a, b, c, d, e, 50);
|
|
||||||
- R3(e, a, b, c, d, 51);
|
|
||||||
- R3(d, e, a, b, c, 52);
|
|
||||||
- R3(c, d, e, a, b, 53);
|
|
||||||
- R3(b, c, d, e, a, 54);
|
|
||||||
- R3(a, b, c, d, e, 55);
|
|
||||||
- R3(e, a, b, c, d, 56);
|
|
||||||
- R3(d, e, a, b, c, 57);
|
|
||||||
- R3(c, d, e, a, b, 58);
|
|
||||||
- R3(b, c, d, e, a, 59);
|
|
||||||
- R4(a, b, c, d, e, 60);
|
|
||||||
- R4(e, a, b, c, d, 61);
|
|
||||||
- R4(d, e, a, b, c, 62);
|
|
||||||
- R4(c, d, e, a, b, 63);
|
|
||||||
- R4(b, c, d, e, a, 64);
|
|
||||||
- R4(a, b, c, d, e, 65);
|
|
||||||
- R4(e, a, b, c, d, 66);
|
|
||||||
- R4(d, e, a, b, c, 67);
|
|
||||||
- R4(c, d, e, a, b, 68);
|
|
||||||
- R4(b, c, d, e, a, 69);
|
|
||||||
- R4(a, b, c, d, e, 70);
|
|
||||||
- R4(e, a, b, c, d, 71);
|
|
||||||
- R4(d, e, a, b, c, 72);
|
|
||||||
- R4(c, d, e, a, b, 73);
|
|
||||||
- R4(b, c, d, e, a, 74);
|
|
||||||
- R4(a, b, c, d, e, 75);
|
|
||||||
- R4(e, a, b, c, d, 76);
|
|
||||||
- R4(d, e, a, b, c, 77);
|
|
||||||
- R4(c, d, e, a, b, 78);
|
|
||||||
- R4(b, c, d, e, a, 79);
|
|
||||||
- /* Add the working vars back into context.state[] */
|
|
||||||
- state[0] += a;
|
|
||||||
- state[1] += b;
|
|
||||||
- state[2] += c;
|
|
||||||
- state[3] += d;
|
|
||||||
- state[4] += e;
|
|
||||||
- /* Wipe variables */
|
|
||||||
- a = b = c = d = e = 0;
|
|
||||||
-#ifdef SHA1HANDSOFF
|
|
||||||
- memset(block, '\0', sizeof(block));
|
|
||||||
+ /* Copy context->state[] to working vars */
|
|
||||||
+ a = state[0];
|
|
||||||
+ b = state[1];
|
|
||||||
+ c = state[2];
|
|
||||||
+ d = state[3];
|
|
||||||
+ e = state[4];
|
|
||||||
+ /* 4 rounds of 20 operations each. Loop unrolled. */
|
|
||||||
+ R0(a, b, c, d, e, 0);
|
|
||||||
+ R0(e, a, b, c, d, 1);
|
|
||||||
+ R0(d, e, a, b, c, 2);
|
|
||||||
+ R0(c, d, e, a, b, 3);
|
|
||||||
+ R0(b, c, d, e, a, 4);
|
|
||||||
+ R0(a, b, c, d, e, 5);
|
|
||||||
+ R0(e, a, b, c, d, 6);
|
|
||||||
+ R0(d, e, a, b, c, 7);
|
|
||||||
+ R0(c, d, e, a, b, 8);
|
|
||||||
+ R0(b, c, d, e, a, 9);
|
|
||||||
+ R0(a, b, c, d, e, 10);
|
|
||||||
+ R0(e, a, b, c, d, 11);
|
|
||||||
+ R0(d, e, a, b, c, 12);
|
|
||||||
+ R0(c, d, e, a, b, 13);
|
|
||||||
+ R0(b, c, d, e, a, 14);
|
|
||||||
+ R0(a, b, c, d, e, 15);
|
|
||||||
+ R1(e, a, b, c, d, 16);
|
|
||||||
+ R1(d, e, a, b, c, 17);
|
|
||||||
+ R1(c, d, e, a, b, 18);
|
|
||||||
+ R1(b, c, d, e, a, 19);
|
|
||||||
+ R2(a, b, c, d, e, 20);
|
|
||||||
+ R2(e, a, b, c, d, 21);
|
|
||||||
+ R2(d, e, a, b, c, 22);
|
|
||||||
+ R2(c, d, e, a, b, 23);
|
|
||||||
+ R2(b, c, d, e, a, 24);
|
|
||||||
+ R2(a, b, c, d, e, 25);
|
|
||||||
+ R2(e, a, b, c, d, 26);
|
|
||||||
+ R2(d, e, a, b, c, 27);
|
|
||||||
+ R2(c, d, e, a, b, 28);
|
|
||||||
+ R2(b, c, d, e, a, 29);
|
|
||||||
+ R2(a, b, c, d, e, 30);
|
|
||||||
+ R2(e, a, b, c, d, 31);
|
|
||||||
+ R2(d, e, a, b, c, 32);
|
|
||||||
+ R2(c, d, e, a, b, 33);
|
|
||||||
+ R2(b, c, d, e, a, 34);
|
|
||||||
+ R2(a, b, c, d, e, 35);
|
|
||||||
+ R2(e, a, b, c, d, 36);
|
|
||||||
+ R2(d, e, a, b, c, 37);
|
|
||||||
+ R2(c, d, e, a, b, 38);
|
|
||||||
+ R2(b, c, d, e, a, 39);
|
|
||||||
+ R3(a, b, c, d, e, 40);
|
|
||||||
+ R3(e, a, b, c, d, 41);
|
|
||||||
+ R3(d, e, a, b, c, 42);
|
|
||||||
+ R3(c, d, e, a, b, 43);
|
|
||||||
+ R3(b, c, d, e, a, 44);
|
|
||||||
+ R3(a, b, c, d, e, 45);
|
|
||||||
+ R3(e, a, b, c, d, 46);
|
|
||||||
+ R3(d, e, a, b, c, 47);
|
|
||||||
+ R3(c, d, e, a, b, 48);
|
|
||||||
+ R3(b, c, d, e, a, 49);
|
|
||||||
+ R3(a, b, c, d, e, 50);
|
|
||||||
+ R3(e, a, b, c, d, 51);
|
|
||||||
+ R3(d, e, a, b, c, 52);
|
|
||||||
+ R3(c, d, e, a, b, 53);
|
|
||||||
+ R3(b, c, d, e, a, 54);
|
|
||||||
+ R3(a, b, c, d, e, 55);
|
|
||||||
+ R3(e, a, b, c, d, 56);
|
|
||||||
+ R3(d, e, a, b, c, 57);
|
|
||||||
+ R3(c, d, e, a, b, 58);
|
|
||||||
+ R3(b, c, d, e, a, 59);
|
|
||||||
+ R4(a, b, c, d, e, 60);
|
|
||||||
+ R4(e, a, b, c, d, 61);
|
|
||||||
+ R4(d, e, a, b, c, 62);
|
|
||||||
+ R4(c, d, e, a, b, 63);
|
|
||||||
+ R4(b, c, d, e, a, 64);
|
|
||||||
+ R4(a, b, c, d, e, 65);
|
|
||||||
+ R4(e, a, b, c, d, 66);
|
|
||||||
+ R4(d, e, a, b, c, 67);
|
|
||||||
+ R4(c, d, e, a, b, 68);
|
|
||||||
+ R4(b, c, d, e, a, 69);
|
|
||||||
+ R4(a, b, c, d, e, 70);
|
|
||||||
+ R4(e, a, b, c, d, 71);
|
|
||||||
+ R4(d, e, a, b, c, 72);
|
|
||||||
+ R4(c, d, e, a, b, 73);
|
|
||||||
+ R4(b, c, d, e, a, 74);
|
|
||||||
+ R4(a, b, c, d, e, 75);
|
|
||||||
+ R4(e, a, b, c, d, 76);
|
|
||||||
+ R4(d, e, a, b, c, 77);
|
|
||||||
+ R4(c, d, e, a, b, 78);
|
|
||||||
+ R4(b, c, d, e, a, 79);
|
|
||||||
+ /* Add the working vars back into context.state[] */
|
|
||||||
+ state[0] += a;
|
|
||||||
+ state[1] += b;
|
|
||||||
+ state[2] += c;
|
|
||||||
+ state[3] += d;
|
|
||||||
+ state[4] += e;
|
|
||||||
+ /* Wipe variables */
|
|
||||||
+ a = b = c = d = e = 0;
|
|
||||||
+#ifdef UL_SHA1HANDSOFF
|
|
||||||
+ memset(block, '\0', sizeof(block));
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
-
|
|
||||||
/* SHA1Init - Initialize new context */
|
|
||||||
|
|
||||||
-void ul_SHA1Init(
|
|
||||||
- UL_SHA1_CTX * context
|
|
||||||
-)
|
|
||||||
+void ul_SHA1Init(UL_SHA1_CTX *context)
|
|
||||||
{
|
|
||||||
- /* SHA1 initialization constants */
|
|
||||||
- context->state[0] = 0x67452301;
|
|
||||||
- context->state[1] = 0xEFCDAB89;
|
|
||||||
- context->state[2] = 0x98BADCFE;
|
|
||||||
- context->state[3] = 0x10325476;
|
|
||||||
- context->state[4] = 0xC3D2E1F0;
|
|
||||||
- context->count[0] = context->count[1] = 0;
|
|
||||||
+ /* SHA1 initialization constants */
|
|
||||||
+ context->state[0] = 0x67452301;
|
|
||||||
+ context->state[1] = 0xEFCDAB89;
|
|
||||||
+ context->state[2] = 0x98BADCFE;
|
|
||||||
+ context->state[3] = 0x10325476;
|
|
||||||
+ context->state[4] = 0xC3D2E1F0;
|
|
||||||
+ context->count[0] = context->count[1] = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
-
|
|
||||||
/* Run your data through this. */
|
|
||||||
|
|
||||||
-void ul_SHA1Update(
|
|
||||||
- UL_SHA1_CTX * context,
|
|
||||||
- const unsigned char *data,
|
|
||||||
- uint32_t len
|
|
||||||
-)
|
|
||||||
+void ul_SHA1Update(UL_SHA1_CTX *context, const unsigned char *data, uint32_t len)
|
|
||||||
{
|
|
||||||
- uint32_t i;
|
|
||||||
+ uint32_t i;
|
|
||||||
|
|
||||||
- uint32_t j;
|
|
||||||
+ uint32_t j;
|
|
||||||
|
|
||||||
- j = context->count[0];
|
|
||||||
- if ((context->count[0] += len << 3) < j)
|
|
||||||
- context->count[1]++;
|
|
||||||
- context->count[1] += (len >> 29);
|
|
||||||
- j = (j >> 3) & 63;
|
|
||||||
- if ((j + len) > 63)
|
|
||||||
- {
|
|
||||||
- memcpy(&context->buffer[j], data, (i = 64 - j));
|
|
||||||
- ul_SHA1Transform(context->state, context->buffer);
|
|
||||||
- for (; i + 63 < len; i += 64)
|
|
||||||
- {
|
|
||||||
- ul_SHA1Transform(context->state, &data[i]);
|
|
||||||
- }
|
|
||||||
- j = 0;
|
|
||||||
- }
|
|
||||||
- else
|
|
||||||
- i = 0;
|
|
||||||
- memcpy(&context->buffer[j], &data[i], len - i);
|
|
||||||
+ j = context->count[0];
|
|
||||||
+ if ((context->count[0] += len << 3) < j)
|
|
||||||
+ context->count[1]++;
|
|
||||||
+ context->count[1] += (len >> 29);
|
|
||||||
+ j = (j >> 3) & 63;
|
|
||||||
+ if ((j + len) > 63) {
|
|
||||||
+ memcpy(&context->buffer[j], data, (i = 64 - j));
|
|
||||||
+ ul_SHA1Transform(context->state, context->buffer);
|
|
||||||
+ for (; i + 63 < len; i += 64) {
|
|
||||||
+ ul_SHA1Transform(context->state, &data[i]);
|
|
||||||
+ }
|
|
||||||
+ j = 0;
|
|
||||||
+ } else
|
|
||||||
+ i = 0;
|
|
||||||
+ memcpy(&context->buffer[j], &data[i], len - i);
|
|
||||||
}
|
|
||||||
|
|
||||||
-
|
|
||||||
/* Add padding and return the message digest. */
|
|
||||||
|
|
||||||
-void ul_SHA1Final(
|
|
||||||
- unsigned char digest[20],
|
|
||||||
- UL_SHA1_CTX * context
|
|
||||||
-)
|
|
||||||
+void ul_SHA1Final(unsigned char digest[20], UL_SHA1_CTX *context)
|
|
||||||
{
|
|
||||||
- unsigned i;
|
|
||||||
+ unsigned i;
|
|
||||||
|
|
||||||
- unsigned char finalcount[8];
|
|
||||||
+ unsigned char finalcount[8];
|
|
||||||
|
|
||||||
- unsigned char c;
|
|
||||||
+ unsigned char c;
|
|
||||||
|
|
||||||
-#if 0 /* untested "improvement" by DHR */
|
|
||||||
- /* Convert context->count to a sequence of bytes
|
|
||||||
- * in finalcount. Second element first, but
|
|
||||||
- * big-endian order within element.
|
|
||||||
- * But we do it all backwards.
|
|
||||||
- */
|
|
||||||
- unsigned char *fcp = &finalcount[8];
|
|
||||||
+#if 0 /* untested "improvement" by DHR */
|
|
||||||
+ /* Convert context->count to a sequence of bytes
|
|
||||||
+ * in finalcount. Second element first, but
|
|
||||||
+ * big-endian order within element.
|
|
||||||
+ * But we do it all backwards.
|
|
||||||
+ */
|
|
||||||
+ unsigned char *fcp = &finalcount[8];
|
|
||||||
|
|
||||||
- for (i = 0; i < 2; i++)
|
|
||||||
- {
|
|
||||||
- uint32_t t = context->count[i];
|
|
||||||
+ for (i = 0; i < 2; i++) {
|
|
||||||
+ uint32_t t = context->count[i];
|
|
||||||
|
|
||||||
- int j;
|
|
||||||
+ int j;
|
|
||||||
|
|
||||||
- for (j = 0; j < 4; t >>= 8, j++)
|
|
||||||
- *--fcp = (unsigned char) t}
|
|
||||||
+ for (j = 0; j < 4; t >>= 8, j++)
|
|
||||||
+ *--fcp = (unsigned char)t}
|
|
||||||
#else
|
|
||||||
- for (i = 0; i < 8; i++)
|
|
||||||
- {
|
|
||||||
- finalcount[i] = (unsigned char) ((context->count[(i >= 4 ? 0 : 1)] >> ((3 - (i & 3)) * 8)) & 255); /* Endian independent */
|
|
||||||
- }
|
|
||||||
+ for (i = 0; i < 8; i++) {
|
|
||||||
+ finalcount[i] = (unsigned char)((context->count[(i >= 4 ? 0 : 1)] >> ((3 - (i & 3)) * 8)) & 255); /* Endian independent */
|
|
||||||
+ }
|
|
||||||
#endif
|
|
||||||
- c = 0200;
|
|
||||||
- ul_SHA1Update(context, &c, 1);
|
|
||||||
- while ((context->count[0] & 504) != 448)
|
|
||||||
- {
|
|
||||||
- c = 0000;
|
|
||||||
- ul_SHA1Update(context, &c, 1);
|
|
||||||
- }
|
|
||||||
- ul_SHA1Update(context, finalcount, 8); /* Should cause a SHA1Transform() */
|
|
||||||
- for (i = 0; i < 20; i++)
|
|
||||||
- {
|
|
||||||
- digest[i] = (unsigned char)
|
|
||||||
- ((context->state[i >> 2] >> ((3 - (i & 3)) * 8)) & 255);
|
|
||||||
- }
|
|
||||||
- /* Wipe variables */
|
|
||||||
- memset(context, '\0', sizeof(*context));
|
|
||||||
- memset(&finalcount, '\0', sizeof(finalcount));
|
|
||||||
+ c = 0200;
|
|
||||||
+ ul_SHA1Update(context, &c, 1);
|
|
||||||
+ while ((context->count[0] & 504) != 448) {
|
|
||||||
+ c = 0000;
|
|
||||||
+ ul_SHA1Update(context, &c, 1);
|
|
||||||
+ }
|
|
||||||
+ ul_SHA1Update(context, finalcount, 8); /* Should cause a SHA1Transform() */
|
|
||||||
+ for (i = 0; i < 20; i++) {
|
|
||||||
+ digest[i] = (unsigned char)
|
|
||||||
+ ((context->state[i >> 2] >> ((3 - (i & 3)) * 8)) & 255);
|
|
||||||
+ }
|
|
||||||
+ /* Wipe variables */
|
|
||||||
+ memset(context, '\0', sizeof(*context));
|
|
||||||
+ memset(&finalcount, '\0', sizeof(finalcount));
|
|
||||||
}
|
|
||||||
|
|
||||||
-void ul_SHA1(
|
|
||||||
- char *hash_out,
|
|
||||||
- const char *str,
|
|
||||||
- unsigned len)
|
|
||||||
+void ul_SHA1(char *hash_out, const char *str, unsigned len)
|
|
||||||
{
|
|
||||||
- UL_SHA1_CTX ctx;
|
|
||||||
- unsigned int ii;
|
|
||||||
+ UL_SHA1_CTX ctx;
|
|
||||||
+ unsigned int ii;
|
|
||||||
|
|
||||||
- ul_SHA1Init(&ctx);
|
|
||||||
- for (ii=0; ii<len; ii+=1)
|
|
||||||
- ul_SHA1Update(&ctx, (const unsigned char*)str + ii, 1);
|
|
||||||
- ul_SHA1Final((unsigned char *)hash_out, &ctx);
|
|
||||||
- hash_out[20] = '\0';
|
|
||||||
+ ul_SHA1Init(&ctx);
|
|
||||||
+ for (ii = 0; ii < len; ii += 1)
|
|
||||||
+ ul_SHA1Update(&ctx, (const unsigned char *)str + ii, 1);
|
|
||||||
+ ul_SHA1Final((unsigned char *)hash_out, &ctx);
|
|
||||||
+ hash_out[20] = '\0';
|
|
||||||
}
|
|
||||||
-
|
|
Loading…
Reference in New Issue
Block a user