Commit Graph

3645 Commits

Author SHA1 Message Date
Karel Zak 4e9b3bfda2 lib,cpuset: fix compiler warning [-Wuninitialized]
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-09-10 00:02:00 +02:00
Heiko Carstens 59fb133a02 chcpu,cpuset: reduce code duplication for cpu list parsing
Reduce code duplication and print better error message if an
unsupported cpu number was passed.

Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
2011-09-10 00:00:35 +02:00
Heiko Carstens f27ce0711c lib,cpuset: enforce stricter parsing of cpu lists
The current cpulist_parse() function ignores extra non-parsable characters at
the end of the to be parsed cpu list string.  E.g. it would accept something
like "0bla" and just set bit 0 in the cpu set.  Since such a string is invalid
implement stricter parsing that makes sure that everything of the string has
been succesfully parsed.

Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
2011-09-10 00:00:33 +02:00
Heiko Carstens 72232a267a lib,cpuset: fix stride handling in cpulist_parse()
If cpulist_parse() gets passed a cpu list with a stride value of 0 it will be
stuck in an endless loop.  E.g. the following cpu list will cause an endless
loop: "0-2:0".  Fix this by causing a parse error if the stride value is 0.

Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
2011-09-10 00:00:24 +02:00
Heiko Carstens 289127f52d lib,cpuset: fix odd placed braces in cpulist_parse()
The opening and closing braces for two following if statements within
cpulist_parse() are placed in an odd manner.
Just fix this to prevent broken code in the future.

Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
2011-09-10 00:00:15 +02:00
Heiko Carstens 68845fed01 lib,cpuset: fix comments for cpu mask/list functions
The comments for cpumask_parse() and cpulist_parse() each describe
the wrong function. Just exchange the comments.

Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
2011-09-10 00:00:14 +02:00
Frederik \"Freso\" S. Olesen cbdf0a8165 mount: remove superfluous "an" under ext4 mount options in mount.8
Signed-off-by: Frederik "Freso" S. Olesen <freso@freso.dk>
2011-09-09 23:56:58 +02:00
Heiko Carstens 10829cd73c lscpu: add Hypervisor to output
Some vendors have several hypervisors. Therefore it makes sense to not only
print out the hypervisor vendor but also the name of the hypervisor.

Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-09-09 23:54:01 +02:00
Heiko Carstens 603e7f10f1 lscpu: add s390 test case
Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
2011-09-09 23:50:55 +02:00
Karel Zak 23e9e95ac3 lscpu: add --online option
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-09-09 23:50:41 +02:00
Heiko Carstens 0ad29ff6b0 lscpu: add --all option
The parsable output includes only lines of online CPUs. To also include
lines for all offline CPUs the "--all" option can be specified.

Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
2011-09-09 23:50:01 +02:00
Heiko Carstens a7e5300c97 lscpu: add online state to output
lscpu only prints lines for online CPUs. At least for the human readable
list the offline CPUs are of interest as well. In order to distinguish
between online and offline CPUs introduce the "Online" column.
By default the human readable output now displays online and offline CPUs.
The parsable output is not changed. It will print only lines for online
CPUs as it used to do.

[kzak@redhat.com: - minor changes]

Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-09-09 23:49:22 +02:00
Heiko Carstens d231eea114 lscpu: add configured state to output
CPUs may be in a configured or deconfigured state depending if the CPU resource
may be used by the guest.  If a CPU is in configured state the guest may use it
(i.e. set it online). It it is in deconfigured state it cannot use it before
changing its state to configured.  Display this CPU attribute as well.

Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
2011-09-09 23:41:25 +02:00
Karel Zak ba45d8c1ea lscpu: add human readable extended cpu table output
Based on patch from Heiko Carstens <heiko.carstens@de.ibm.com>:

lscpu currently only supports a parsable output which contains a row for
each cpu and its attributes. This output contains only comas as separators
and is hard to read for humans.

Therefore add a new option "-e | --extended" which outputs the rows in a
much more readable (and non-parsable) form. Just like for the -p option a
list of columns can be specified that shall be included in the output.

