summaryrefslogtreecommitdiffstats
path: root/lib
Commit message (Collapse)AuthorAgeFilesLines
* lib: random utilitiesDavidlohr Bueso2012-04-102-0/+122
| | | | | | | | | | | | | | Add a random number(s) generator specific file. The intial functions are based on what libuuid provide. I did some modifications like avoid WIN32 checks - this is util-LINUX. [kzak@redhat.com: - move jrand_seed to lib/randutils.c - use TLS for jrand_seed (like original code from libuuid) - use size_t for buffer sizes - add close() to random_get_bytes] Signed-off-by: Davidlohr Bueso <dave@gnu.org> Signed-off-by: Karel Zak <kzak@redhat.com>
* lib/blkdev: fix compiler warning [-Wreturn-type]Karel Zak2012-04-101-1/+3
| | | | | | | ../lib/blkdev.c: In function ‘blkdev_get_geometry’: ../lib/blkdev.c:287:1: warning: control reaches end of non-void function [-Wreturn-type] Signed-off-by: Karel Zak <kzak@redhat.com>
* strutils: return success on test programDavidlohr Bueso2012-04-101-1/+1
| | | | Signed-off-by: Davidlohr Bueso <dave@gnu.org>
* fdisk: move kernel geometry into blkdevDavidlohr Bueso2012-04-101-0/+23
| | | | | | This is a more generic place for this ioctl. Signed-off-by: Davidlohr Bueso <dave@gnu.org>
* Merge branch 'eject'Karel Zak2012-04-051-2/+151
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * eject: (47 commits) tests: use eject --force eject: use BUILD_EJECT, move to sys-utils eject: clean up usage() eject: clean up man page eject: add --force option eject: check for hotplug/removable attribute eject: remove obsolete code, use EXIT_* macros tests: add umount-by-eject tests eject: improve work with partitioned devices lib/sysfs: improve sysfs_is_partition_dirent() eject: call umount <mountpoint> rather than <device> eject: use libmount to detect if cdrom is mounted eject: make the code robust eject: use SG_IO ioctl for scsi eject: support CDIOCEJECT ioctl eject: new close_tray code from Fedora eject: new auto_eject code from Fedora eject: add -X from Fedora eject: add --manualeject from fedora eject: clean up devname usage ...
| * lib/sysfs: improve sysfs_is_partition_dirent()Karel Zak2012-03-291-2/+22
| | | | | | | | | | | | ... to work with absolute disk device path too. Signed-off-by: Karel Zak <kzak@redhat.com>
| * sysfs: move blkid_devno_to_wholedisk to sysfs_devno_to_wholediskMichal Luscon2012-03-271-0/+129
| | | | | | | | Signed-off-by: Michal Luscon <mluscon@redhat.com>
* | lib/loopdev: more robust initializationKarel Zak2012-04-021-1/+2
| | | | | | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* | lib/strutils: add strtosize_or_err, clean upKarel Zak2012-03-301-37/+45
|/ | | | | | | | | | | | * add strtosize_or_err(), we use strtosize() + err() on many places * add STRTOXX_EXIT_CODE to overwrite the default EXIT_FAILURE * remove else-after-noreturn (e.g. if (foo) err(...); else err(...)) * clean up indent... Signed-off-by: Karel Zak <kzak@redhat.com>
* build-sys: move obsolete lib/fsprobe to mount/Karel Zak2012-03-271-142/+0Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* Revert "lib/canonicalize: always remove tailing slash"Karel Zak2012-03-261-10/+3Star
| | | | | | | | | | | | | | | | | | | It's overkill to modify unknown paths in a generic function like canonicalize_path(). for example: mount -t fuse 'sshfs#marty@thee:/' /media/thee will be canonicalized to mount -t fuse 'sshfs#marty@thee:' /media/thee and this obvious bug. Reported-by: Martin Panter <vadmium+floss@gmail.com> This reverts commit 28074a0952469aebf021821d95238cfb964d13ff.
* lib/tt: work more sensitive with large columnsKarel Zak2012-03-201-1/+7
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* fileutils: differentiate xmkstemp and xfmkstempSami Kerola2012-03-181-13/+10Star
| | | | | | | | | | | | Let developer to choose, case by case, what sort of return value is best in her code. The xmkstemp() is for users who want file descriptor as return value of the function, xfmkstemp() will return FILE pointer. Proposed-By: Karel Zak <kzak@redhat.com> CC: Davidlohr Bueso <dave@gnu.org> Reference: http://marc.info/?l=util-linux-ng&m=133129570124003&w=2 Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* xalloc: use xasprintf in all filesSami Kerola2012-03-181-2/+3
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* lib: add fileutils function collectionSami Kerola2012-03-182-0/+57
| | | | | | | | | The fileutils contains xmkstemp function will create temporary file safe and reusable manner. Reference: http://www.dwheeler.com/secure-programs/Secure-Programs-HOWTO.html#TEMPORARY-FILES CC: Davidlohr Bueso <dave@gnu.org> Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* lsblk: add inverse tree support (-s)Peter Rajnoha2012-03-071-2/+3
| | | | | | | | | | | $ lsblk --inverse -o NAME /dev/dm-0 NAME luks-10d813de-fa82-4f67-a86c-23d5d0e7c30e (dm-0) └─sda6 └─sda Signed-off-by: Peter Rajnoha <prajnoha@redhat.com> Signed-off-by: Karel Zak <kzak@redhat.com>
* libblkid: fix sysfs context usageKarel Zak2012-03-061-3/+3
| | | | | Reported-by: Elan Ruusamäe <glen@delfi.ee> Signed-off-by: Karel Zak <kzak@redhat.com>
* build-sys: enhance readability of the autotools filesSami Kerola2012-02-281-8/+16
| | | | | | | | Several horizontal lists are turned to vertical, and sorted to alphabetical order. Additionally spaces are converted to tabs where ever possible. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* lib/canonicalize: always remove tailing slashKarel Zak2012-02-241-3/+10
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* docs: corrections to FSF license files, and postal addressSami Kerola2012-02-241-3/+3
| | | | | | | | | | | | | | The COPYING and Documentation/licenses/COPYING* files are being replaced by files from GNU web site. http://www.gnu.org/licenses/gpl-2.0.txt http://www.gnu.org/licenses/lgpl-2.1.txt Postal addresses to FSF in other files are updated to match with the address in license files. Reference: http://lists.gnu.org/archive/html/freefont-announce/2005-04/msg00001.html Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* lib/strutils: move array bounds check in string_to_idarray() to appropriate ↵Chandan B Rajenda2012-02-231-2/+2
| | | | | | | | | | | place. string_to_idarray() will incorrectly exit with an error when the last element of the passed in array gets filled. However it should only exit with an error if there is more input. To fix this move the array bounds check. Signed-off-by: Chandan B Rajenda <chandan@linux.vnet.ibm.com> Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
* lib/fsprobe: mar this internal API as deprecatedKarel Zak2012-02-131-0/+5
| | | | | | | | | | | | The fsprobe has been added many years ago to provide unified API for - built-in libblkid - e2fsprogs libblkid - udev libvolume_id these all is unnecessary as we strictly depends on built-in libblkid. Signed-off-by: Karel Zak <kzak@redhat.com>
* lib/loopdev: remove dead assigment and null deferenceKarel Zak2012-02-021-1/+1
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* lib/loopdev: fix part scan detection codeKarel Zak2012-02-021-1/+1
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* lib/sysfs: fix handle leakKarel Zak2012-02-011-0/+1
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* lib/loopdev: fix possible dir leak on errorKarel Zak2012-02-011-0/+1
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* lib/sysfs: fix possible fd leak on errorKarel Zak2012-02-011-1/+2
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* losetup: make xgetpass more robustKarel Zak2012-01-171-2/+2
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* lib,loopdev: remove duplicate includesKarel Zak2012-01-171-1/+0Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: avoid duplicate loopdevsKarel Zak2012-01-161-1/+4
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* losetup: move xgetpass() to lib/xgetpass.cKarel Zak2012-01-111-0/+46
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* loopdev: improve debug messagesKarel Zak2012-01-091-2/+10
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* loopdev: support LO_FLAGS_PARTSCAN flag (kernel 3.2)Karel Zak2012-01-091-2/+62
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* blkdev: add is_blkdev functionDavidlohr Bueso2012-01-051-0/+6
| | | | | | We should have the most basic of checks in this library to see whether or not a block device is being used. Signed-off-by: Davidlohr Bueso <dave@gnu.org>
* fdisk: use CDROM_GET_CAPABILITY ioctlDavidlohr Bueso2012-01-021-0/+13
| | | | | | And replace the current archaic logic of is_ide_cdrom_or_tape(). Signed-off-by: Davidlohr Bueso <dave@gnu.org>
* lib,tt: don't trim last line charKarel Zak2011-12-221-0/+1
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* losetup: rewrite loop setupKarel Zak2011-12-221-0/+8
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* lib,loopdev: add missing functionsKarel Zak2011-12-221-41/+166
| | | | | | | | | - improve loop_info usage (don't call ioctl more than once) - add functions to get devno and inode of the backing file - add function for compare any file with backing file by devno + inode or by filename Signed-off-by: Karel Zak <kzak@redhat.com>
* build-sys: check HAVE_ definitions with #ifdef [smatch scan]Sami Kerola2011-12-022-2/+2
| | | | | | Fix to `warning: undefined preprocessor identifier' messages. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* lib,match: split match_fstype() from libmountKarel Zak2011-11-151-0/+51
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* lib,tt: fix compiler warning [-Wreturn-type]Karel Zak2011-11-141-1/+1
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* lib,tt: add TT_FL_NOEXTREMESKarel Zak2011-11-101-41/+124
| | | | | | | | | | | | | | | | | | | | | | | | If you mark a column with TT_FL_NOEXTREMES flag then extremely large fields will no have effect to column width. Foe example: without the TT_FL_NOEXTREMES flag for the 'AAA' column: AAA BBB CCC DDD aa bbb ccc ddd aaaaaaaaaaa bb ccc ddd aa bb ccc ddd aa bb ccc ddd with the flags: AAA BBB CCC DDD aa bbb ccc dddddddddd aaaaaaaaaaa bb ccc dddddddd aa bb ccc dddddd aa bb ccc ddddddddd Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: ignore tailing slash in netfs source pathsPetr Uzel2011-11-081-0/+32
| | | | | | Addresses: https://bugzilla.novell.com/show_bug.cgi?id=728480 Signed-off-by: Petr Uzel <petr.uzel@suse.cz> Signed-off-by: Karel Zak <kzak@redhat.com>
* lib,loopdev: add LOOP_CTL_GET_FREE supportKarel Zak2011-11-071-7/+29
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* lib: cleanup setproctitle.cKarel Zak2011-10-261-55/+20Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* lib,strutils: add default value to parse_range()Davidlohr Bueso2011-10-171-3/+4
| | | | | | | | This function currently sets the low or high values to 0 when the string doesn't contain a value, like '123:' or ':123'. In order to make it more flexible, we allow it to be passed an arbitrary value. Signed-off-by: Davidlohr Bueso <dave@gnu.org>
* lib,strutils: share parse_range()Davidlohr Bueso2011-10-121-1/+44
| | | | | | | This function is currently only being used by partx(8), but it's handy and generic enough that we can use it elsewhere as well. Signed-off-by: Davidlohr Bueso <dave@gnu.org>
* Merge branch 'sys-utils-again' of https://github.com/kerolasa/lelux-utiliteetitKarel Zak2011-10-031-0/+24
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 'sys-utils-again' of https://github.com/kerolasa/lelux-utiliteetit: cytune: fix printf type warning docs: mention long options in cytune.8 cytune: coding style fixes cytune: refactor main(), new function query_tty_stats() cytune: use libc error printing facilities cytune: check numeric user inputs cytune: add long options and usage() docs: restructure flock.1 manual page flock: simplify strtotimeval() lib: [strutils] add strtod_or_err() function flock: use strutils.h to check numeric user input flock: use sysexit.h for all exit values flock: use function attributes flock: align with howto-usage-function.txt flock: use libc error printing facilities flock: move long_options struct to function scope flock: fix coding style docs: align fallocate.1 with howto-man-page.txt
| * lib: [strutils] add strtod_or_err() functionSami Kerola2011-09-291-0/+24
| | | | | | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* | umount: use new lib/loopdev.c codeKarel Zak2011-09-301-0/+40
| | | | | | | | Signed-off-by: Karel Zak <kzak@redhat.com>