Commit Graph

15606 Commits

Author SHA1 Message Date
Huang Shijie 4cae2104ec lscpu: add bios_family
In the arm platform, we do not have the "CPU family" as X86.
In the linux kernel, it is hardcode to set the "CPU architecuture:8"
which should be changed for arm v9 in future.

This patch adds "bios_family" field, which we can get from the DMI table.
In the ampere Altra platform, we can get the new lscpu output:
    ----------------------------------------------------------------
	Architecture:                    aarch64
	CPU op-mode(s):                  32-bit, 64-bit
	Byte Order:                      Little Endian
	CPU(s):                          160
	On-line CPU(s) list:             0-159
	Vendor ID:                       ARM
	BIOS Vendor ID:                  Ampere(R)
	Model name:                      Neoverse-N1
	BIOS Model name:                 Ampere(R) Altra(R) Processor Q00-00 CPU @ 3.0GHz
	BIOS CPU family:                 257
	Model:                           1
	Thread(s) per core:              1
    ----------------------------------------------------------------

[kzak@redhat.com: - s/sprintf/snprintf/]

Signed-off-by: Huang Shijie <shijie@os.amperecomputing.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-06-16 11:12:14 +02:00
Huang Shijie a772d7c493 lscpu: get the processor information by DMI
The patch :367c85c47286 ("lscpu: use SMBIOS tables on ARM for lscpu")
relies on the existence of "/sys/firmware/dmi/entries/4-0/raw",
which may not exist in standard linux kernel.

But "/sys/firmware/dmi/tables/DMI" should exist and can provide the required
processor information.

This patch uses "/sys/firmware/dmi/tables/DMI"
to get the processor information:

Before this patch, in Ampere Altra platform, the lscpu output is:
   ---------------------------------------------
	Architecture:                    aarch64
	CPU op-mode(s):                  32-bit, 64-bit
	Byte Order:                      Little Endian
	CPU(s):                          160
	On-line CPU(s) list:             0-159
	Vendor ID:                       ARM
	Model name:                      Neoverse-N1
	Model:                           1
	Thread(s) per core:              1
	Core(s) per socket:              80
	Socket(s):                       2
    ........................................
   ---------------------------------------------

After this patch, we can use get the lscpu output
in Ampere Altra platform:
   ---------------------------------------------
	Architecture:                    aarch64
	CPU op-mode(s):                  32-bit, 64-bit
	Byte Order:                      Little Endian
	CPU(s):                          160
	On-line CPU(s) list:             0-159
	Vendor ID:                       ARM
	BIOS Vendor ID:                  Ampere(R)
	Model name:                      Neoverse-N1
	BIOS Model name:                 Ampere(R) Altra(R) Processor Q00-00 CPU @ 3.0GHz
	Model:                           1
	Thread(s) per core:              1
	Core(s) per socket:              80
	Socket(s):                       2
    ........................................
   ---------------------------------------------

[kzak@redhat.com: - s/sprintf/snprintf/]

Signed-off-by: Huang Shijie <shijie@os.amperecomputing.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-06-16 11:09:19 +02:00
Karel Zak 66e259c746 libblkid: fix and cleanup blkid_safe_string()
* Don't use 'size_t len' variable for utf8_encoded_valid_unichar()
  return code as it returns negative numbers on invalid utf8 sequence.

* Don't rely only on \0, but check the current position against output
  buffer size.

* Accept hex encoding like the original version.

* Use else-if to avoid unnecessary 'continue'.

Signed-off-by: Karel Zak <kzak@redhat.com>
2021-06-16 10:58:11 +02:00
Karel Zak 8a3a74160b mkswap: fix holes detection (infinite loop and/or stack-buffer-underflow)
Reported-by: Brian Lane <bcl@redhat.com>
Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1971877
Fix: https://github.com/karelzak/util-linux/issues/1348
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-06-15 12:07:34 +02:00
Karel Zak 3e03cb6806 lib/loopdev: perform retry on EAGAIN
Suggested-by: Ingo Franzki <ifranzki@linux.ibm.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-06-15 10:34:46 +02:00
Karel Zak 6db3685989 libblkid: Optimize the blkid_safe_string() function
Processing whitespace characters. Allows valid ASCII, valid UTF-8.
Replace everything else with '_'

Co-Author: changlianzhi <changlianzhi@uniontech.com>
Signed-off-by: changlianzhi <changlianzhi@uniontech.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-06-15 10:25:24 +02:00
Karel Zak f3e5d34cac lib/strutils: make test_strutils_normalize() more robust
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-06-15 10:25:06 +02:00
Karel Zak c862d0e177 lib/strutils: improve normalize_whitespace()
Let's make it possible to use the function to normalize the string
between two buffers (from source to destination).

