Commit Graph

140 Commits

Author SHA1 Message Date
Sami Kerola b8f040cdd4 include: move disk-utils/mkfs.h -> include/exitcodes.h
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-07-22 00:30:04 +02:00
Sami Kerola e429d14106 md5: use symbolical digest length
Magic hash lenght number 16 is turned to a definition MD5LENGTH,
and put into use everywhere where md5 checksum is in use.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-07-21 23:56:48 +02:00
Davidlohr Bueso 0e75337c31 lib: [blkdev.c] add blkdev_get_physector_size()
This function uses the BLKPBSZGET ioctl to get the physical block size
of the device.

Signed-off-by: Davidlohr Bueso <dave@gnu.org>
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-06-27 15:57:31 +02:00
Karel Zak fd7f0718d4 lib: [loopdev.c] cleanup flags usage
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-06-10 15:38:13 +02:00
Sami Kerola e53bc9604c lib: add strtoul_or_err() function
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-06-01 09:57:43 +02:00
Karel Zak 10ee593293 lib: [loopdev.c] add module for work loop devices
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-05-30 16:37:46 +02:00
Francesco Cosoleto 5d2a98490e This adds a second parameter to size_to_human_string() to return a
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>
2011-05-26 15:32:33 +02:00
Sami Kerola dd9a787376 build-sys: add required files to dist
Files mkfs.h procutils.h sysfs.h where missing from dist file.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-05-26 15:03:27 +02:00
Karel Zak 413993fcb1 lib: [sysfs.c] add sysfs_readlink and name/path functions
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-05-18 16:24:37 +02:00
Karel Zak cdc9c4194a lib: [at.c] add readlink_at(), fix semantic for absolute paths
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-05-18 15:57:16 +02:00
Karel Zak 90e9fcda3b lib: [sysfs.c] make sysfs_read_* function more robust
The functions does not modify result if the requested sysfs attribute
does not exist.

Signed-off-by: Karel Zak <kzak@redhat.com>
2011-05-18 11:57:17 +02:00
Werner Fink 729def03e1 agetty: cleanup argv parsing, utmp update, use writeall(), etc.
Next cleanup, that is split off special character parsing in do_prompt()
and parse_args(), handle name of line of virtual console and use it in
utmp update as well as the session id.  Also move the initial TERM
variable to open_tty() as we use this later in open_tty().  Use writeall()
but avoid repeat to often for EAGAIN (compare with info page of the
(g)libc, description of the macro EAGAIN).

Signed-off-by: Werner Fink <werner@suse.de>
2011-05-17 11:10:03 +02:00
Karel Zak d8a84552fb libblkid: use stuff from sysfs.h and at.h
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-05-16 20:22:52 +02:00
Karel Zak 7fe16fdaf4 lib: add generic sysfs utils
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-05-16 20:22:52 +02:00
Karel Zak bfe695ff5b lib: [tt.c] support key="value" output format
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-05-10 10:37:39 +02:00
Davidlohr Bueso 86a84a17d2 procutils: include missing header
To be able to use DIR we need to include the dirent.h header. This fixes issues such as:

../include/procutils.h:5: error: syntax error before "DIR"
../include/procutils.h:5: warning: no semicolon at end of struct or union

Signed-off-by: Davidlohr Bueso <dave@gnu.org>
2011-05-05 14:01:39 +02:00
Karel Zak 5b1f031123 lib: [procutils.c]: add missing files. Sorry.
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-05-04 15:52:39 +02:00
Sami Kerola 96cc7b0b3e agetty.c: move issue path to pathnames.h
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-04-27 23:21:19 +02:00
Karel Zak ce56db8466 lib: [tt.c] support fixed width and multiple tt_print_table() calls
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-04-27 17:15:36 +02:00
Davidlohr Bueso ba32692970 blkdev: add blkdev_is_misaligned()
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-04-12 13:08:52 +02:00
Davidlohr Bueso 7cf78990fc include: [c.h] add definition wrappers for old libc versions
Signed-off-by: Davidlohr Bueso <dave@gnu.org>
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-03-29 10:35:40 +02:00
Sami Kerola 37f44962dd include: [c.h]: remove strings.h include dublicate
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-03-08 13:08:54 +01:00
Sami Kerola c764e1a41d include: [c.h]: typeof to __typeof__ fix
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-03-08 13:08:48 +01:00
Sami Kerola 94d32126bf strutils: new wrapper function strtoll_or_err
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-02-21 15:32:50 +01:00
Petr Uzel 8ba013af64 include: [xalloc.h]: mention strdup in the file description
Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
2011-02-21 14:41:37 +01:00
Fabian Groffen eb76ca98b0 build-sys: provide alternatives for err, errx, warn and warnx
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-02-14 17:45:24 +01:00
Karel Zak 4799c95f94 include: [c.h]: add fallback for old libs without O_CLOEXEC
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-02-11 10:49:50 +01:00
Karel Zak 067e396b12 include: [at.h]: include c.h for PATH_MAX
Reported-by: Peter Breitenlohner <peb@mppmu.mpg.de>
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-02-11 10:36:12 +01:00
Karel Zak c25dc28dff include: [c.h]: add unused attribute to ignore_result()
unfortunately, gcc 4.6

	void fn (void) {
		int foo;
		foo = bar ();
	}

