summaryrefslogtreecommitdiffstats
path: root/lib
Commit message (Collapse)AuthorAgeFilesLines
* include: cleanup copyright headersKarel Zak2013-01-088-8/+38
| | | | | | | We use the code from include/ and lib/ on many places, so use public domain if possible or LGPL for code copied from libs. Signed-off-by: Karel Zak <kzak@redhat.com>
* sulogin: remove consoles.c from libcommonKarel Zak2012-12-232-787/+0Star
| | | | | | | | - move struct chardata to include/ttyutils.h - move console.{h,c} to login-utils/sulogin-* (it's sulogin specific) - fix sulogin and agetty includes Signed-off-by: Karel Zak <kzak@redhat.com>
* lib/ismounted: improve loopdev supportKarel Zak2012-12-191-18/+9Star
| | | | | | | ... to make it usable for situations when the same backing file is mapped to more loop devices. Signed-off-by: Karel Zak <kzak@redhat.com>
* lib/ismounted: basic support for loop devicesKarel Zak2012-12-192-10/+35
| | | | | | | | | | | | | | | | | | | | | | # losetup -a /dev/loop0 /dev/loop0: [2053]:1048578 (/home/fs-images/filesystems/ext2.img) # findmnt /dev/loop0 TARGET SOURCE FSTYPE OPTIONS /mnt/test /dev/loop0 ext3 rw,relatime,data=ordered old version: ./test_ismounted /home/fs-images/filesystems/ext2.img not mounted new version: ./test_ismounted /home/fs-images/filesystems/ext2.img mounted on /mnt/test Reported-by: Sami Kerola <kerolasa@iki.fi> Signed-off-by: Karel Zak <kzak@redhat.com>
* lib/loopdev: fix loopdev_find_by_backing_file()Karel Zak2012-12-191-1/+1
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* sulogin: mount temporary /dev and /proc if not foundWerner Fink2012-12-181-0/+73
| | | | | | | | | This is very usefull if initrd can not loaded that is no /dev and no /proc is found. Also if the /etc/shadow and /etc/passwd is copied into the initrd the sulogin can be used in initrd even before /dev and/or /proc are mounted. Signed-off-by: Werner Fink <werner@suse.de>
* sulogin: use the linked lists from list.h for consoles listWerner Fink2012-12-181-30/+48
| | | | | | | | | | with this the double linked list feature from util-linux is used instead of the single linked list. [kzak@redhat.com: use list_last_entry() and list INIT macros] Signed-off-by: Werner Fink <werner@suse.de> Signed-off-by: Karel Zak <kzak@redhat.com>
* include/list: add list_last_entry()Karel Zak2012-12-181-3/+3
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* lib/canonicalize: add canonicalize_path_restricted() to canonicalize without ↵Karel Zak2012-11-261-0/+42
| | | | | | suid permisssions Signed-off-by: Karel Zak <kzak@redhat.com>
* lib/path: add path_read_u64()Karel Zak2012-11-231-0/+22
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* lib/path: rename functions to be more explicitKarel Zak2012-11-231-8/+10
| | | | | | ... and to have names compatible with lib/sysfs.c Signed-off-by: Karel Zak <kzak@redhat.com>
* lib/ttyutils: add get_terminal_name()Karel Zak2012-11-221-2/+43
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* lib/ttyutils: add test programKarel Zak2012-11-222-0/+14
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* lib/ttyutils: create .c fileKarel Zak2012-11-222-0/+40
| | | | | | | | Well, now all tty stuff are incline functions in include/ttyutils.h. It's seems more elegant to create regular lib/ttyutils.c for libcommon and write test program. Signed-off-by: Karel Zak <kzak@redhat.com>
* lib/loopdev: make loopcxt_get_device() more robustKarel Zak2012-11-121-2/+2
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* lib/console: fix possible fd leakKarel Zak2012-11-091-1/+4
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* lib/consoles: try another methods before go to fallbackKarel Zak2012-11-091-10/+4Star
| | | | | | | | The current code goes immediately to the fallback section if any detection method fails. It seems better to try another methods before the fallback solution. Signed-off-by: Karel Zak <kzak@redhat.com>
* lib/consoles: add debug messagesKarel Zak2012-11-091-8/+59
| | | | | | - may be enabled by CONSOLES_DEBUG env. variable Signed-off-by: Karel Zak <kzak@redhat.com>
* 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>