Signed-off-by: Karel Zak <kzak@redhat.com>
2021-06-14 16:24:59 +02:00
Karel Zak 38b9be784b Merge branch 'document-selinux-nosuid' of https://github.com/topimiettinen/util-linux
* 'document-selinux-nosuid' of https://github.com/topimiettinen/util-linux:
  mount.8.adoc: document SELinux use of nosuid mount flag
2021-06-14 12:48:08 +02:00
Topi Miettinen 9a06cc233c
mount.8.adoc: document SELinux use of nosuid mount flag
Using mount flag `nosuid` also affects SELinux domain transitions but
this has not been documented well.

Signed-off-by: Topi Miettinen <toiwoton@gmail.com>
2021-06-12 11:37:51 +03:00
Platon Pronko 8153ca8eee dmesg: fix indentation in man page
Double-semicolon at the end of the option line results in description
being indented extra tab to the right. Replacing them with double-colons
allows all options to be displayed at the same indent level.
2021-06-11 21:23:59 +03:00
Karel Zak 1e881378d6 lib/path: fix possible leak when use ul_path_read_string() [coverity scan]
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-06-11 15:43:36 +02:00
Karel Zak 3fdb178370 hwclock: close adjtime on write error [coverity scan]
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-06-11 15:17:42 +02:00
Karel Zak 777fe9f512 newgrp: fix memory leak [coverity scan]
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-06-11 15:10:22 +02:00
Karel Zak fb9ed3b409 dmesg: fix possible memory leak [coverity scan]
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-06-10 13:44:25 +02:00
Karel Zak a71f7f1173 findmnt: (verify) fix memory leak [asan]
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-06-10 13:35:05 +02:00
Karel Zak 3c3f7722ae findmnt: (verify) fix cache related memory leaks on --nocanonicalize [coverity scan]
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-06-10 13:28:35 +02:00
Karel Zak 60d1f1a329 libblkid: check for ioctl macro rather than for header file
libblkid/src/probe.c:1012:22: error: ‘BLKGETZONESZ’ undeclared (first use in this function)
 1012 |   if (!ioctl(pr->fd, BLKGETZONESZ, &zone_size_sector))
      |                      ^~~~~~~~~~~~

Signed-off-by: Karel Zak <kzak@redhat.com>
2021-06-09 16:12:13 +02:00
Karel Zak 366063645f build-sys: make autogen.sh output more user friendly
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-06-09 16:09:16 +02:00
Karel Zak 67735475db build-sys: be verbose about missing gettext
Reported-by: Qais Yousef <qais.yousef@arm.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-06-09 15:54:09 +02:00
Karel Zak 98a586f672 lsblk: sort list of columns
It's better to maintain sorted list and it's also better for --help output.

Signed-off-by: Karel Zak <kzak@redhat.com>
2021-06-09 11:09:33 +02:00
Karel Zak 856457bfcf lsblk: add column START for partition start offsets
Fix: https://github.com/karelzak/util-linux/issues/1340
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-06-09 10:57:54 +02:00
John Baublitz 0842c84218 libblkid: Add hyphens to UUID string representation in Stratis superblock parsing
[kzak@redhat.com: - small code cleanup]

Signed-off-by: Karel Zak <kzak@redhat.com>
2021-06-09 10:40:31 +02:00
Karel Zak 20cc7d100a Merge branch 'fix-display-signed-char' of https://github.com/Ram-Z/util-linux
* 'fix-display-signed-char' of https://github.com/Ram-Z/util-linux:
  hexdump: correctly display signed single byte integers
2021-06-09 10:32:23 +02:00
Samir Benmendil aa6d42f16f hexdump: correctly display signed single byte integers
When using the format string '/1 "%d"', the byte did not display as a
signed integer as expected, it was interpreted as unsigned.
2021-06-09 01:21:46 +01:00
ratijas 3f347f956a
lsblk: fix formatting in -e option 2021-06-08 19:12:19 +03:00
Qais Yousef 6da826a521 uclampset: Fix left over optind++
The code was changed to use ':' in getopt_long() but these were left
over by mistake causing weird random errors when using these options
depending on the order they were fed.

Signed-off-by: Qais Yousef <qais.yousef@arm.com>
2021-06-08 15:56:00 +02:00
Nicolai Dagestad 63e523a151 rfkill: Set scols table name to make the json output valid
[kzak@redhat.com: - s/rfkill/rfkilldevices/]

Fixes: https://github.com/karelzak/util-linux/issues/1339
Signed-off-by: Nicolai Dagestad <nicolai@dagestad.fr>
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-06-07 10:42:02 +02:00
Karel Zak 0d281926a3 libsmartcols: fix bare array on JSON output
The bare array ({[...]}) for top level list of entries is invalid. It
seems better to print empty string than nothing. This is workaround
for broken utils, better is to define a table name.