evaluates that foo is never used. The __attribute__((unused)) is
necessary...

Signed-off-by: Karel Zak <kzak@redhat.com>
2011-02-09 20:40:06 +01:00
Karel Zak 50a1e0cf8b include: [c.h]: fix __alloc_size__ test
Reported-by: Francesco Cosoleto <cosoleto@gmail.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-02-08 16:35:41 +01:00
Marek Polacek b45fa8b2f1 include: [xalloc.h] include string.h
xalloc.h needs string.h for declaration of strdup().  Otherwise we
can get implicit declaration warning.  This patch prevents it.

Signed-off-by: Marek Polacek <mpolacek@redhat.com>
2011-02-07 17:46:15 +01:00
Karel Zak 40084d0d5c include: [c.h] add fallback for alloc_size attributes
Reported-by: Davidlohr Bueso <dave@gnu.org>
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-02-07 17:29:47 +01:00
Karel Zak 2dd570ec85 include: [c.h] move ignore_result() to gcc-only block
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-02-07 15:52:21 +01:00
Fabian Groffen a804f444eb provide a workaround if program_invocation_short_name is missing
Try some replacements, such as getexecname() on Solaris and __progname
on BSDs and Darwin.  When not found, base program_invocation_short_name
on the source filename it is used in, as not to require argv[0] to be
passed along.  This latter approach is not dynamic, but doesn't require
code changes for all places where program_invocation_short_name is used
now.

Signed-off-by: Fabian Groffen <grobian@gentoo.org>
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-01-31 15:51:06 +01:00
Karel Zak 1f51db365f include: [tt] enlarge output buffer
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-01-25 00:24:17 +01:00
Fabian Groffen d58c47d9a4 include: emulate dirfd when necessary
dirfd is not available on Solaris 10, it is available on latest
OpenSolaris releases though.  Do some autoconf trickery to determine if
providing an alternative dirfd function is necessary and possible.

shlibs/blkid/src/read.c: Do not define _XOPEN_SOURCE to 600, or DIR will
lose it's dd_fd member again.  Rearrange defines and includes to make
sense per comments, and not conflict on Solaris.

Signed-off-by: Fabian Groffen <grobian@gentoo.org>
2011-01-23 22:17:14 +01:00
Karel Zak 3e27b34eb0 lib: [xalloc] don't use hardcoded return code
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-01-23 21:28:19 +01:00
Fabian Groffen 0bf9d41da2 build-sys: check for paths.h
paths.h doesn't exist on Solaris

Signed-off-by: Fabian Groffen <grobian@gentoo.org>
2011-01-20 23:47:52 +01:00
Fabian Groffen 3edaa2019b make _IO macros available on Solaris
The _IO macro is defined in sys/ioccom.h on various platforms.  However,
on Solaris it isn't included by ioctl.h, so include it explicitly if
available.

Signed-off-by: Fabian Groffen <grobian@gentoo.org>
2011-01-20 23:31:14 +01:00
Karel Zak 960f668f17 make major and minor available on Solaris
Reported-by: Fabian Groffen <grobian@gentoo.org>
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-01-20 23:16:41 +01:00
Fabian Groffen 5be1c0330b build-sys: check for loff_t, it may not exist
On some systems, loff_t does not exist.  Define it as int64_t in that
case.

Signed-off-by: Fabian Groffen <grobian@gentoo.org>
2011-01-20 22:40:58 +01:00
Karel Zak bded43d7ca build-sys: add rpmatch.h to Makefile.am
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-01-19 09:42:28 +01:00
Fabian Groffen aabe244176 build-sys: use WORDS_BIGENDIAN to determine platform byte-order
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-17 15:34:45 +01:00
Karel Zak 85950b68e4 include: fix list.h ifdefs
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-01-14 15:49:07 +01:00
Francesco Cosoleto e66ac5d344 include: add fallback for rpmatch()
Simple replacement code with hardcoded y/n responses to allow
compilation on systems without rpmatch() such as Cygwin.

Signed-off-by: Francesco Cosoleto <cosoleto@gmail.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-01-05 16:18:08 +01:00
Karel Zak 06ceeef851 lib: [c] add ignore_result()
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-01-04 21:34:45 +01:00
Karel Zak 049caefdcf findmnt: add --submounts option
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-01-04 14:01:33 +01:00
Karel Zak 035507c84b lib: [env] consolidate safe_getenv() usage
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-01-03 12:28:48 +01:00
Karel Zak 5ac6a13327 libmount: cleanup mangle() usage
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-01-03 12:28:47 +01:00
Karel Zak dd36965211 libmount: use better format for utab, improve bind mounts
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-01-03 12:28:46 +01:00