Commit Graph

174 Commits

Author SHA1 Message Date
Dave Reisner
12218ccde2 include,xalloc: fix whitespace to be consistent
We use spaces for the rest of this file, so the random tabs within
xstrdup stand out.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2011-09-30 00:24:16 +02:00
Dave Reisner
8ddb6b0cae include,xalloc: check for NULL before calling strdup
This fixes a segfault in mount (and possibly elsewhere) when invoked
without a -t parameter.

Broken in 7ef9fd7 when the common xalloc.h libs were introduced.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2011-09-30 00:24:05 +02:00
Karel Zak
aee31ddc59 lib,loopdev: add debugu messages
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-09-29 23:28:36 +02:00
Petr Uzel
960cf5737e misc: use %m in format string instead of %s and strerror(errno)
Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
2011-09-27 15:46:07 +02:00
Karel Zak
716e6f5c9a build-sys: add path.h to Makefile.am
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-09-27 14:59:57 +02:00
Heiko Carstens
9bc2b4b185 chcpu: convert to use lib/path.c
Use the common path access functions. In order to simplify chcpu also implement
and use path_writestr() which writes a string to the path specified.

Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
2011-09-27 13:36:54 +02:00
Heiko Carstens
8148217b5b lib,path: move path access functions from lscpu into lib/path.c
A couple of these functions already have been copied to chcpu.c,
so it makes sense to move these functions into an own file.

Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
2011-09-27 13:36:41 +02:00
Karel Zak
9fc7bf00ad Merge branch 'sys-utils' of https://github.com/kerolasa/lelux-utiliteetit
* 'sys-utils' of https://github.com/kerolasa/lelux-utiliteetit: (29 commits)
  docs: add non-return function and if shorthand tips
  build-sys: fixes to USAGE_* macros
  ipcrm: check IPC syscalls
  ipcrm: add --verbose option
  ipcmk: allow high speed ipc creation
  ipcrm: add --all option
  docs: add long options to ipcs.1 man page
  docs: add long options to ipcrm.1 man page
  docs: add long options to ipcmk.1 man page
  docs: add --version to setarch.8
  docs: mention long options in ctrlaltdel.8
  ctrlaltdel: add version & help options
  docs: mention long options in pivot_root.8
  pivot_root: add version & help option
  ipcs: comment & white space clean up
  ipcs: include-what-you-use header check
  ipcs: add long options
  ipcrm: include-what-you-use header check
  ipcrm: refactor new and old main to share code
  ipcrm: exit if unknown error occurs
  ...
2011-09-27 12:56:48 +02:00
Sami Kerola
6f162034d0 build-sys: fixes to USAGE_* macros
The USAGE_BEGIN_TAIL is removed as unnecessary.

In between command specific options and --help & --version
USAGE_SEPARATOR is inserted. For now the separator is empty line.

The USAGE_MAN_TAIL is changed to take an argument.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-09-17 15:07:52 +02:00
Karel Zak
e9d00e66fb include,c.h: include fcntl.h before check for O_CLOEXEC [smatch scan]
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-09-12 13:53:10 +02:00
Karel Zak
e9d659ea85 lscpu: use function to search in cpu masks arrays
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-09-09 23:27:40 +02:00
Karel Zak
b82c15bd19 Merge branch 'chcpu' of git://git.kernel.org/pub/scm/linux/kernel/git/heiko/util-linux
* 'chcpu' of git://git.kernel.org/pub/scm/linux/kernel/git/heiko/util-linux:
  chcpu: new tool
  cpuset: add option to allow cpulist_parse() to fail
2011-08-31 11:49:27 +02:00
Sami Kerola
cd7accd446 arch: start using arch as a usage() example
The arch command is hijacked to be example of howto write usage
as defined in Documentation/howto-usage-function.txt

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-08-28 10:50:36 +02:00
Heiko Carstens
b16f615afb cpuset: add option to allow cpulist_parse() to fail
This is a preparation patch for chcpu. If a cpu should be added to
a cpu_set where the cpu doesn't fit into the cpu_set this got silently
ignored.
Since the cpu-list is user space provided it should be checked if cpus
are specified that are completely out of range of the system.
In order to do that add a parameter which specifies if cpulist_parse()
should fail if it parses a cpu-list with "impossible" cpus.
The current callers have been converted so they behave like before.

Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
2011-08-15 07:52:44 +02:00
Benno Schulenberg
27cc25474f include: [nls.h] define a macro for handling plurals with ngettext()
Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
2011-08-02 14:13:44 +02:00
maximilian attems
4d49851351 include: [c.h] Include stdlib.h unconditionaly
No point in hiding it down in an ifdef maze,
as it may get used by exit(3).

