summaryrefslogtreecommitdiffstats
path: root/lib
Commit message (Collapse)AuthorAgeFilesLines
...
* lib/consoles: TIOCGDEV code refactoringKarel Zak2012-11-091-42/+67
| | | | | | | - add missing scandev() otherwise TIOCGDEV make no sense - use this method independent on /proc/cmdline code Signed-off-by: Karel Zak <kzak@redhat.com>
* lib/consoles: cmdline code refactoringKarel Zak2012-11-091-72/+91
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* lib/consoles: sysfs code refactoringKarel Zak2012-11-091-37/+64
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* lib/consoles: /proc/consoles code refactoringKarel Zak2012-11-091-27/+55
| | | | | | | | - move to separate function - cleanup code - fix fscanf() usage to avoid buffer overflow Signed-off-by: Karel Zak <kzak@redhat.com>
* lib/consoles: small cleanupKarel Zak2012-11-091-9/+10
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* lib/consoles: don't call perror()Karel Zak2012-11-091-11/+26
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* lib/consoles: add test programKarel Zak2012-11-092-0/+32
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* lib/consoles: remove global variable consolesKarel Zak2012-11-091-19/+17Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* lib/consolas: remove global variable concount, fix linked listKarel Zak2012-11-091-7/+6Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* lib/consoles: remove global variable initcpKarel Zak2012-11-081-7/+7
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* lib/consoles: remove global variable comparedevKarel Zak2012-11-081-8/+7Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* lib/consoles: minor clean upsKarel Zak2012-11-081-45/+41Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* lib/consoles: add code to detect all system consolesWerner Fink2012-11-082-0/+509
| | | | Signed-off-by: Werner Fink <werner@suse.de>
* build-sys: cleanup cpu_set_t usageKarel Zak2012-11-022-2/+8
| | | | | | | - make taskset depend on cpu_set_t - make cpuset.c optional for libcommon and lib/path.c Signed-off-by: Karel Zak <kzak@redhat.com>
* misc: make readlink() usage more robustKarel Zak2012-10-231-1/+1
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* lib/sysfs: add SCSI link functionsKarel Zak2012-10-231-2/+50
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* lib/sysfs: add functions for SCSI host attributesKarel Zak2012-10-231-0/+52
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* include/sysfs: add SCSI host:channel:target:lun supportKarel Zak2012-10-231-3/+39
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* lib/tt: don't ignore "extreme" columns if an free space is availableKarel Zak2012-10-231-1/+2
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* lib/loopdev: check for /sysKarel Zak2012-10-171-0/+6
| | | | | | | | | The current loopdev code prefers /sys to get information about loop devices. The old methods like scan /dev are fallback solution only. Unfortunately, the code does not check if /sys is mounted. Addresses: http://blog.flameeyes.eu/2012/10/sophistication-can-be-bad Signed-off-by: Karel Zak <kzak@redhat.com>
* lib/loopdev: improve debug messagesKarel Zak2012-10-171-4/+18
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* lib/color: add module for work with terminal colorsOndrej Oprala2012-10-162-0/+29
| | | | | | | | [kzak@redhat.com: - split from dmesg patch - add more colors] Signed-off-by: Ondrej Oprala <ooprala@redhat.com> Signed-off-by: Karel Zak <kzak@redhat.com>
* md5: fix strict aliasing warningsMike Frysinger2012-10-101-3/+6
| | | | | | | This is the same fix as was merged in gcc/binutils where this code appears to originate from. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
* lib/sysfs: fix sysfs_devname_to_devno for dm partitionsPeter Rajnoha2012-09-211-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | Partitions mapped by device-mapper are not like real partitions where there's a /sys/block/<parent>/<name>/dev sysfs path. We need to look at /sys/block/<name>/dev like we do for any other non-partition devices. The mapped partition is not found otherwise. For example, this bug shows up in lsblk while specifying a device on command line while that device is a dm mapping over a partition: $lsblk NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT sda 8:0 0 128M 0 disk `-test (dm-0) 253:0 0 128M 0 dm `-test1 (dm-1) 253:1 0 127M 0 part Before this patch: $lsblk /dev/mapper/test1 lsblk: dm-1: unknown device name With this patch: $lsblk /dev/mapper/test1 NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT test1 (dm-1) 253:1 0 127M 0 part
* mount: losetup: remove obsolete encryption supportLudwig Nussel2012-09-111-56/+0Star
| | | | | | | | | | | | | | | kernel cryptoloop is deprecated since ages and support for cryptoloop in util-linux is incomplete/broken. - no password hashing - last 8 bit of key are always set to zero - no binary keys possible (stops reading key at \n and \0) In the past some Distros added the above features with patches. So remove cryptoloop support from util-linux completely to make sure people won't try using it. Signed-off-by: Ludwig Nussel <ludwig.nussel@suse.de> Signed-off-by: Karel Zak <kzak@redhat.com>
* lib/pager: robust work with file descriptors [coverity scan]Karel Zak2012-09-071-2/+7
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* lib/sysfs: more robust sysfs_opendir() [coverity scan]Karel Zak2012-09-071-2/+3
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* lib/sysfs: make sysfs_partno_to_devno better readableBernhard Voelker2012-08-141-7/+9
| | | | Signed-off-by: Bernhard Voelker <mail@bernhard-voelker.de>
* lib/sysfs; add sysfs_partno_to_devno()Karel Zak2012-08-131-4/+53
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* lib/mangle: remove unused variableKarel Zak2012-08-131-1/+0Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* lib/sysfs: expect p<N> suffix for partitionsKarel Zak2012-08-131-3/+6
| | | | | | | | | | ... so for example lsblk(8) will see partitioned loop devices loop0 7:0 0 80G 0 loop ├─loop0p1 259:0 0 100M 0 loop └─loop0p2 259:1 0 79.9G 0 loop Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: fix unmangle codeKarel Zak2012-08-131-2/+3
| | | | | | | | | | | old version: /mnt/ugly/te\134st\134 -> /mnt/ugly/te\st\134 fixed version: /mnt/ugly/te\134st\134 -> /mnt/ugly/te\st\ Reported-by: Naja Melan <najamelan@autistici.org> Signed-off-by: Karel Zak <kzak@redhat.com>
* Fix non-Linux buildSamuel Thibault2012-08-132-4/+7
| | | | | | | | | | | | loopdev.c, test_pager, and get_max_number_of_cpus() are linux-specific. get_linux_version will only work on Linux, let's introduce system_supports_ext4_ext2() which assumes that mounting ext2 with ext4 is not supported on non-Linux systems. [kzak@redhat.com: - use #ifdef SYS_sched_getaffinity rather than __linux__] Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org> Signed-off-by: Karel Zak <kzak@redhat.com>
* lib/tt: always escape '\' to simplify parsing in scriptsKarel Zak2012-08-131-14/+3Star
| | | | | | | | | | | | | | | | | | | The commands echo(1) and printf(1) are usable for escape sequences decoding, for example for x in $(findmnt --noheading --raw --output TARGET); do printf "%b" $x done but it's necessary to escape all '\' chars, otherwise for example \b in foo\bar will be interpreted as backspace. It means that for example findmnt(8) has to use \x5c for the backslash. # findmnt --noheading --raw --output TARGET /dev/sda1 /mnt/ugly/foo\x5cbar Reported-by: Pádraig Brady <P@draigBrady.com> Signed-off-by: Karel Zak <kzak@redhat.com>
* lib/tt: fix \x%02x usageKarel Zak2012-08-081-4/+4
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* include/tt: improve work with non-utf8 charsKarel Zak2012-08-071-9/+23
| | | | | Reported-by: Pádraig Brady <P@draigBrady.com> Signed-off-by: Karel Zak <kzak@redhat.com>
* lib/tt: count read cells, improve \x?? hex encodingKarel Zak2012-08-061-14/+161
| | | | | | | | | | | | | | | | | | * use wcwidth() to count real number of columns required for multibyte strings * encode control characters with \x?? in raw and export (NAME=data) outputs * use \x?? for controls and non-printable characters in the default outputs * use \x?? to encode already existing hex sequences, for example /mnt/ugly\x20space ---> /mnt/ugly\x5cx20space this is not used in the default output, but in raw/export outputs only (which is designed for scripts). Signed-off-by: Karel Zak <kzak@redhat.com>
* build-sys: move tests to check_PROGRAMSKarel Zak2012-07-301-3/+3
| | | | | | Thanks to Mike Frysinger. Signed-off-by: Karel Zak <kzak@redhat.com>
* lib/strutils: add string_add_to_idarray() - parse and add to id listMilan Broz2012-07-261-0/+27
| | | | | Signed-off-by: Milan Broz <mbroz@redhat.com> Signed-off-by: Karel Zak <kzak@redhat.com>
* lib/match: fix compiler warning [-Wmissing-prototypes]Karel Zak2012-07-161-0/+2
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* translation: unify file open error messagesSami Kerola2012-07-162-3/+3
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* lib/loopdev: minor bug fix: add missing semicolonSami Kerola2012-07-161-1/+1
| | | | | | | | | Missing semicolon made test_loop_info() to return function loopcxt_enable_debug() return value, which happen to be void. I suspect the loopcxt_enable_debug() was usually not executed, while it should be. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* lib/pager: minor compiler warning fixesSami Kerola2012-07-161-1/+3
| | | | | | | | | Add missing function prototype, and declare structure before use of it. lib/pager.c:162:6: warning: no previous prototype for function 'setup_pager' [-Wmissing-prototypes] lib/pager.c:20:29: warning: tentative definition of variable with internal linkage has incomplete non-array type 'struct child_process' [-Wtentative-definition-incomplete-type] Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* fix buffer overrun in some calls to sscanfKarel Zak2012-07-092-2/+2
| | | | | Reported-by: Sergei Antonov <saproj@gmail.com> Signed-off-by: Karel Zak <kzak@redhat.com>
* build-sys: cleanup .gitignore filesKarel Zak2012-06-261-1/+0Star
| | | | | | | - move all binaries to top-level .gitignore - remove unnecessary */.gitignore files Signed-off-by: Karel Zak <kzak@redhat.com>
* build-sys: convert lib/ to libcommon.laKarel Zak2012-06-261-13/+42
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* build-sys: define per-test -DTEST_PROGRAM in lib/Karel Zak2012-06-261-4/+21
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* build-sys: convert lib/ to moduleKarel Zak2012-06-262-61/+64
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* lib/loopdev: use warn_unused_result forimportant functionsKarel Zak2012-06-211-24/+41
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* lib/sysfs: use warn_unused_result for sysfs_init()Karel Zak2012-06-211-1/+2
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>