summaryrefslogtreecommitdiffstats
path: root/include
Commit message (Collapse)AuthorAgeFilesLines
* lib/strutils: create type specific strtoxx_or_err()Karel Zak2012-05-151-2/+12
| | | | | | | We need [un]signed int ([u]int32_t) on many places. It's also more readable and robust to use uintXX_t types than for example "long long". Signed-off-by: Karel Zak <kzak@redhat.com>
* include/ttyutils: more robust get_terminal_width()Karel Zak2012-05-151-2/+12
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* include: move get_terminal_width() to ttyutils.hPetr Uzel2012-05-151-0/+29
| | | | Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
* libuuid: move read_all to include/all-io.hPetr Uzel2012-05-151-0/+25
| | | | Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
* include: rename writeall.h to all-io.hPetr Uzel2012-05-152-4/+4
| | | | Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
* libuuid: avoid double open and leaking fd (reworked)Petr Uzel2012-05-101-1/+1
| | | | | | | | | | | | | | This reverts commit 6126f7a53c57485a9a29ddd772765695f23c92e6 and fixes the double open and leaking descriptor in a different way, that is by using newly introduced function 'have_random_source()' to check whether good random source is available while deciding which uuid type to generate (random/time). This is better than calling random_get_fd() twice, passing the file descriptor down the stack and reusing it in next call to random_get_fd(). Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
* libuuid: avoid double open and leaking descriptorPetr Uzel2012-05-041-1/+1
| | | | | | | | | | | | | We are opening /dev/urandom twice in uuid_generate(): first to check if the file is available and then later __uuid_generate_random() again to actually get the random data. Moreover, descriptor from the first open is leaking. Fix by passign the descriptor down the stack and reusing it there. References: http://marc.info/?l=util-linux-ng&m=133406051131131&w=2 Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
* lib/strutils: add string_to_bitmask()Karel Zak2012-05-031-0/+3
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* include/tt: remove obsolete stuffKarel Zak2012-05-031-3/+0Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* wdctl: align with other util-linux commandsSami Kerola2012-05-031-0/+2
| | | | | | | | | * Add watchdog device path to pathnames.h * Check output stream status at exit. * Adjust usage() notation to follow howto file. * Retire numeric return value. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* Merge branch '2012wk17' of https://github.com/kerolasa/lelux-utiliteetitKarel Zak2012-05-021-0/+10
|\ | | | | | | | | * '2012wk17' of https://github.com/kerolasa/lelux-utiliteetit: build-sys: determine availability of __fpending()
| * build-sys: determine availability of __fpending()Sami Kerola2012-04-231-0/+10
| | | | | | | | | | | | | | | | Needed to for making Cygwin more possible. Reference: http://comments.gmane.org/gmane.linux.utilities.util-linux-ng/5656 Reported-by: Bernhard Voelker <bernhard.voelker@siemens-enterprise.com> Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* | build-sys: add ttyutils.h to distPetr Uzel2012-04-271-0/+1
| | | | | | | | Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
* | build-sys: add randutils.h to distPetr Uzel2012-04-271-0/+1
| | | | | | | | Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
* | lib/mangle: cleanup, add unhexmangleKarel Zak2012-04-261-0/+7
|/ | | | | | | | * use strchr() rather than for() * small refactoring in mangle code * add un-hex-mangle Signed-off-by: Karel Zak <kzak@redhat.com>
* lib/fileutils: add get_fd_tabsize()Karel Zak2012-04-231-1/+4
| | | | | | as a fallback for the function getdtablesize() Signed-off-by: Karel Zak <kzak@redhat.com>
* lib: add pager functionalityDavidlohr Bueso2012-04-231-0/+6
| | | | | | | | | When some program' output exceeds the terminal's dimensions, it is a nice feature to call a pager that acts as calling 'less' to allow better user navigation. This patch adds this functionality, based on what perf and git have (ie: git log). Signed-off-by: Davidlohr Bueso <dave@gnu.org>
* libblkid: add support for PARTUUID= and PARTLABEL=Karel Zak2012-04-191-0/+2
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* Merge branch 'close_stream' of git://github.com/kerolasa/lelux-utiliteetitKarel Zak2012-04-112-0/+42
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 'close_stream' of git://github.com/kerolasa/lelux-utiliteetit: disk-utils: verify writing to streams was successful fdisk: verify writing to streams was successful getopt: verify writing to streams was successful hwclock: verify writing to streams was successful login-utils: verify writing to streams was successful misc-utils: verify writing to streams was successful mount: verify writing to streams was successful partx: verify writing to streams was successful schedutils: verify writing to streams was successful sys-utils: verify writing to streams was successful term-utils: verify writing to streams was successful text-utils: verify writing to streams was successful include: add stream error checking facility Conflicts: fdisk/fdisk.c
| * include: add stream error checking facilitySami Kerola2012-04-042-0/+42
| | | | | | | | | | | | | | | | | | The close_stream() is copied from GNU lib. Inspiration to do this is talk by Jim Meyering - Goodbye World! The perils of relying on output streams in C. Reference: http://www.irill.org/events/ghm-gnu-hackers-meeting/videos/jim-meyering-goodbye-world-the-perils-of-relying-on-output-streams-in-c Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* | lib: random utilitiesDavidlohr Bueso2012-04-101-0/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | fdisk: move kernel geometry into blkdevDavidlohr Bueso2012-04-101-0/+3
| | | | | | | | | | | | This is a more generic place for this ioctl. Signed-off-by: Davidlohr Bueso <dave@gnu.org>
* | Merge branch 'eject'Karel Zak2012-04-052-0/+3
|\ \ | |/ |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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 ...
| * eject: add -X from FedoraKarel Zak2012-03-271-0/+1
| | | | | | | | Signed-off-by: Karel Zak <kzak@redhat.com>
| * sysfs: move blkid_devno_to_wholedisk to sysfs_devno_to_wholediskMichal Luscon2012-03-271-0/+2
| | | | | | | | Signed-off-by: Michal Luscon <mluscon@redhat.com>
* | lib/loopdev: more robust initializationKarel Zak2012-04-021-0/+2
| | | | | | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* | raw: use pathnames.h for file locationsSami Kerola2012-03-301-0/+7
| | | | | | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* | lib/strutils: add strtosize_or_err, clean upKarel Zak2012-03-301-0/+7
|/ | | | | | | | | | | | * 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-272-28/+0Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* include/exitcodes: clean up names, add _EX_ suffixKarel Zak2012-03-201-14/+18
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* include/exitcodes: add FSCK_DESTRUCT aliasKarel Zak2012-03-201-0/+3
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* include/ttyutils.h: add include guardsDave Reisner2012-03-201-0/+4
| | | | Signed-off-by: Dave Reisner <dreisner@archlinux.org>
* fileutils: differentiate xmkstemp and xfmkstempSami Kerola2012-03-181-1/+15
| | | | | | | | | | | | 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>
* include: add asprintf wrapperSami Kerola2012-03-181-0/+11
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* pathnames: clean up various user database pathsSami Kerola2012-03-181-13/+4Star
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* lib: add fileutils function collectionSami Kerola2012-03-182-2/+9
| | | | | | | | | 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>
* chsh: use pathnames.h for pathsSami Kerola2012-03-181-0/+1
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* agetty: move vc initialization to ttyutils.hKarel Zak2012-03-121-0/+73
| | | | | | ... to make the code usable for sulogin. Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: fix "already mounted" detection on systems with mtabKarel Zak2012-03-091-0/+4
| | | | | | | | For systems with regular mtab the fs->root should be ignored in "already mounted" heuristic. Reported-by: Matt Burgess <matthew@linuxfromscratch.org> Signed-off-by: Karel Zak <kzak@redhat.com>
* libblkid: fix sysfs context usageKarel Zak2012-03-061-0/+1
| | | | | Reported-by: Elan Ruusamäe <glen@delfi.ee> Signed-off-by: Karel Zak <kzak@redhat.com>
* include: add /proc/locks path to pathnamesDavidlohr Bueso2012-02-291-0/+1
| | | | | Signed-off-by: Davidlohr Bueso <dave@gnu.org> Signed-off-by: Karel Zak <kzak@redhat.com>
* build-sys: enhance readability of the autotools filesSami Kerola2012-02-281-2/+2
| | | | | | | | 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/fsprobe: mar this internal API as deprecatedKarel Zak2012-02-131-0/+2
| | | | | | | | | | | | 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>
* mount: (new) share exit codes by include/exitcodes.hKarel Zak2012-01-231-0/+10
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* losetup: make xgetpass more robustKarel Zak2012-01-171-0/+1
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* losetup: move xgetpass() to lib/xgetpass.cKarel Zak2012-01-112-0/+7
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* losetup: add --partscan optionKarel Zak2012-01-091-1/+2
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* loopdev: support LO_FLAGS_PARTSCAN flag (kernel 3.2)Karel Zak2012-01-091-0/+3
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* blkdev: add is_blkdev functionDavidlohr Bueso2012-01-051-0/+3
| | | | | | 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/+9
| | | | | | And replace the current archaic logic of is_ide_cdrom_or_tape(). Signed-off-by: Davidlohr Bueso <dave@gnu.org>