summaryrefslogtreecommitdiffstats
path: root/include
Commit message (Collapse)AuthorAgeFilesLines
* lib/randutils: remove unnecessary functionKarel Zak2016-10-041-1/+0Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* lib/strutils: make left and right trims more robustSami Kerola2016-09-291-2/+7
| | | | | | | Do not follow null pointer, and stop going any further when ltrim_whitespace() is at the end of a string. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* debug: use const void * for ul_debugobj()Igor Gnatenko2016-09-211-1/+1
| | | | | | | | | | We don't modify data it's pointing out and we should not modify it. Also remove casting to void * as gcc will do it automatically (before we had to cast it explicitly to avoid warning on discarding 'const' qualifier). Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
* libsmartcols: support multi-line cells based on line breaksKarel Zak2016-09-061-1/+1
| | | | | | | | | | Now libsmartcols completely control when and how wrap long lines/cells. This is sometimes user unfriendly and it would be nice to support multi-line cells where wrap is based on \n (new line char). This patch add new column flag SCOLS_FL_WRAPNL. Signed-off-by: Karel Zak <kzak@redhat.com>
* lib/randutils: add xsrand() and rand_get_number()Karel Zak2016-09-061-0/+5
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* lib/pager: cleanup and extend APIKarel Zak2016-08-261-1/+4
| | | | | | | | | * clean up function names * add functions to temporary redirect to the pager and then restore original terminal output Signed-off-by: Karel Zak <kzak@redhat.com>
* loopdev: Implememt loopcxt_set_status()Stanislav Brabec2016-08-171-0/+1
| | | | | | | | | | | | Implement stand-alone loopcxt_set_status(). It allows manipulation with some loop device parameters even if it is initialized. Its function is limited by the kernel implementation, and only a small subset of changes is allowed. For more see linux/drivers/block/loop.c:loop_set_status() Signed-off-by: Stanislav Brabec <sbrabec@suse.cz>
* include/closestream: define exit codesKarel Zak2016-08-161-2/+6
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* include/env: minor fixes and clean upsKarel Zak2016-08-161-1/+7
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* misc: always check setenv(3) return valueSami Kerola2016-08-121-1/+1
| | | | | | At least glibc setenv(3) can fail when system runs out of memory. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* pathnames: guard clashing definitions on FreeBSDFranco Fichtner2016-08-111-0/+4
|
* libmount: ignore redundant slashesKarel Zak2016-08-081-1/+1
| | | | | | | | | | | | | | | ///aaa/bbb and /aaa/bbb/ are the same paths. This is important especially with NFS where number of slashes are not the same in the /proc/self/mountinfo and fstab or utab. The regular URI is euler://tmp but /proc contains euler:/tmp Reported-by: Ales Novak <alnovak@suse.cz> Signed-off-by: Karel Zak <kzak@redhat.com>
* lib/loopdev: cleanup sizelimit checkKarel Zak2016-08-041-3/+3
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* Implement loopcxt_check_conflict()Stanislav Brabec2016-08-031-0/+3
| | | | | | | Add a function that searches for a possible conflicting (i. e. overlaying loop device). Signed-off-by: Stanislav Brabec <sbrabec@suse.cz>
* Add sizelimit to internal APIStanislav Brabec2016-08-031-3/+5
| | | | | | | | | | | | | | Fully safe checks of loop device need to check sizelimit. To prevent need of two nearly equal functions, introduce sizelimit parameter to several internal functions: loopdev_is_used() loopdev_find_by_backing_file() loopcxt_is_used() loopcxt_find_by_backing_file() If sizelimit is zero, fall back to the old behavior (ignoring of sizelimit). Signed-off-by: Stanislav Brabec <sbrabec@suse.cz>
* libsmartcols: Corrected JSON escapingKarel Zak2016-08-021-0/+80
| | | | | | | | | Based on patch set https://github.com/karelzak/util-linux/pull/331 from Fordi. Addresses: https://github.com/karelzak/util-linux/issues/330 Co-Author: Bryan Elliott <fordiman@gmail.com> Signed-off-by: Karel Zak <kzak@redhat.com>
* lib: try to find tty in get_terminal_name()Sami Kerola2016-07-041-1/+1
| | | | | | | | Try all standard terminal input/output file descriptors when finding tty name in get_germinal_name(). This should make all invocations of the function as robust as they can get. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* libcommon: add ISO_8601_GMTIME that will print UTC-0 timestampsSami Kerola2016-06-261-1/+2
| | | | | | | When timestamps are intented to be conversable back from string to binary it is best to stick with UTC-0 timezone. This is needed in utmpdump(1). Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* include/widechar: add fallback for WEOFKarel Zak2016-06-031-1/+3
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* include/widechar: add missing fallbacksKarel Zak2016-06-031-2/+8
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* lib/sysfs: be more smart for non-scsi devicesKarel Zak2016-06-021-1/+2
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* misc: Fix various typosSebastian Rasmussen2016-05-316-6/+6
| | | | | | | Fix various typos in error messages, warnings, debug strings, comments and names of static functions. Signed-off-by: Sebastian Rasmussen <sebras@gmail.com>
* build-sys: add missing include/plymouth-ctrl.hKarel Zak2016-05-241-0/+1
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* lib/timeutils: add strtime_short()Karel Zak2016-05-241-0/+7
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* include/timeutils: rewrite iso formatting functionsKarel Zak2016-05-241-6/+10
| | | | | | | | | - use buffers rather than allocate memory - support .usec and ,usec convention - use strftime for timezone (we need to care about daylight saving time) Signed-off-by: Karel Zak <kzak@redhat.com>
* include/timeutils: use pointer for time_tKarel Zak2016-05-231-1/+1
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* sulogin: agetty: use the plymouth local protocol instead the plymouth binaryWerner Fink2016-05-201-0/+65
| | | | | | | | | | | | | for stopping plymouthd. That do not depend on the existence of the plymouth binary if it e.g. becomes uninstalled or an other service is providing plymouthd facilities. [kzak@redhat.com: - fix compiler warnings [-Wpointer-sign] - use sizeof() for write_all() - cast to char* for read_all] Signed-off-by: Werner Fink <werner@suse.de> Signed-off-by: Karel Zak <kzak@redhat.com>
* lib/timeutils: add strxxx_iso() functionsKarel Zak2016-05-112-0/+15
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: remove duplicate codeKarel Zak2016-04-221-4/+9
| | | | | | | | For petty long time we have strdup_to_struct_member() macro to avoid duplicate code when strdup() strings in setter functions. Let's use it for libmount. Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: try absolute target before canonicalizeKarel Zak2016-04-131-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The path canonicalization is expensive and in many cases unwanted due to problems with readlink() on unreachable NFS and automounters. This patch add a possibility to search also by $(CWD)/<path> if the <path> is relative to reduce number of situation when we convert the path to the canonical absolute path. The common use-case: # cd /some/long/path # umount ./mountpoint old version: 15543: libmount: TAB: [0x560a99a54230]: lookup TARGET: './test' 15543: libmount: CACHE: [0x560a99a54290]: canonicalize path ./test 15543: libmount: CACHE: [0x560a99a54290]: add entry [ 1] (path): /mnt/test: ./test 15543: libmount: TAB: [0x560a99a54230]: lookup canonical TARGET: '/mnt/test' 15543: libmount: CXT: [0x560a99a54050]: umount fs: /mnt/test new version: 15597: libmount: TAB: [0xabf230]: lookup TARGET: './test' 15597: libmount: TAB: [0xabf230]: lookup absolute TARGET: '/mnt/test' 15597: libmount: CXT: [0xabf050]: umount fs: /mnt/test Signed-off-by: Karel Zak <kzak@redhat.com>
* libblkid: Update for newer bcache superblocksKent Overstreet2016-03-232-10/+0Star
| | | | | | | | Later version of bcache add different checksum types, and allow for superblocks greater than 4k - skipping the checksum check (as in most other probes) is the easiest solution. Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
* Merge branch '2016-03-02/cgns' of https://github.com/hallyn/util-linuxKarel Zak2016-03-211-0/+3
|\ | | | | | | | | * '2016-03-02/cgns' of https://github.com/hallyn/util-linux: Implement support for cgroup namespaces
| * Implement support for cgroup namespacesSerge Hallyn2016-03-031-0/+3
| | | | | | | | | | | | Currently these are supported in #for-next. Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
* | libmount: improve conversion from root= to the devnameKarel Zak2016-03-151-0/+1
| | | | | | | | | | | | | | | | Currently the code supports /dev/name or PARTUUID= only. We also need to support 'maj:min' and 'hexhex' notations. Reported-by: George Spelvin <linux@horizon.com> Signed-off-by: Karel Zak <kzak@redhat.com>
* | Merge branch 'port-osx' of https://github.com/rudimeier/util-linuxKarel Zak2016-03-091-14/+40
|\ \ | | | | | | | | | | | | | | | | | | | | | * 'port-osx' of https://github.com/rudimeier/util-linux: fdisk: fix warning, uninitialized variable logger: fix compiler warning, const facilitynames include/bitops: avoid fallbacks for more systems include/bitops: add casts to bswap functions
| * | include/bitops: avoid fallbacks for more systemsRuediger Meier2016-03-081-0/+21
| | | | | | | | | | | | Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
| * | include/bitops: add casts to bswap functionsRuediger Meier2016-03-081-14/+19
| | | | | | | | | | | | | | | | | | Based on kernel sources include/uapi/linux/swab.h. Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* | | misc: remove path name definitions that are unusedSami Kerola2016-03-091-18/+0Star
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | After this commit the following produces zero matches. $ for i in \ _PATH_DEV_TTY \ _PATH_INITTAB \ _PATH_MNTTAB_DIR \ _PATH_MOUNTED_LOCK \ _PATH_MOUNTED_TMP \ _PATH_RC \ _PATH_REBOOT \ _PATH_SECURE \ _PATH_SECURETTY \ _PATH_SHUTDOWN_CONF \ _PATH_SINGLE \ _PATH_UMOUNT \ _PATH_USERTTY do git grep $i; done Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* | | include: move sys/sysmacros.h to c.hKarel Zak2016-03-081-0/+4
|/ / | | | | | | | | | | | | The file is no portable (#ifdef HAVE_SYS_SYSMACROS_H is necessary), but needed on many places. It seems better to keep it in c.h. Signed-off-by: Karel Zak <kzak@redhat.com>
* | lib: include sys/stat.h for struct statRuediger Meier2016-03-071-0/+1
| | | | | | | | | | | | | | Compiler warning: 'struct stat' will not be visible outside of this function [-Wvisibility] Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* | build-sys: add and use openat build conditionalsRuediger Meier2016-03-071-0/+2
| | | | | | | | Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* | lib: move fopen_at() to fileutils.h, remove at.hRuediger Meier2016-03-073-23/+10Star
| | | | | | | | Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* | lib: remove openat fallback functions (include/at.h)Ruediger Meier2016-03-071-11/+1Star
| | | | | | | | | | | | | | | | | | | | | | | | | | | | I have validated that we are still compatible at least back to - openSUSE 11.4 - SLE 11 - RHEL/CentOS 6 - OSX 10.10.x, (Xcode 6.3) - FreeBSD 10.2 Confirmed incompatibility: - OSX 10.9.x, (Xcode 6.2) Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* | lib: provide fallback if mkostemp(3) missingRuediger Meier2016-02-291-0/+2
|/ | | | | | | It's missing on OSX. CC: Yuriy M. Kaminskiy <yumkam@gmail.com> Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* include: provide MAP_ANONYMOUS on OSXRuediger Meier2016-02-181-0/+8
| | | | | | | Hope there are no side effect when defining _DARWIN_C_SOURCE globally. Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* lib: rename strmode() and setmode()Ruediger Meier2016-02-181-1/+1
| | | | | | On BSD they are part of the standard C library. Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* lib/color: add more ESC seq.Karel Zak2016-02-171-0/+4
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libsmartcols: support multibyte titles, rename wrap to paddingKarel Zak2016-01-221-0/+4
| | | | | | | | | - let's support multibyte table titles - use lib/mbalign.c to align the title - rename title_wrap to title_padding (we already use "wrap" on another places for another things) Signed-off-by: Karel Zak <kzak@redhat.com>
* lib/mbsalign: fix warnings when compile without widecharsKarel Zak2016-01-131-0/+1
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* lib/tty: Pass default width to get_terminal_width()Boris Egorov2016-01-061-1/+1
| | | | | | | | | | Almost any code calling get_terminal_width() checks returned width for non-positive values and sets it to some default value (say, 80). So, let's pass this default value directly to the function. [kzak@redhat.com: - get_terminal_width() refactoring] Signed-off-by: Karel Zak <kzak@redhat.com>