summaryrefslogtreecommitdiffstats
path: root/lib
Commit message (Collapse)AuthorAgeFilesLines
* lib: [procutils.c] improve robustnessKarel Zak2011-06-201-0/+3
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* lib: [linux_version.c] simplify version parsingKarel Zak2011-06-201-11/+11
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* misc: hurd build fixesSamuel Thibault2011-06-202-0/+5
| | | | | | | | | | | | * Make blkdev_is_misaligned return 0 when BLKALIGNOFF is not available. * Make procutils.c include c.h to get a PATH_MAX replacement. * Provide agetty.c USE_SYSLOG, DEFAULT_VCTERM and DEFAULT_STERM defaults for Hurd. * Make agetty.c only deal with OFDEL, XCASE and VSWTCH if they are available. Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org> Signed-off-by: Karel Zak <kzak@redhat.com>
* lib: [tt.c] Fix mbs_width macro for systems without WIDECHARJosiah Worcester2011-06-141-1/+1
| | | | Signed-off-by: Josiah Worcester <josiahw@gmail.com>
* lib: [loopdev.c] cleanup flags usageKarel Zak2011-06-101-17/+97
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* lib: [linux_version.c] accommodate two-component linux version (e.g. 3.0)Karel Zak2011-06-061-3/+3
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* lib: add strtoul_or_err() functionSami Kerola2011-06-011-0/+24
| | | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi> Signed-off-by: Karel Zak <kzak@redhat.com>
* lib: [loopdev.c] add module for work loop devicesKarel Zak2011-05-303-3/+1066
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* lib: [sysfs.c] fix double freeKarel Zak2011-05-301-1/+3
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* This adds a second parameter to size_to_human_string() to return aFrancesco Cosoleto2011-05-261-8/+25
| | | | | | | | | | | | | | | string with a different format based on the following flags: SIZE_SUFFIX_1LETTER = "1K" SIZE_SUFFIX_3LETTER = "1KiB", SIZE_SUFFIX_SPACE = "1 KiB" or "1 K" [kzak@redhat.com: - rename flags to SIZE_SUFFIX_* format, - fix suffix[] buffer size - add 3 letter version to the test] Signed-off-by: Francesco Cosoleto <cosoleto@gmail.com> Signed-off-by: Karel Zak <kzak@redhat.com>
* build-sys: cleanup lib/ testsKarel Zak2011-05-253-6/+11
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* lib: [sysfs.c] add sysfs_readlink and name/path functionsKarel Zak2011-05-181-14/+122
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* lib: [at.c] add readlink_at(), fix semantic for absolute pathsKarel Zak2011-05-181-12/+41
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* lib: [sysfs.c] make sysfs_read_* function more robustKarel Zak2011-05-181-11/+39
| | | | | | | The functions does not modify result if the requested sysfs attribute does not exist. Signed-off-by: Karel Zak <kzak@redhat.com>
* build-sys: disable lib/ at.c tests buildingKarel Zak2011-05-181-2/+2
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libblkid: use stuff from sysfs.h and at.hKarel Zak2011-05-161-0/+7
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* lib: add generic sysfs utilsKarel Zak2011-05-163-2/+351
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* lib: [tt.c] support key="value" output formatKarel Zak2011-05-101-3/+16
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* lib: [procutils.c]: add missing files. Sorry.Karel Zak2011-05-041-0/+122
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* lib: [procutils.c]: general purpose procfs parsing functionsDavidlohr Bueso2011-05-041-1/+2
| | | | | | | | | | | | | | | | We include the following functions as a first approach: - proc_open_tasks(): allocate resources and setup basic data - proc_next_tid(): iterate over the thread group - proc_close_tasks(): free used resources [kzak@redhat.com: - free() on error in proc_open_tasks(), - always call free() in proc_close_tasks() - ignore non-digit dirs and return 1 on end-of-dir in proc_next_tid()] Signed-off-by: Davidlohr Bueso <dave@gnu.org> Signed-off-by: Karel Zak <kzak@redhat.com>
* lib: [tt.c] support fixed width and multiple tt_print_table() callsKarel Zak2011-04-271-5/+37
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* blkdev: add blkdev_is_misaligned()Davidlohr Bueso2011-04-121-0/+12
| | | | | | | | | | This functions returns the status of the device's alignment. It will be 0 when aligned, otherwise return the offset. [kzak@redhat.com: - returns 0 if the ioctl failed] Signed-off-by: Davidlohr Bueso <dave@gnu.org> Signed-off-by: Karel Zak <kzak@redhat.com>
* lib: [fsprobe.c] fix blkid_evaluate_spec() callKarel Zak2011-03-221-1/+1
| | | | | | | lib/fsprobe.c:56:2: warning: passing argument 2 of ‘blkid_evaluate_spec’ from incompatible pointer type shlibs/blkid/src/blkid.h:189:14: note: expected ‘struct blkid_struct_cache **’ but argument is of type ‘blkid_cache’ Signed-off-by: Karel Zak <kzak@redhat.com>
* libblkid: add blkid_evaluate_spec()Karel Zak2011-03-171-20/+1Star
| | | | | | | | | | | | The function blkid_evaluate_tag() is useful for tags only (e.g. LABEL=foo). But we also need to address devices by tags OR paths in many utils. The function blkid_evaluate_spec() support this functionality without extra care about the way how device is addressed. The tags as well as paths are converted to the standardized device path. Signed-off-by: Karel Zak <kzak@redhat.com>
* lib: [fsprobe.c] remove obsolete <blkid/blkid.h>Karel Zak2011-03-161-4/+0Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* lib: [fsprobe.c] use internal libblkid onlyKarel Zak2011-03-161-101/+17Star
| | | | | | | | fsck, mount and swapon will be compilable with libblkid from util-linux package. The old libblkid from e2fsprogs will not be supported. Signed-off-by: Karel Zak <kzak@redhat.com>
* lib: [tt.c] use mbs_truncate() from mbsalign.cKarel Zak2011-03-112-65/+4Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* lib: [tt.c] dereferencing data before a null check [coverity scan]Karel Zak2011-03-111-1/+2
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* umount: segfaults with inconsistent entry in /etc/fstabKarel Zak2011-03-041-0/+2
| | | | | | Addresses: https://bugs.launchpad.net/ubuntu/+source/util-linux/+bug/726283 Reported-by: Greg Brockman <gdb@gregbrockman.com> Signed-off-by: Karel Zak <kzak@redhat.com>
* move struct option to .rodataKarel Zak2011-03-031-1/+1
| | | | | | | It does not make sense to have writable large arrays of "struct option" on the stack. Signed-off-by: Karel Zak <kzak@redhat.com>
* lib: [strutils.c] more robust strtol checksKarel Zak2011-02-211-2/+2
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* strutils: new wrapper function strtoll_or_errSami Kerola2011-02-211-0/+24
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* tests: [cpuset] call free() for rangeKarel Zak2011-02-171-0/+1
| | | | | | | | The free() before exit() is not so important, but let's keep the example code nice and consistent. Reported-by: Steve Grubb <sgrubb@redhat.com> Signed-off-by: Karel Zak <kzak@redhat.com>
* fdisk: more robust whole-disk detectionKarel Zak2011-02-171-7/+6Star
| | | | | | | | In lib/wholedisk.c, i is set to 0. If fd was a -1, then at line 18 geometry.start is used without it being initialized. Reported-by: Steve Grubb <sgrubb@redhat.com> Signed-off-by: Karel Zak <kzak@redhat.com>
* lib: [strutils] avoid integer overflow on large valuesDave Reisner2011-02-151-4/+14
| | | | | | | | | | | | | | This is visible on a 2TB disk via lsblk, where a large partition incorrectly displays as 1.171798692T instead of 1.8T. This is corrected by using a uint64_t type instead of a simple int -- consistant with the type used in lsblk.c to represent the raw size in bytes. [kzak@redhat.com: - add EiB support - add size_to_human_string() to regression tests] Signed-off-by: Dave Reisner <d@falconindy.com> Signed-off-by: Karel Zak <kzak@redhat.com>
* build-sys: provide alternatives for err, errx, warn and warnxFabian Groffen2011-02-146-6/+5Star
| | | | | | | | Solaris lacks err, errx, warn and warnx. This also means the err.h header doesn't exist. Removed err.h include from all files, and included err.h from c.h instead if it exists, otherwise alternatives are provided. Signed-off-by: Fabian Groffen <grobian@gentoo.org>
* cfdisk: data type mismatch, and other, compiler warning fixesSami Kerola2011-01-251-3/+3
| | | | | | | | | | | | | | | | | | Following warnings will longer appear when one will compile with gcc flags -Wall -Wextra -pedantic cfdisk.c:475:3: warning: comparison of unsigned expression < 0 is always false cfdisk.c:487:16: warning: comparison between signed and unsigned integer expressions cfdisk.c:492:14: warning: comparison between signed and unsigned integer expressions cfdisk.c:565:19: warning: comparison between signed and unsigned integer expressions cfdisk.c:569:19: warning: comparison between signed and unsigned integer expressions cfdisk.c:1070:14: warning: comparison between signed and unsigned integer expressions cfdisk.c:1568:5: warning: missing initializer cfdisk.c:1568:5: warning: (near initialization for 'tmp_ext.volume_label') mbsalign.c:131:2: warning: comparison of unsigned expression >= 0 is always true Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* include: [tt] enlarge output bufferKarel Zak2011-01-251-4/+21
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* build-sys: use WORDS_BIGENDIAN to determine platform byte-orderFabian Groffen2011-01-171-6/+1Star
| | | | | | | | | | | | Autoconf contains the right magic to determine the endianness on many platforms next to Linux. This reverses previous commits to move away from WORDS_BIGENDIAN: "use __BYTE_ORDER rather than AC specific WORDS_BIGENDIAN" This is necessary to compile on non Linux platforms like Darwin and Solaris. Signed-off-by: Fabian Groffen <grobian@gentoo.org>
* remove duplicate includesKarel Zak2011-01-042-5/+0Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* findmnt: add --submounts optionKarel Zak2011-01-041-0/+8
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* tests: fix strtosize() testKarel Zak2011-01-032-1/+26
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* lib: [env] consolidate safe_getenv() usageKarel Zak2011-01-031-1/+35
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: cleanup mangle() usageKarel Zak2011-01-031-4/+4
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: use better format for utab, improve bind mountsKarel Zak2011-01-031-5/+8
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: rewrite mountinfo/fstab parsers to use sscanf()Karel Zak2011-01-031-3/+12
| | | | | | | | The old solution (without scanf()) was based on old code from mount(8). It seems that the modern libc is able to provide all necessary functionality by sscanf() and %ms directive. Signed-off-by: Karel Zak <kzak@redhat.com>
* lib: fix mange() and unmangle() to handle NULLKarel Zak2011-01-031-0/+9
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: add unmangle/mangle() functions to APIKarel Zak2011-01-031-4/+5
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* lib: add wrappers for "at" functionsKarel Zak2011-01-032-1/+102
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* lib: [tt] fix alignment of the last tree childKarel Zak2010-12-161-1/+1
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>