Signed-off-by: maximilian attems <max@stro.at>
2011-08-02 13:58:46 +02:00
maximilian attems
4b2b671697 include: [c.h] move up declaration of program_invocation_short_name before usage
fixes:
../include/c.h: In function ‘errmsg’:
../include/c.h:111:26: error: ‘program_invocation_short_name’ undeclared
(first use in this function)
../include/c.h:111:26: note: each undeclared identifier is reported only
once for each function it appears in

Signed-off-by: maximilian attems <max@stro.at>
2011-08-02 13:58:24 +02:00
Karel Zak
330f543985 include: [writeall] add fwrite_all()
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-08-02 13:53:41 +02:00
Karel Zak
d1425592a2 include: [bitops.h] make return values consistent
The *_to_cpu() and cpu_to_*() macros have to return always the same date types
independently on CPU type.

Signed-off-by: Karel Zak <kzak@redhat.com>
2011-08-02 12:33:10 +02:00
Karel Zak
3922ef8025 lib: [tt.c] clean up used types
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-08-01 12:16:00 +02:00
Karel Zak
9feec79cc5 misc: use unsigned int for bit-fileds
Reported-by: Sami Kerola <kerolasa@iki.fi>
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-07-29 10:51:06 +02:00
Karel Zak
ce75b60528 build-sys: fix 'make checkincludes' warnings
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-07-28 13:21:00 +02:00
Karel Zak
c87638ad30 include: [strutils.c] add list parsers
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-07-27 16:41:21 +02:00
Karel Zak
bdc3ed6678 include; [tt.c] check for array size in columns parser
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-07-27 16:21:11 +02:00
Karel Zak
a4863bdf6e Merge branch 'hwclock' of https://github.com/kerolasa/lelux-utiliteetit 2011-07-27 09:56:39 +02:00
Sami Kerola
9d413ecb6e hwclock: move path definitions to pathnames.h
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-07-26 17:54:43 +02:00
Karel Zak
9ae45d23de Merge branch 'cramfs' of https://github.com/kerolasa/lelux-utiliteetit
* 'cramfs' of https://github.com/kerolasa/lelux-utiliteetit:
  include: move fsck return values to exitcodes.h
  include: move disk-utils/mkfs.h -> include/exitcodes.h
  mkfs.cramfs: coding style
  mkfs.cramfs: include-what-you-use header check
  mkfs.cramfs: error printing fixes
  mkfs.cramfs: convert spaces to tabs
  mkfs.cramfs: validate numeric user inputs
  mkfs.cramfs: few symbolic exit codes where missing
  md5: use symbolical digest length
  mkfs.cramfs: use program_invocation_short_name
  mkfs.cramfs: use xalloc.h
  fsck.cramfs: add missed strings to translation
  fsck.cramfs: coding style
  fsck.cramfs: use xalloc.h
  fsck.cramfs: retire die function
  cramfs.h: coding style
  cramfs: use stdint.h instead of u{8,16,32}
  cramfs_common: coding style

Conflicts:
	disk-utils/Makefile.am

Signed-off-by: Karel Zak <kzak@redhat.com>
2011-07-26 14:41:28 +02:00
Sami Kerola
5d6fb944bf include: move fsck return values to exitcodes.h
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-07-22 00:34:12 +02:00
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
Karel Zak
c1d26b1981 minix: add MINIX_ prefix to some global macros
... and remove some tailing whitespaces.

Signed-off-by: Karel Zak <kzak@redhat.com>
2011-07-21 12:23:01 +02:00
Karel Zak
058cda4c1d minix: cleanup global variables and macros
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-07-21 12:13:33 +02:00
Sami Kerola
e9ab36a73a libblkid: move MINIX_MAXPARTITIONS to minix.h
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-07-20 20:43:40 +02:00
Sami Kerola
7cc112d927 minix: move globals and inline functions to minix_programs.h
Global variables and inline functions are moved from minix.h to
minix_programs.h which is included in mkfs.minix and fsck.minix.
The minix.h will have only struct definitions etc generic
contents which is reasonable to share with utilities and
libraries.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-07-20 20:43:16 +02:00
Sami Kerola
63883af765 libblkid: use MINIX_BLOCK_SIZE from minix.h
In the minix.h two definitions where renamed, so that the single
definition is reusable in fsck.minix, mkfs.minix and libblkid.

BLOCK_SIZE_BITS -> MINIX_BLOCK_SIZE_BITS
BLOCK_SIZE      -> MINIX_BLOCK_SIZE

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-07-20 20:13:08 +02:00
Sami Kerola
532055e2e6 include: move minix.h to include directory
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-07-20 19:58:51 +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