Commit Graph

5638 Commits

Author SHA1 Message Date
Milan Broz 99f43b721f lsblk: Add vendor column
Signed-off-by: Milan Broz <mbroz@redhat.com>
2012-11-07 13:20:42 +01:00
Milan Broz d6681ceeb1 lsblk: Add revision column
Signed-off-by: Milan Broz <mbroz@redhat.com>
2012-11-07 13:20:26 +01:00
Michal Schmidt c13d60b291 agetty: fix autodetection for TERM
open_tty() autodetects whether to set TERM to "linux" or "vt102", but it
can apply the result only if op->term is still NULL.
2012-11-02 12:38:25 +01:00
Davidlohr Bueso 3f73100190 gpt: create empty disklabels
This patch enables creating a new, empty, GPT disklabel from either
an empty disk or one that already has a disklabel. For this
purpose, a 'g' option is added to the main menu and is visible to all
labels. Here's an example for a scsi_debug device (/dev/sdb):

...
Device does not contain a recognized partition table
Building a new DOS disklabel with disk identifier 0x20a614c8.
3696: fdisk:  CONTEXT: zeroize in-memory first sector buffer

Command (m for help): g
3696: fdisk:    LABEL: changing to gpt label

3696: fdisk:  CONTEXT: zeroize in-memory first sector buffer
3696: fdisk:    LABEL: created new empty GPT disklabel (GUID: D4EA0706-F011-46DC-B7DE-6A72C7090AF8)

Command (m for help): w
The partition table has been altered!
...

Acked-by: Petr Uzel <petr.uzel@suse.cz>
Signed-off-by: Davidlohr Bueso <dave@gnu.org>
2012-11-02 12:26:17 +01:00
Davidlohr Bueso 1961311196 fdisk: gpt: write entire first sector
We were writing only 1 byte in LBA0, and GPT requires dealing with an entire
sector. This bug wasn't affecting when dealing with already existing devices
with GPT as we weren't writing an important part of the first sector, thus
leaving it unchanged. Also use write_all() wrapper from all-io.h

Acked-by: Petr Uzel <petr.uzel@suse.cz>
Signed-off-by: Davidlohr Bueso <dave@gnu.org>
2012-11-02 12:25:47 +01:00
Karel Zak e21e6d265d build-sys: cleanup cpu_set_t usage
- make taskset depend on cpu_set_t
 - make cpuset.c optional for libcommon and lib/path.c

Signed-off-by: Karel Zak <kzak@redhat.com>
2012-11-02 12:07:36 +01:00
Karel Zak 6cf20040dd sfdisk: fix formatting typo in man page
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-11-02 09:17:49 +01:00
Karel Zak 47b014f776 su: fix stupid typo
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-11-01 13:03:28 +01:00
Karel Zak 5b68dea9d5 build-sys: move runuser(1) to sbin dir
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-11-01 12:01:52 +01:00
Karel Zak 7a7f9d3886 runuser: add -u to not execute shell
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-11-01 10:36:35 +01:00
Karel Zak 59414c6b4a mount: supports paths canonicalization for alternative fstabs
# mount --fstab /path/my.fstab

has to support standard operations with paths.

Signed-off-by: Karel Zak <kzak@redhat.com>
2012-10-24 23:59:04 +02:00
Karel Zak b2cbe99f33 libmount: support loopdevs in mnt_table_is_fs_mounted()
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-10-24 23:44:11 +02:00
Karel Zak 449a7646d0 libmount: tiny refactoring in mnt_table_is_fs_mounted()
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-10-23 15:45:50 +02:00
Karel Zak 8f3b568cd7 fdisk: fix compiler warning [-Wpointer-arith] and floating point exception
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-10-23 15:10:26 +02:00
Karel Zak 9f51089e7f misc: make readlink() usage more robust
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-10-23 12:40:39 +02:00
Karel Zak 2f2f7e80f1 lsblk: use new sysfs functions, clean up get_transport()
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-10-23 12:21:37 +02:00
Karel Zak a5dc4d2d95 lib/sysfs: add SCSI link functions
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-10-23 12:21:23 +02:00
Karel Zak 23a11c74a6 lib/sysfs: add functions for SCSI host attributes
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-10-23 12:18:57 +02:00
Karel Zak d0f7e5b4a0 include/sysfs: add SCSI host:channel:target:lun support
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-10-23 12:15:58 +02:00
Karel Zak c47681b4e4 lib/tt: don't ignore "extreme" columns if an free space is available
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-10-23 10:56:23 +02:00
Milan Broz a5fb4d23eb lsblk: add SCSI transport type attribute
Patch adds "SCSI transport layer" similar attribute to "lsscsi -t".