Addresses: https://github.com/karelzak/util-linux/issues/1339
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-06-07 10:32:20 +02:00
Karel Zak 1a30b2bd5e build-sys: make re-use of generated man-pages more robust
We need to ignore man-pages at all if not available (not generated
yet), but asciidoctor is not installed.

Fix: https://github.com/karelzak/util-linux/issues/1334
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-06-04 11:46:55 +02:00
Karel Zak 780f0f8183 Merge branch 'nortas' of https://github.com/gyakovlev/util-linux
* 'nortas' of https://github.com/gyakovlev/util-linux:
  lscpu: fix build on powerpc
2021-06-03 12:25:35 +02:00
Karel Zak daf9f2e997 build-sys: add generated man-pages to distribution tarball
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-06-03 12:17:27 +02:00
Georgy Yakovlev 45cd3aa4de
lscpu: fix build on powerpc
fails with error: label at end of compound statement
and fix typo as bonus.

Signed-off-by: Georgy Yakovlev <gyakovlev@gentoo.org>
2021-06-02 13:59:26 -07:00
Karel Zak 308a15c71c build-sys: add missing header
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-06-02 15:31:39 +02:00
Karel Zak 1775aaf1d7 lsblk: use ID_MODEL_ENC is possible
Fix: https://github.com/karelzak/util-linux/issues/1098
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-06-02 13:32:43 +02:00
Karel Zak 0e54ac3980 lscpu: remove extra blank lines
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-06-02 13:09:28 +02:00
Karel Zak 79884c5dd1 Merge branch 'lscpu-json-types' of https://github.com/t-8ch/util-linux
* 'lscpu-json-types' of https://github.com/t-8ch/util-linux:
  lscpu: use optional json values
  libsmartcols: add support for optional boolean values
  lscpu: use json types
2021-06-02 13:06:10 +02:00
Karel Zak ac55a4130f Merge branch 'next'
* next: (26 commits)
  build-sys: add script to compare config.h from meson and autotools
  meson: add missing header files check
  docs: update TODO
  tests: update lscpu outputs
  lscpu: read MHZ from /sys/.../cpufreq/scaling_cur_freq
  lscpu: use locale-independent strtod() when read from kernel
  lib/c_strtod; add locale independent strtod()
  tests: update lscpu output
  lscpu: use MHZ as number to be locale sensitive
  lscpu: add SCALMHZ% and "CPU scaling MHz:"
  sulogin: fix whitespace error
  sulogin: ignore none-existing console devices
  lsns: fix old error message
  lsns: fix copy & past in man page
  lsns: fill UID and USER columns for interpolated namespaces
  fixup! lsns: interpolate missing namespaces for converting forests to a tree
  lsns: interpolate missing namespaces for converting forests to a tree
  lsns: reorganize members specifying other namespaces in lsns_namespace
  lsns: make namespace having no process printable
  libblkid: support zone reset for wipefs
  ...
2021-06-02 12:33:07 +02:00
Karel Zak 902d216412 mount: use mnt_fs_is_regularfs()
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-06-02 12:19:06 +02:00
Karel Zak 868cd0dc0a fsck: use mnt_fs_is_regularfs()
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-06-02 12:16:14 +02:00
Karel Zak ac8697d606 libmount: add mnt_fs_is_regularfs() to public API
Fix: https://github.com/karelzak/util-linux/issues/1328
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-06-02 12:14:10 +02:00
Karel Zak 14ae6d5ae0 build-sys: fix {release-version} man pages
* define {release-version} as $VERSION

* do not use {docdir} in adoc; it's built-in ascidoctor variable
  https://docs.asciidoctor.org/asciidoc/latest/attributes/document-attributes-reference/#intrinsic-attributes

Addresses: https://github.com/karelzak/util-linux/issues/1327
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-06-02 11:55:44 +02:00
Karel Zak ab2eea4ac3 build-sys: install hardlink bash-completion
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-06-02 11:14:36 +02:00
Karel Zak d79a69c564 tools: allow to update specific files on kernel.org
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-06-01 11:45:16 +02:00
Karel Zak a057fdb13a docs: fix typo in v2.37-ReleaseNotes
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-06-01 10:37:01 +02:00
Karel Zak 635d382146 docs: add uclampset to AUTHORS file
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-06-01 10:32:35 +02:00
Karel Zak 50736e4998 build-sys: release++ (v2.37)
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-06-01 09:52:10 +02:00
Karel Zak 8a988dd855 docs: update v2.37-ReleaseNotes
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-06-01 09:46:40 +02:00
Karel Zak 17559f6cc2 docs: update AUTHORS file
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-06-01 09:45:03 +02:00
Karel Zak 59c19c3f3a po: merge changes
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-05-31 18:36:06 +02:00