By default this option will print all columns that contain data.

Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-09-09 23:41:01 +02:00
Karel Zak e3b3a2f3f8 lscpu: use buffer for data and headers
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-09-09 23:40:28 +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 8005924a89 lscpu: cleanup output modes
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-09-09 07:25:21 +02:00
Heiko Carstens 44de912cdf lscpu: add --version option
Add a --version option like most other tools have it.

Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-09-09 06:34:43 +02:00
Heiko Carstens dcdead4271 lscpu: allow read_cache() to be called for offline cpus
First check path before accessing files to be sure they actually exist. This is
necessary when also informations for offline CPUs will be printed.  Since we do
not necessarily know if "cpu is offline" means the same as "path does not
exist" just check for it.

Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
2011-09-09 06:30:06 +02:00
Heiko Carstens f6512068b2 lscpu: simplify cache column output function
Simplify the logic to "always print a ',' for each cache except if it is the
last one.  This is also a preparation patch for printing the cache column for
offline CPUs where it would print one colon too much because of the current
logic.

Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
2011-09-09 06:24:26 +02:00
Heiko Carstens 08cd09415a lscpu: fix cache output for extended parsable output
The extended parsable output prints a colon instead of comma between each
item. The case where a CPU doesn't belong to any cache was not converted.
Just fix this.

Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
2011-09-09 06:24:14 +02:00
Heiko Carstens c403ae6a1a lscpu: remove comma operator
Fix typo where the comma operator has been introduced.
Use a semicolon instead so we end up with simple assignment expressions.

Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
2011-09-09 06:24:12 +02:00
Karel Zak bb6f91636c mount: fix compiler warning [-Wunused-parameter]
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-09-08 19:54:22 +02:00
Karel Zak c672220f1c dmesg: add --file option
This new option is mostly for testing (to test raw logs from another
boxes/kernels).

Signed-off-by: Karel Zak <kzak@redhat.com>
2011-09-08 19:40:34 +02:00
Karel Zak 4d84fcb4c7 script: libintl.h included in nls.h
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-09-07 16:29:56 +02:00
Philipp Marek 1e03bc3beb libblkid: DRBD proxy data-log identification.
Signed-off-by: Philipp Marek <philipp.marek@linbit.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-09-07 08:11:07 +02:00
Philipp Marek 8f2b1e8411 libblkid: new magic for 8.4 style (unclean) activity log.
Signed-off-by: Philipp Marek <philipp.marek@linbit.com>
2011-09-07 07:58:16 +02:00
maximilian attems 8f4bdfaced libuuid: add limits.h include for OPEN_MAX
Needed as definition for usage in close_all_fds().
Noticed on klibc build.

Signed-off-by: maximilian attems <max@stro.at>
2011-09-07 07:45:52 +02:00
Karel Zak 89aed1c950 agetty: double equals sign typo in opentty()
Reported-by: Francesco Cosoleto <cosoleto@gmail.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-09-07 07:37:03 +02:00
Natanael Copa 3c911718df script: fix building with --disable-nls
We should only include the libintl.h when NLS is requested.

This fixes issue when building util-linux with uClibc.

Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
2011-09-07 07:30:35 +02:00
Karel Zak b89fdd9c05 write: fix path for freopen()
Reported-by: xinglp <xinglp@gmail.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-09-06 03:18:46 +02:00
Karel Zak 31c9099a81 dmesg: remove extra space only after time stamp
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-09-02 14:42:04 +02:00
Karel Zak 9637c8ac7e build-sys: remove redundant __progname check
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-08-31 17:10:31 +02:00
Davidlohr Bueso 0e9381133e partx: support loop devices
Add support for loop devices to add partitions. For now we make use of the
max_part parameter from the loop kernel module, otherwise the feature is
disabled.

Below an example output:

root@offbook:~/projects/util-linux/partx# ./partx -a -n 1:5 images-pt/dos+bsd.img
root@offbook:~/projects/util-linux/partx# ls /dev/loop0* -ltr
brw-rw---- 1 root disk 7, 0 2011-08-15 00:07 /dev/loop0
brw-rw---- 1 root disk 7, 5 2011-08-15 00:07 /dev/loop0p5
brw-rw---- 1 root disk 7, 2 2011-08-15 00:07 /dev/loop0p2
brw-rw---- 1 root disk 7, 1 2011-08-15 00:07 /dev/loop0p1

Signed-off-by: Davidlohr Bueso <dave@gnu.org>
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-08-31 16:51:48 +02:00
Karel Zak 22f6982577 dmesg: fix for non-CONFIG_PRINTK_TIME kernels
* dmesg(1) incorrectly assumes that lines like "<6>\n"
   are broken.

 * it's more robust to assume the end of the record is "\n<"

 * print \n for empty lines