This is useful for script where you want to distinguish e.g. FC, iSCSI
or USB devices from local disks.

Detection logic is quite simplified in comparison to lsscsi but it
should provide the same output (except detailed transport attributes).

Signed-off-by: Milan Broz <mbroz@redhat.com>
2012-10-23 10:27:07 +02:00
Milan Broz 699e5c4f96 lsblk: add SCSI H:C:T:L attribute
For block devices it is sometimes useful to print SCSI device ID"
Host:Channel:Target:LUN.

Patch adds column name HCTL which can be used in lsblk.

Signed-off-by: Milan Broz <mbroz@redhat.com>
2012-10-23 10:27:06 +02:00
Milan Broz 310c060356 lsblk: add parent kernel name column
For raw output used in scripts it is sometimes necessary
to reconstruct tree of devices.

Parent kernel name (PKNAME) provides needed information
to do that easily.

Signed-off-by: Milan Broz <mbroz@redhat.com>
2012-10-23 10:27:04 +02:00
Karel Zak b8ac29e80f login: fix compiler warning [-Wunused-result]
It's probably unnecessary paranoia, but let's check if we're able to
restore the original IDs after ~/.hushlogin file check.

Signed-off-by: Karel Zak <kzak@redhat.com>
2012-10-22 13:13:02 +02:00
Karel Zak 2a31396a9c include/c: move usleep() fallback to c.h
To make it available everywhere in code.

Signed-off-by: Karel Zak <kzak@redhat.com>
2012-10-22 11:03:09 +02:00
Sami Kerola dab8e8cfd4 build-sys: remove gethostbyname() check
Removed as unnecessary, there are no references to gethostbyname() in
code.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-10-22 10:15:29 +02:00
Sami Kerola 74b3df85f7 agetty: replace gethostbyname() with getaddrinfo()
The gethostbyname() is legacy function which may be withdrawn in a
future.

Reference: http://pubs.opengroup.org/onlinepubs/009695399/functions/gethostbyname.html
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-10-22 10:14:36 +02:00
Sami Kerola 24f4db6972 logger: replace gethostbyname() with getaddrinfo()
The gethostbyname() is legacy function which may be withdrawn in a
future.

Reference: http://pubs.opengroup.org/onlinepubs/009695399/functions/gethostbyname.html
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-10-22 10:14:24 +02:00
Sami Kerola 913e43b8e2 libmount, eject: replace index() and rindex() with strrch() or strrchr()
Both index() and rindex() are legacy functions which may be withdrawn in
a future.

Reference: http://pubs.opengroup.org/onlinepubs/009695399/functions/index.html
Reference: http://pubs.opengroup.org/onlinepubs/009695399/functions/rindex.html
Acked-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-10-22 10:13:32 +02:00
Karel Zak 6c32ae7868 fsck.cramfs: compile with -DINCLUDE_FS_TESTS for make check
make check
 sudo su -
 cd tests
 ./run.sh cramfs

Signed-off-by: Karel Zak <kzak@redhat.com>
2012-10-22 10:10:55 +02:00
Sami Kerola ed56c96731 docs: add line breaks to whereis.1
Fix to tools script checkmans.sh warning.

