summaryrefslogtreecommitdiff
path: root/lib
AgeCommit message (Collapse)AuthorFilesLines
2011-05-10lib: [tt.c] support key="value" output formatKarel Zak1-3/+16
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-05-04lib: [procutils.c]: add missing files. Sorry.Karel Zak1-0/+122
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-05-04lib: [procutils.c]: general purpose procfs parsing functionsDavidlohr Bueso1-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>
2011-04-27lib: [tt.c] support fixed width and multiple tt_print_table() callsKarel Zak1-5/+37
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-04-12blkdev: add blkdev_is_misaligned()Davidlohr Bueso1-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>
2011-03-22lib: [fsprobe.c] fix blkid_evaluate_spec() callKarel Zak1-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>
2011-03-17libblkid: add blkid_evaluate_spec()Karel Zak1-20/+1
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>
2011-03-16lib: [fsprobe.c] remove obsolete <blkid/blkid.h>Karel Zak1-4/+0
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-03-16lib: [fsprobe.c] use internal libblkid onlyKarel Zak1-101/+17
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>
2011-03-11lib: [tt.c] use mbs_truncate() from mbsalign.cKarel Zak2-65/+4
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-03-11lib: [tt.c] dereferencing data before a null check [coverity scan]Karel Zak1-1/+2
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-03-04umount: segfaults with inconsistent entry in /etc/fstabKarel Zak1-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>
2011-03-03move struct option to .rodataKarel Zak1-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>
2011-02-21lib: [strutils.c] more robust strtol checksKarel Zak1-2/+2
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-02-21strutils: new wrapper function strtoll_or_errSami Kerola1-0/+24
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-02-17tests: [cpuset] call free() for rangeKarel Zak1-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>
2011-02-17fdisk: more robust whole-disk detectionKarel Zak1-7/+6
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>
2011-02-15lib: [strutils] avoid integer overflow on large valuesDave Reisner1-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>
2011-02-14build-sys: provide alternatives for err, errx, warn and warnxFabian Groffen6-6/+5
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>
2011-01-25cfdisk: data type mismatch, and other, compiler warning fixesSami Kerola1-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>
2011-01-25include: [tt] enlarge output bufferKarel Zak1-4/+21
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-01-17build-sys: use WORDS_BIGENDIAN to determine platform byte-orderFabian Groffen1-6/+1
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>
2011-01-04remove duplicate includesKarel Zak2-5/+0
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-01-04findmnt: add --submounts optionKarel Zak1-0/+8
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-01-03tests: fix strtosize() testKarel Zak2-1/+26
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-01-03lib: [env] consolidate safe_getenv() usageKarel Zak1-1/+35
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-01-03libmount: cleanup mangle() usageKarel Zak1-4/+4
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-01-03libmount: use better format for utab, improve bind mountsKarel Zak1-5/+8
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-01-03libmount: rewrite mountinfo/fstab parsers to use sscanf()Karel Zak1-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>
2011-01-03lib: fix mange() and unmangle() to handle NULLKarel Zak1-0/+9
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-01-03libmount: add unmangle/mangle() functions to APIKarel Zak1-4/+5
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-01-03lib: add wrappers for "at" functionsKarel Zak2-1/+102
Signed-off-by: Karel Zak <kzak@redhat.com>
2010-12-16lib: [tt] fix alignment of the last tree childKarel Zak1-1/+1
Signed-off-by: Karel Zak <kzak@redhat.com>
2010-12-09partx: complete rewriteDavidlohr Bueso1-0/+49
Co-Author: Karel Zak <kzak@redhat.com> Signed-off-by: Davidlohr Bueso <dave@gnu.org> Signed-off-by: Karel Zak <kzak@redhat.com>
2010-11-30rename util-linux-ng back to util-linuxKarel Zak1-1/+1
Signed-off-by: Karel Zak <kzak@redhat.com>
2010-11-24lib: [strutils] move strmode() from namei.c to strutils.cKarel Zak1-0/+40
Signed-off-by: Karel Zak <kzak@redhat.com>
2010-11-24lib: [tt] add TT_FL_RIGHT, add columns list parserKarel Zak1-9/+59
Signed-off-by: Karel Zak <kzak@redhat.com>
2010-11-24lib: [ismounted] don't wast time with mtab is /proc/mounts usedKarel Zak1-0/+4
Signed-off-by: Karel Zak <kzak@redhat.com>
2010-11-23lib: [strutils] general purpose string handling functionsDavidlohr Bueso2-37/+74
This patch replaces a few functions used throughout the source: * Renames getnum (from schedutils) to strtol_or_err * Moves strtosize (from lib/strtosize.c) * Moves xstrncpy (from include/xstrncpy.h) * Adds strnlen, strnchr and strndup if not available (remove it from libmount utils) A few Makefile.am files were modified to compile accordingly along with trivial renaming in schedutils source code. Signed-off-by: Davidlohr Bueso <dave@gnu.org>
2010-11-15findmnt: follow HAVE_LANGINFOKarel Zak1-4/+1
Signed-off-by: Karel Zak <kzak@redhat.com>
2010-11-15lib: add fallback for nl_langinfo()Karel Zak1-0/+121
The fallback ignores locales and returns hardcoded static strings. It should be enough to include "nls.h" to work with nl_langinfo() on all systems. Signed-off-by: Karel Zak <kzak@redhat.com>
2010-11-15lib/tt: fix langinfo build breakDavidlohr Bueso1-1/+1
When HAVE_LANGINFO_H is not defined we break the compilation in tt.c: CC tt.o tt.c: In function ‘tt_new_table’: tt.c:142: warning: implicit declaration of function ‘nl_langinfo’ tt.c:142: error: ‘CODESET’ undeclared (first use in this function) tt.c:142: error: (Each undeclared identifier is reported only once tt.c:142: error: for each function it appears in.) make: *** [tt.o] Error 1 Signed-off-by: Davidlohr Bueso <dave@gnu.org>
2010-10-25lib: add test program to canonicalize.cKarel Zak2-1/+16
Signed-off-by: Karel Zak <kzak@redhat.com>
2010-08-23lib: fix syntax error in blkdev.cKarel Zak1-1/+1
Reported-by: Tuco <tuco.xyz@gmail.com> Signed-off-by: Karel Zak <kzak@redhat.com>
2010-07-26portability: fix mntent.h and pty.h usageFrançois Revol1-0/+6
Signed-off-by: François Revol <revol@free.fr> Signed-off-by: Karel Zak <kzak@redhat.com>
2010-06-14build-sys: minor changes for GNU/HurdSamuel Thibault2-0/+5
Here is a patch to fix the build on GNU/Hurd. Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
2010-06-03lib: remove unwanted debug messagesKarel Zak1-8/+2
Signed-off-by: Karel Zak <kzak@redhat.com>
2010-06-03lib: tt.c - fix minimal width of columnKarel Zak1-6/+15
Signed-off-by: Karel Zak <kzak@redhat.com>
2010-06-03lib: tt.c: don't print header for empty tableKarel Zak1-1/+1
Signed-off-by: Karel Zak <kzak@redhat.com>
2010-06-03lib: add tt.c (Tree and Table output)Karel Zak2-1/+724
Signed-off-by: Karel Zak <kzak@redhat.com>