Reported-by: "Gabor Z. Papp" <gzp@papp.hu>
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-08-31 12:36:02 +02:00
Karel Zak cc69f339c1 whereis: fix gcc warnings [-Wsign-compare]
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-08-31 11:58:01 +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
Karel Zak da9629917d docs: use .LGPL extension for file with GNU Lesser License
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-08-31 11:12:17 +02:00
Karel Zak fa25f2289c Merge branch 'docs-dir' of https://github.com/kerolasa/lelux-utiliteetit
* 'docs-dir' of https://github.com/kerolasa/lelux-utiliteetit:
  docs: remove duplicated text
  docs: require kernel support before accepting use of it
  docs: note about independent super block structs
  docs: add libmount & libblkid debug instructions
  Documentation: add debugging doc
  arch: start using arch as a usage() example
  docs: new file Documentation/release-schedule.txt
  docs: move setuid information from reame to hwclock.8
  docs: clean up old readme files
  docs: copy contributors from legacy files to AUTHORS
  docs: new file Documentation/howto-man-page.txt
  docs: new file Documentation/source-code-management.txt
  docs: new file Documentation/howto-contribute.txt
  docs: new file Documentation/howto-compilation.txt
  docs: tell what the Documentation/ is about
  docs: add usage() howto for contributors
  docs: Documentation directory added
  docs: remove README.clear
2011-08-31 11:04:15 +02:00
Sami Kerola ce0efc40a1 docs: remove duplicated text
Duplicate text is dealt by referring to license files. The `pg'
command does not need separated license file because the source
file has same text at top of it.

http://www.spinics.net/lists/util-linux-ng/msg05069.html

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-08-30 19:50:34 +02:00
Karel Zak e8a728df31 Merge branch 'lscpu' of git://git.kernel.org/pub/scm/linux/kernel/git/heiko/util-linux
* 'lscpu' of git://git.kernel.org/pub/scm/linux/kernel/git/heiko/util-linux:
  lscpu: add physical cpu address to parseable output
  lscpu: add cpu polarization to parseable output
  lscpu: show dispatching mode
  lscpu: use hypervisor generated topology information
  lscpu: detect IBM hypervisor
  lscpu: fix fallback nthreads calculation
  lscpu: fix cpu map array sizes
  lscpu: fix s390 bogomips detection coding style
2011-08-30 12:05:05 +02:00
Petr Uzel 84895878d0 sfdisk.8: fix formatting
Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
2011-08-30 11:53:31 +02:00
maximilian attems 89c5005380 raw: fix shadowing of minor function
Noticed while compiling against klibc:
raw.c: In function ‘query’:
raw.c:219:16: error: called object ‘minor’ is not a function

Rename variable from minor to minor_raw.
While at it mark the functions as static and small whitespace fixes
as asked by checkpatch.

[kzak@redhat.com: - rename variable at line 241 too]

Signed-off-by: maximilian attems <max@stro.at>
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-08-30 11:52:03 +02:00
Karel Zak 4ff826f68a whereis: search in path for binaries only
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-08-30 11:44:15 +02:00
Davidlohr Bueso f51be85982 whereis: search in path
Currently this tool only uses the hardcoded paths for looking up strings for
binaries, man pages and source code.  Adding directories found in $PATH makes a
nice little enhancement to support a wider range of lookups.

This feature was also discussed previously here
(http://www.spinics.net/lists/util-linux-ng/msg03429.html)

Signed-off-by: Davidlohr Bueso <dave@gnu.org>
2011-08-30 11:16:43 +02:00
Francesco Cosoleto 41fc17521d tests: update fdisk and blkid MD tests
Signed-off-by: Francesco Cosoleto <cosoleto@gmail.com>
2011-08-30 10:55:13 +02:00
Francesco Cosoleto d0bcd9b322 tests: add ts_fdisk_clean function to make fdisk output comparable
Signed-off-by: Francesco Cosoleto <cosoleto@gmail.com>
2011-08-30 10:54:37 +02:00
Francesco Cosoleto 9777759ad6 fdisk: print welcome message
This adds a welcome message with util-linux version number, information
about fdisk behaviour that doesn't write to disk after a command (unlike
gparted) and a warning about possible data loss.

The message appears just before the first command prompt.

Signed-off-by: Francesco Cosoleto <cosoleto@gmail.com>
2011-08-30 10:54:37 +02:00
Francesco Cosoleto a75ba1319e fdisk: print partition deleted message
Signed-off-by: Francesco Cosoleto <cosoleto@gmail.com>
2011-08-30 10:53:39 +02:00
Francesco Cosoleto 20aa2570e8 fdisk: print a message with size and type of created partition
Signed-off-by: Francesco Cosoleto <cosoleto@gmail.com>
2011-08-30 10:53:22 +02:00