testing: /home/src/util-linux/misc-utils/whereis.1
:120: warning [p 1, 10.8i, div `an-div', 0.0i]: can't break line

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-10-19 16:58:57 +02:00
Karel Zak 4ca5163aa4 include/c: remove MAXHOSTNAMELEN macro
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-10-19 16:58:11 +02:00
Karel Zak 7ff8163815 last: stop usig MAXHOSTNAMELEN
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-10-19 16:56:57 +02:00
Karel Zak a0fc344b78 write: stop using MAXHOSTNAMELEN
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-10-19 16:27:58 +02:00
Karel Zak 2448f33637 agetty: stop using MAXHOSTNAMELEN
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-10-19 16:27:46 +02:00
Karel Zak f0196a13af login: stop using MAXHOSTNAMELEN
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-10-19 16:27:29 +02:00
Karel Zak 1b2aa6293d include/xalloc: add xgethostname()
The new function allocates memory by xalloc() for hostname and
fill in the buffer by gethostname().

Signed-off-by: Karel Zak <kzak@redhat.com>
2012-10-19 16:23:54 +02:00
Sami Kerola e0b6ab5687 include/env: unify indentation
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-10-19 15:07:44 +02:00
Sami Kerola 1ee4dff724 include/c: add get_hostname_max() inline function
Using sysconf(_SC_HOST_NAME_MAX) does not work everywhere.  At such even
header values for hostname length should be preferred, and if nothing
else works guess the maxium being 64 bytes.

Based-on-code-by: Karel Zak <kzak@redhat.com>
CC: Mike Frysinger <vapier@gentoo.org>
References: http://www.spinics.net/lists/util-linux-ng/msg07050.html
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-10-19 14:50:27 +02:00
Davidlohr Bueso 0b3e1d9bae fdisk: gpt: use swap_efi_guid for new partitions
Signed-off-by: Davidlohr Bueso <dave@gnu.org>
2012-10-18 12:16:06 +02:00
Davidlohr Bueso 42c384fa98 fdisk: fix segfault when printing gpt raw data
Signed-off-by: Davidlohr Bueso <dave@gnu.org>
2012-10-18 12:16:01 +02:00
Davidlohr Bueso 537187be67 fdisk: api: improve some comments
Signed-off-by: Davidlohr Bueso <dave@gnu.org>
2012-10-18 12:15:40 +02:00
Davidlohr Bueso 1f5eb51b79 fdisk: api: propagate partition deletion to users
The generic fdisk_delete_partition() function returns 0 when a partition
is correctly deleted, otherwise it's corresponding error (negative values).
This, however, does not include problems that can occur in actual label
specific contexts, so we need to propagate the corresponding return code,
back to the user visible api.

Signed-off-by: Davidlohr Bueso <dave@gnu.org>
2012-10-18 12:15:33 +02:00
Karel Zak 2831866ed6 docs: update deprecated file
The goal is to consolidate the very basic linux commands and minimize
dependence on another packages (e.g. shadow-utils). It seems better to
keep newgrp, vipw and vigr as non-deprecated for now. Maybe we will
found a way how to improve the code. We will see... :-)

Signed-off-by: Karel Zak <kzak@redhat.com>
2012-10-18 10:48:01 +02:00
Karel Zak df0f2ad763 lib/loopdev: check for /sys
The current loopdev code prefers /sys to get information about
loop devices. The old methods like scan /dev are fallback solution
only. Unfortunately, the code does not check if /sys is mounted.

Addresses: http://blog.flameeyes.eu/2012/10/sophistication-can-be-bad
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-10-17 11:51:10 +02:00
Karel Zak f4bf95926a lib/loopdev: improve debug messages
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-10-17 11:42:21 +02:00
Ondrej Oprala 098ce273ca dmesg: Add a --color option to colorize error and panic messages
[kzak@redhat.com: - update man page
                  - colorize critical messages too]

Signed-off-by: Karel Zak <kzak@redhat.com>
Signed-off-by: Ondrej Oprala <ooprala@redhat.com>
2012-10-16 16:42:32 +02:00
Ondrej Oprala dfa68ad183 lib/color: add module for work with terminal colors
[kzak@redhat.com: - split from dmesg patch
                  - add more colors]

Signed-off-by: Ondrej Oprala <ooprala@redhat.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-10-16 16:39:00 +02:00
Bill Pemberton b4359220da mount: add long options for -L and -U to man page
The -L and -U flags both have long options too (--label and --uuid).
The usage() function will show them but the man page didn't list them.

Signed-off-by: Bill Pemberton <wfp5p@virginia.edu>
2012-10-16 15:29:57 +02:00
Bill Pemberton 249fd0114f mount: add -c abbreviation for --no-canonicalize to man page
The --no-canonicalize option can also be set using -c.  The --help for
mount shows this option but the man page did not.  Add -c to the man
page.

Signed-off-by: Bill Pemberton <wfp5p@virginia.edu>
2012-10-16 15:29:55 +02:00