Add functionality for generating autocompletion scripts,
allowing for tab completion of tool options for bash and zsh.
This functionality relies on reading the available options
from the util_opt struct at runtime.
The script generation happens on the build system.
Reviewed-by: Jan Höppner <hoeppner@linux.ibm.com>
Reviewed-by: Steffen Eiden <seiden@linux.ibm.com>
Signed-off-by: Szabina Korbai <szkorbai@linux.ibm.com>
Signed-off-by: Steffen Eiden <seiden@linux.ibm.com>
Build:
$ make -C libutil/util_log_example
* Every time a -V option is passed, the verbosity level increases and extra
messages are enabled.
Test:
$ ./libutil/util_log_example
# No output
$ ./libutil/util_log_example -V
ERROR: This is an ERROR message
$ ./libutil/util_log_example -VV
ERROR: This is an ERROR message
WARN: This is a WARN message
$ ./libutil/util_log_example -VVV
ERROR: This is an ERROR message
WARN: This is a WARN message
INFO: This is an INFO message
$ ./libutil/util_log_example -VVVV
ERROR: This is an ERROR message
WARN: This is a WARN message
INFO: This is an INFO message
DEBUG: This is a DEBUG message
$ ./libutil/util_log_example -VVVVV
ERROR: This is an ERROR message
WARN: This is a WARN message
INFO: This is an INFO message
DEBUG: This is a DEBUG message
TRACE: This is a TRACE message
Signed-off-by: Alexander Egorenkov <egorenar@linux.ibm.com>
Reviewed-by: Jan Hoeppner <hoeppner@linux.ibm.com>
Reviewed-by: Philipp Rudo <prudo@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
The goal of util_log is to provide a facility for a multi-level message
logging on stderr. This allows to selectively enable/disable log messages
via a log level which can be adjusted at runtime.
Signed-off-by: Alexander Egorenkov <egorenar@linux.ibm.com>
Reviewed-by: Jan Hoeppner <hoeppner@linux.ibm.com>
Reviewed-by: Philipp Rudo <prudo@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
Add the -fPIC option when building the libutil objects to generate
position-independent code, and allow them to be used in dynamically
loaded shared libraries.
Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com>
Acked-by: Jan Höppner <hoeppner@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
Many tools need to identify the device address of a given device. So
far, either the tool had its own implementation, or u2s_getbusid() was
used. Though, u2s_getbusid() was mainly designed for and used by the
DASD tools.
Introduce util_sys with a first function util_sys_get_dev_addr() which
provides a more universal way to identify the device address which is
not limited to one particular device type. The device address represents
either a busid (e.g. DASD), slot address (NVMe), H:C:T:L tuple (SCSI),
or other id types associated with a device.
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
Commit 851f685993 ("Makefile: Add dependency between libvmcp and
libutil to fix -j builds") introduced the following regression
$ make clean
CLEAN /home2/holzheu/src/s390-tools
...
CLEAN libccw
CC libutil/util_base.o
CC libutil/util_path.o
For the "clean" target the new library dependency triggers a build
of libutil.
So remove the dependency again.
To fix the parallel build issue, no longer build the examples with
"make all" and add a new target "examples" that can now be used for building
the example programs.
Fixes: 851f685993 ("Makefile: Add dependency between libvmcp and libutil to fix -j builds")
Signed-off-by: Michael Holzheu <holzheu@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
This patch
- moves function util_strstrip to libutil/util_libc.c and deletes the
extra files util_strstip.[ch]
- adds doxygen comments for util_strstrip()
- provides an example on how to use util_strstrip().
Signed-off-by: Thomas Richter <tmricht@linux.vnet.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
Function strstrip strips leading and trailung
spaces from a given string.
During review it was decided to move this function
to the libutil library to make it available for other tools.
Signed-off-by: Thomas Richter <tmricht@linux.vnet.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
When building libutil in parallel, it can happen that the archive
file is created twice:
$ cd libutil
$ make -j
...
CC libutil/util_rec_example.o
AR libutil/libutil.a
AR libutil/libutil.a
LINK libutil/util_base_example
This can lead to the following build error:
$ make -j OPT_FLAGS="-pipe"
..//libutil/libutil.a(util_path.o): In function `sys_mount_point':
util_path.c:56: undefined reference to `util_proc_mnt_get_entry'
util_path.c:60: undefined reference to `util_proc_mnt_free_entry'
collect2: error: ld returned 1 exit status
../common.mak:232: recipe for target 'util_path_example' failed
The problem is that the following rule from common.mak is triggered in
the libutil directory:
$(rootdir)/libutil/libutil.a: $(rootdir)/libutil
$(MAKE) -C $(rootdir)/libutil/ libutil.a
.PHONY: $(rootdir)/libutil
To prevent this rule, use the local "libutil.a" as dependency for the
example binaries.
Reported-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Michael Holzheu <holzheu@linux.vnet.ibm.com>
This commit is based on the s390-tools-1.39.0 version.
Changes on top of s390-tools-1.39.0:
- Add MIT license to all source files
- Add LICENSE file
- Transform REAMDE to README.md (markdown)
- Add AUTHORS.md file
- Add CONTRIBUTING.md file
- Move changelog from README to CHANGELOG.md file
Reviewed-by: Stefan Haberland <sth@linux.vnet.ibm.com>
Signed-off-by: Michael Holzheu <holzheu@linux.vnet.ibm.com>