]> git.ipfire.org Git - thirdparty/util-linux.git/log
thirdparty/util-linux.git
12 years agoipcs: read shared memory values from /proc
Sami Kerola [Sun, 14 Oct 2012 15:01:05 +0000 (16:01 +0100)] 
ipcs: read shared memory values from /proc

[kzak@redhat.com: - move to ipcutils.{c,h},
                  - fix datatypes to be arch independent]

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agoipcs: determine ipc limits from /proc
Sami Kerola [Sun, 21 Oct 2012 16:40:28 +0000 (17:40 +0100)] 
ipcs: determine ipc limits from /proc

Some of the limit values are not dynamic.  Like in kernel these values
are #defined.

[kzak@redhat.com: - use better names for functions,
                  - add ipcutils.{c,h}
                  - read also shmmax from /proc]

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agolib/path: add path_read_u64()
Karel Zak [Mon, 5 Nov 2012 11:28:00 +0000 (12:28 +0100)] 
lib/path: add path_read_u64()

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agolib/path: rename functions to be more explicit
Karel Zak [Mon, 5 Nov 2012 11:23:55 +0000 (12:23 +0100)] 
lib/path: rename functions to be more explicit

 ... and to have names compatible with lib/sysfs.c

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agoipcs: add /proc and /sys path definitions
Sami Kerola [Sun, 21 Oct 2012 16:39:36 +0000 (17:39 +0100)] 
ipcs: add /proc and /sys path definitions

The necessary proc and sysfs files are tested to be present.  When
information files are missing the ipcs will use obsolted system calls,
and data structures, as fallback.

[kzak@redhat.com: - fix #define _PATH_PROC_IPC_MSG "/proc/sys/kernel/sem" typo]

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agosu: log failed logins to btmp
Karel Zak [Thu, 22 Nov 2012 14:23:14 +0000 (15:23 +0100)] 
su: log failed logins to btmp

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agosu: use get_terminal_name() for compatibility with login(1)
Karel Zak [Thu, 22 Nov 2012 13:45:49 +0000 (14:45 +0100)] 
su: use get_terminal_name() for compatibility with login(1)

login(1) uses tty name (!= path) in the syslog messages.

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agologin: use get_terminal_name() from ttyutils.c
Karel Zak [Thu, 22 Nov 2012 13:42:10 +0000 (14:42 +0100)] 
login: use get_terminal_name() from ttyutils.c

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agolib/ttyutils: add get_terminal_name()
Karel Zak [Thu, 22 Nov 2012 13:36:17 +0000 (14:36 +0100)] 
lib/ttyutils: add get_terminal_name()

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agolib/ttyutils: add test program
Karel Zak [Thu, 22 Nov 2012 13:32:21 +0000 (14:32 +0100)] 
lib/ttyutils: add test program

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agolib/ttyutils: create .c file
Karel Zak [Thu, 22 Nov 2012 13:26:41 +0000 (14:26 +0100)] 
lib/ttyutils: create .c file

Well, now all tty stuff are incline functions in include/ttyutils.h.
It's seems more elegant to create regular lib/ttyutils.c for libcommon
and write test program.

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agobuild-sys: use libcommon.a for lslocks
Karel Zak [Thu, 22 Nov 2012 13:25:10 +0000 (14:25 +0100)] 
build-sys: use libcommon.a for lslocks

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agosu: rename log_su to log_syslog
Karel Zak [Thu, 22 Nov 2012 12:53:25 +0000 (13:53 +0100)] 
su: rename log_su to log_syslog

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agoagetty: remove @ and # as default kill and erase chars
Karel Zak [Thu, 22 Nov 2012 10:23:53 +0000 (11:23 +0100)] 
agetty: remove @ and # as default kill and erase chars

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agoagetty: add --{erase,kill}-chars options
Karel Zak [Thu, 22 Nov 2012 10:14:02 +0000 (11:14 +0100)] 
agetty: add --{erase,kill}-chars options

We need way to disable the default kill and erase agetty chars to make
the getty usable for Active Directory users with '@' in username.

It seems that the most extendible solution is to add options that
allow to complete control additional erase/kill chars. If you specify
empty strings then the chars are disabled at all.

Note that this patch is backwardly compatible.

Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=870854
Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agolibblkid: (gpt) don't modify in memory buffers
Karel Zak [Wed, 21 Nov 2012 14:47:56 +0000 (15:47 +0100)] 
libblkid: (gpt) don't modify in memory buffers

LIBBLKID_DEBUG=0xffff blkid -p ....

gpt: ---> call probefunc()
reuse buffer: off=0 len=1024 pr=0xb0b690
reuse buffer: off=0 len=1024 pr=0xb0b690
reuse buffer: off=1024 len=16384 pr=0xb0b690
GPT entries corrupted
reuse buffer: off=10737417728 len=512 pr=0xb0b690
reuse buffer: off=10737401344 len=16384 pr=0xb0b690
GPT entries corrupted
gpt: <--- (rc = 1)

Reported-by: Dave Reisner <d@falconindy.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agowipefs: Add --force option to force it to erase.
Richard W.M. Jones [Mon, 19 Nov 2012 15:02:13 +0000 (15:02 +0000)] 
wipefs: Add --force option to force it to erase.

Commit c550f728f724360f99aae0fdb45b0589d9a347e0 added O_EXCL when
opening the thing to erase.  This broke the wipefs utility when used
on anything which isn't an unmounted filesystem.  eg. If you use it on
a block device containing partitions, then it won't work because the
kernel recognizes the partitions and so thinks the device is in use.

This change adds the --force option which, when used, undoes the above
flag change.  However you still have to use --force most of the time
when erasing something that isn't a plain unmounted filesystem.

Signed-off-by: Richard W.M. Jones <rjones@redhat.com>
12 years agoagetty: make --autologin useful with --skip-login (prompt)
Karel Zak [Mon, 19 Nov 2012 09:54:58 +0000 (10:54 +0100)] 
agetty: make --autologin useful with --skip-login (prompt)

The --autologin prints

hostname login: username (automatic login)

message. This commit allows to suppress the message at all if
--skip-login (aka skip prompt) is specified.

It means that

agetty --skip-login --noissue --autologin foouser

does completely silent autologin.

Addresses: https://github.com/karelzak/util-linux/issues/21
Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agouuidgen: fix --random
Karel Zak [Mon, 19 Nov 2012 08:50:08 +0000 (09:50 +0100)] 
uuidgen: fix --random

Addresses: https://github.com/karelzak/util-linux/issues/20
Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agoumount: (recursive) add a cache to the table
Dave Reisner [Fri, 16 Nov 2012 04:18:07 +0000 (23:18 -0500)] 
umount: (recursive) add a cache to the table

Without this table libmount will not resolve paths, meaning that
umounting by relative path will fail.

[kzak@redhat.com: - use mnt_context_get_cache() to make it sensitive
                    to --no-canonicalize cmdline option]

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agolibmount: fix support of comma-separated fs types lists
Gleb Fotengauer-Malinovskiy [Thu, 27 Sep 2012 16:48:34 +0000 (20:48 +0400)] 
libmount: fix support of comma-separated fs types lists

# grep cdrom /etc/fstab
/dev/sr0 /media/cdrom udf,iso9660 ro,noauto,user,utf8 0 0
# mount /media/cdrom
mount: unknown filesystem type 'udf,iso9660'

# mount -t udf,iso9660 /dev/sr0 /media/cdrom
mount: /dev/sr0 is write-protected, mounting read-only

[kzak@redhat.com: - add some comments
                  - don't try to found external helpers for the types]

Signed-off-by: Gleb Fotengauer-Malinovskiy <glebfm@altlinux.org>
Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agoumount: (recursive) don't call umount(2) for already unmounted targets
Karel Zak [Thu, 15 Nov 2012 15:44:07 +0000 (16:44 +0100)] 
umount: (recursive) don't call umount(2) for already unmounted targets

In the umount --recursive we follow entries from mountinfo, but the
entries maybe already obsolete. Especially if the hierarchy of the
mountpoints contains shared subtrees and umount(2) for one entry may
generate umount for some other entry too.

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agotests: add shared subtrees to umount --recursive test
Karel Zak [Thu, 15 Nov 2012 15:42:56 +0000 (16:42 +0100)] 
tests: add shared subtrees to umount --recursive test

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agolibmount: don't reset NOSWAPMATCH context flag
Karel Zak [Thu, 15 Nov 2012 15:42:05 +0000 (16:42 +0100)] 
libmount: don't reset NOSWAPMATCH context flag

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agolibmount: don't try to play with loopdevs if umount argument is really mountpoint
Karel Zak [Thu, 15 Nov 2012 14:59:59 +0000 (15:59 +0100)] 
libmount: don't try to play with loopdevs if umount argument is really mountpoint

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agolibmount: more robust tab filter usage
Karel Zak [Thu, 15 Nov 2012 14:35:24 +0000 (15:35 +0100)] 
libmount: more robust tab filter usage

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agotests: add umount --recursive test
Karel Zak [Thu, 15 Nov 2012 12:34:14 +0000 (13:34 +0100)] 
tests: add umount --recursive test

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agoumount: clean --recursive
Karel Zak [Thu, 15 Nov 2012 10:55:48 +0000 (11:55 +0100)] 
umount: clean --recursive

 - mark some options combinations mutually exclusive
 - reset libmount context before next umount (this is important!)

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agolibblkid: remove obsolete tags from cache
Karel Zak [Wed, 14 Nov 2012 12:14:29 +0000 (13:14 +0100)] 
libblkid: remove obsolete tags from cache

The libblkid cache tags are not removed if a new version of the
tags is empty (e.g. label 'foo' -> '').

 # mkfs.ext4 -L test_label /dev/sda15
 # blkid /dev/sda15
 /dev/sda15: LABEL="test_label"

 # tune2fs -L '' /dev/sda15
 # blkid /dev/sda15
 /dev/sda15: LABEL="test_label"
                    ^^^^^^^^^^

Reported-by: Mike Fleetwood <mike.fleetwood@googlemail.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agofdisk: gpt: check header size
Davidlohr Bueso [Wed, 14 Nov 2012 08:04:24 +0000 (00:04 -0800)] 
fdisk: gpt: check header size

UEFI states that the size of the GPT header must be between 92 and
the sector size. Add the check when verifying a valid header.

Signed-off-by: Davidlohr Bueso <dave@gnu.org>
12 years agofdisk: don't offer GPT stuff in BSD menu
Karel Zak [Tue, 13 Nov 2012 17:05:36 +0000 (18:05 +0100)] 
fdisk: don't offer GPT stuff in BSD menu

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agoumount: allways return MOUNT_EX_*
Karel Zak [Tue, 13 Nov 2012 15:50:02 +0000 (16:50 +0100)] 
umount: allways return MOUNT_EX_*

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agoumount: add -R, --recursive option
Dave Reisner [Wed, 7 Nov 2012 18:02:28 +0000 (13:02 -0500)] 
umount: add -R, --recursive option

This allows unmounting of an entire tree of filesystems, which might be
of particular interest for a shutdown initramfs.

[kzak@redhat.com: - always return MOUNT_EX_* codes
                  - cosmetic changes on coding style]

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agolscpu: make read_topology() more robust to avoid SIGFPE
Karel Zak [Tue, 13 Nov 2012 09:36:25 +0000 (10:36 +0100)] 
lscpu: make read_topology() more robust to avoid SIGFPE

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agotests: add armv7 lscpu dump
Karel Zak [Mon, 12 Nov 2012 15:21:29 +0000 (16:21 +0100)] 
tests: add armv7 lscpu dump

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agotests: add ppc64-POWER7-64cpu lscpu dump
Karel Zak [Mon, 12 Nov 2012 15:21:09 +0000 (16:21 +0100)] 
tests: add ppc64-POWER7-64cpu lscpu dump

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agotests: remove lscpu /sys dumps without 'possible' CPU mask
Karel Zak [Mon, 12 Nov 2012 14:00:24 +0000 (15:00 +0100)] 
tests: remove lscpu /sys dumps without 'possible' CPU mask

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agolscpu: Fix issue found on CPU hot-remove
Toshi Kani [Tue, 23 Oct 2012 19:49:46 +0000 (13:49 -0600)] 
lscpu: Fix issue found on CPU hot-remove

read_basicinfo() relies on sysfs cpu directories
"/sys/devices/system/cpu/cpu%d" with assumption that cpu
logical number %d is always sequentially assigned for all
CPUs. However, this assumption is not correct with CPU
hot-remove operation since it removes a target sysfs cpu
directory after it is ejected. As a result, lscpu may not
recognize all CPUs.

The issue can be easily reproduced on KVM or VirtualBox,
which supports CPU eject operation, as follows.

1) The system has 4 CPUs
  $ lscpu -a -e
  CPU NODE SOCKET CORE L1d:L1i:L2 ONLINE
  0   0    0      0    0:0:0      yes
  1   0    1      1    1:1:1      yes
  2   0    2      2    2:2:2      yes
  3   0    3      3    3:3:3      yes

2) Eject cpu2
  # echo 1 > /sys/bus/acpi/devices/LNXCPU:02/eject

3) lscpu no longer recognizes cpu3 after cpu2 is ejected
  $ lscpu -a -e
  CPU NODE SOCKET CORE L1d:L1i:L2 ONLINE
  0   0    0      0    0:0:0      yes
  1   0    1      1    1:1:1      yes

The following changes are made to address this issue.
 - Use maxcpus to allocate and parse bitmaps.
 - Set desc->ncpu from cpu/present, which includes both on-line
   and off-line CPUs.
 - Add is_cpu_present() to check if a CPU is present. Ejected
   CPUs are not present.

[kzak@redhat.com: - read also /sys/devices/system/cpu/possible mask to
                    determine maximal number of CPUs,
                  - err() if possible mask is not found in /sys]

Signed-off-by: Toshi Kani <toshi.kani@hp.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agolosetup: allow to use -O without --list
Karel Zak [Mon, 12 Nov 2012 13:36:29 +0000 (14:36 +0100)] 
losetup: allow to use -O without --list

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agolosetup: rename SIZE->SIZELIMIT
Karel Zak [Mon, 12 Nov 2012 12:24:45 +0000 (13:24 +0100)] 
losetup: rename SIZE->SIZELIMIT

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agodocs: mark old losetup output format as DEPRECATED
Karel Zak [Mon, 12 Nov 2012 12:23:19 +0000 (13:23 +0100)] 
docs: mark old losetup output format as DEPRECATED

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agolosetup: add --list and --output option
Ondrej Oprala [Mon, 12 Nov 2012 12:08:00 +0000 (13:08 +0100)] 
losetup: add --list and --output option

The --list --all is the default output:

  # losetup
  NAME       SIZE OFFSET AUTOCLEAR RO BACK-FILE
  /dev/loop0    0      0         0  0 /home/fs-images/swap.img
  /dev/loop1    0    100         0  0 /home/fs-images/disk.img

[kzak@redhat.com: - default to --all if no device specified,
                  - cleanup column names (add BACK- prefix)
                  - add MAJ:MIN to of the loopdev device]

Signed-off-by: Ondrej Oprala <ooprala@redhat.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agolib/loopdev: make loopcxt_get_device() more robust
Karel Zak [Mon, 12 Nov 2012 11:10:52 +0000 (12:10 +0100)] 
lib/loopdev: make loopcxt_get_device() more robust

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agolib/console: fix possible fd leak
Karel Zak [Fri, 9 Nov 2012 11:59:33 +0000 (12:59 +0100)] 
lib/console: fix possible fd leak

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agolib/consoles: try another methods before go to fallback
Karel Zak [Fri, 9 Nov 2012 11:52:33 +0000 (12:52 +0100)] 
lib/consoles: try another methods before go to fallback

The current code goes immediately to the fallback section if any
detection method fails. It seems better to try another methods before
the fallback solution.

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agolib/consoles: add debug messages
Karel Zak [Fri, 9 Nov 2012 11:44:00 +0000 (12:44 +0100)] 
lib/consoles: add debug messages

 - may be enabled by CONSOLES_DEBUG env. variable

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agolib/consoles: TIOCGDEV code refactoring
Karel Zak [Fri, 9 Nov 2012 11:18:31 +0000 (12:18 +0100)] 
lib/consoles: TIOCGDEV code refactoring

 - add missing scandev() otherwise TIOCGDEV make no sense
 - use this method independent on /proc/cmdline code

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agolib/consoles: cmdline code refactoring
Karel Zak [Fri, 9 Nov 2012 10:52:11 +0000 (11:52 +0100)] 
lib/consoles: cmdline code refactoring

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agolib/consoles: sysfs code refactoring
Karel Zak [Fri, 9 Nov 2012 10:17:23 +0000 (11:17 +0100)] 
lib/consoles: sysfs code refactoring

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agolib/consoles: /proc/consoles code refactoring
Karel Zak [Fri, 9 Nov 2012 09:49:56 +0000 (10:49 +0100)] 
lib/consoles: /proc/consoles code refactoring

 - move to separate function
 - cleanup code
 - fix fscanf() usage to avoid buffer overflow

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agolib/consoles: small cleanup
Karel Zak [Fri, 9 Nov 2012 09:30:14 +0000 (10:30 +0100)] 
lib/consoles: small cleanup

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agolib/consoles: don't call perror()
Karel Zak [Fri, 9 Nov 2012 09:18:49 +0000 (10:18 +0100)] 
lib/consoles: don't call perror()

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agolib/consoles: add test program
Karel Zak [Fri, 9 Nov 2012 09:12:35 +0000 (10:12 +0100)] 
lib/consoles: add test program

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agolib/consoles: remove global variable consoles
Karel Zak [Fri, 9 Nov 2012 09:06:23 +0000 (10:06 +0100)] 
lib/consoles: remove global variable consoles

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agolib/consolas: remove global variable concount, fix linked list
Karel Zak [Fri, 9 Nov 2012 08:52:35 +0000 (09:52 +0100)] 
lib/consolas: remove global variable concount, fix linked list

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agolib/consoles: remove global variable initcp
Karel Zak [Thu, 8 Nov 2012 16:25:09 +0000 (17:25 +0100)] 
lib/consoles: remove global variable initcp

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agolib/consoles: remove global variable comparedev
Karel Zak [Thu, 8 Nov 2012 16:22:45 +0000 (17:22 +0100)] 
lib/consoles: remove global variable comparedev

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agolib/consoles: minor clean ups
Karel Zak [Thu, 8 Nov 2012 16:04:01 +0000 (17:04 +0100)] 
lib/consoles: minor clean ups

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agolib/consoles: add code to detect all system consoles
Werner Fink [Thu, 8 Nov 2012 14:55:48 +0000 (15:55 +0100)] 
lib/consoles: add code to detect all system consoles

Signed-off-by: Werner Fink <werner@suse.de>
12 years agoscript: do not try to close stderr twice
Sami Kerola [Tue, 6 Nov 2012 21:14:14 +0000 (21:14 +0000)] 
script: do not try to close stderr twice

The commit cdd2a8c360c70d16804ace7cc923a6c6bb7c9ca9 broke script(1)
return value.

$ script -e -c "echo"; echo $?
1

The reason, as Daniel it reported, was that the script will close stderr
twice, once as timing file and atexit() in function close_stdout().  This
commit fixes the problem.

Reported-by: Daniel Narvaez <dwnarvaez@gmail.com>
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
12 years agolibmount: convert /dev/root from mountinfo to the device name
Karel Zak [Thu, 8 Nov 2012 13:43:38 +0000 (14:43 +0100)] 
libmount: convert /dev/root from mountinfo to the device name

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agolibmount: add private mnt_get_kernel_cmdline_option()
Karel Zak [Thu, 8 Nov 2012 10:52:23 +0000 (11:52 +0100)] 
libmount: add private mnt_get_kernel_cmdline_option()

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agodocs: update TODO file
Karel Zak [Wed, 7 Nov 2012 19:46:38 +0000 (20:46 +0100)] 
docs: update TODO file

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agosu: fix "COMMAND not specified" error
Karel Zak [Wed, 7 Nov 2012 14:20:39 +0000 (15:20 +0100)] 
su: fix "COMMAND not specified" error

 # su
 su: COMMAND not specified

This error message make sense for "runuser -u <user> <command>" only.

Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=872787
Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agolsblk: fix and update man page about --scsi
Karel Zak [Wed, 7 Nov 2012 13:39:43 +0000 (14:39 +0100)] 
lsblk: fix and update man page about --scsi

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agolsblk: add TRANsport to --scsi output
Karel Zak [Wed, 7 Nov 2012 13:34:51 +0000 (14:34 +0100)] 
lsblk: add TRANsport to --scsi output

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agolsblk: don't ignore disk device
Karel Zak [Wed, 7 Nov 2012 13:25:32 +0000 (14:25 +0100)] 
lsblk: don't ignore disk device

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agolsblk: Add --scsi switch
Milan Broz [Fri, 2 Nov 2012 17:56:31 +0000 (18:56 +0100)] 
lsblk: Add --scsi switch

The --scsi switch prints similar information to lsscsi command.

Signed-off-by: Milan Broz <mbroz@redhat.com>
12 years agolsblk: Add vendor column
Milan Broz [Fri, 2 Nov 2012 17:56:30 +0000 (18:56 +0100)] 
lsblk: Add vendor column

Signed-off-by: Milan Broz <mbroz@redhat.com>
12 years agolsblk: Add revision column
Milan Broz [Fri, 2 Nov 2012 17:56:29 +0000 (18:56 +0100)] 
lsblk: Add revision column

Signed-off-by: Milan Broz <mbroz@redhat.com>
12 years agoagetty: fix autodetection for TERM
Michal Schmidt [Mon, 29 Oct 2012 22:33:01 +0000 (23:33 +0100)] 
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.

12 years agogpt: create empty disklabels
Davidlohr Bueso [Sat, 27 Oct 2012 17:23:47 +0000 (19:23 +0200)] 
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>
12 years agofdisk: gpt: write entire first sector
Davidlohr Bueso [Sat, 27 Oct 2012 17:23:36 +0000 (19:23 +0200)] 
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>
12 years agobuild-sys: cleanup cpu_set_t usage
Karel Zak [Fri, 2 Nov 2012 11:07:36 +0000 (12:07 +0100)] 
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>
12 years agosfdisk: fix formatting typo in man page
Karel Zak [Fri, 2 Nov 2012 08:17:49 +0000 (09:17 +0100)] 
sfdisk: fix formatting typo in man page

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agosu: fix stupid typo
Karel Zak [Thu, 1 Nov 2012 12:03:28 +0000 (13:03 +0100)] 
su: fix stupid typo

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agobuild-sys: move runuser(1) to sbin dir
Karel Zak [Thu, 1 Nov 2012 11:01:52 +0000 (12:01 +0100)] 
build-sys: move runuser(1) to sbin dir

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agorunuser: add -u to not execute shell
Karel Zak [Thu, 13 Sep 2012 09:58:00 +0000 (11:58 +0200)] 
runuser: add -u to not execute shell

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agomount: supports paths canonicalization for alternative fstabs
Karel Zak [Wed, 24 Oct 2012 21:59:04 +0000 (23:59 +0200)] 
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>
12 years agolibmount: support loopdevs in mnt_table_is_fs_mounted()
Karel Zak [Wed, 24 Oct 2012 21:44:11 +0000 (23:44 +0200)] 
libmount: support loopdevs in mnt_table_is_fs_mounted()

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agolibmount: tiny refactoring in mnt_table_is_fs_mounted()
Karel Zak [Tue, 23 Oct 2012 13:45:50 +0000 (15:45 +0200)] 
libmount: tiny refactoring in mnt_table_is_fs_mounted()

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agofdisk: fix compiler warning [-Wpointer-arith] and floating point exception
Karel Zak [Tue, 23 Oct 2012 13:10:26 +0000 (15:10 +0200)] 
fdisk: fix compiler warning [-Wpointer-arith] and floating point exception

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agomisc: make readlink() usage more robust
Karel Zak [Tue, 23 Oct 2012 10:40:39 +0000 (12:40 +0200)] 
misc: make readlink() usage more robust

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agolsblk: use new sysfs functions, clean up get_transport()
Karel Zak [Tue, 23 Oct 2012 10:21:37 +0000 (12:21 +0200)] 
lsblk: use new sysfs functions, clean up get_transport()

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agolib/sysfs: add SCSI link functions
Karel Zak [Tue, 23 Oct 2012 10:12:07 +0000 (12:12 +0200)] 
lib/sysfs: add SCSI link functions

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agolib/sysfs: add functions for SCSI host attributes
Karel Zak [Tue, 23 Oct 2012 09:32:55 +0000 (11:32 +0200)] 
lib/sysfs: add functions for SCSI host attributes

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agoinclude/sysfs: add SCSI host:channel:target:lun support
Karel Zak [Tue, 23 Oct 2012 08:57:59 +0000 (10:57 +0200)] 
include/sysfs: add SCSI host:channel:target:lun support

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agolib/tt: don't ignore "extreme" columns if an free space is available
Karel Zak [Tue, 23 Oct 2012 08:56:23 +0000 (10:56 +0200)] 
lib/tt: don't ignore "extreme" columns if an free space is available

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agolsblk: add SCSI transport type attribute
Milan Broz [Fri, 19 Oct 2012 12:10:41 +0000 (14:10 +0200)] 
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>
12 years agolsblk: add SCSI H:C:T:L attribute
Milan Broz [Fri, 19 Oct 2012 12:10:40 +0000 (14:10 +0200)] 
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>
12 years agolsblk: add parent kernel name column
Milan Broz [Fri, 19 Oct 2012 12:10:39 +0000 (14:10 +0200)] 
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>
12 years agologin: fix compiler warning [-Wunused-result]
Karel Zak [Mon, 22 Oct 2012 11:13:02 +0000 (13:13 +0200)] 
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>
12 years agoinclude/c: move usleep() fallback to c.h
Karel Zak [Mon, 22 Oct 2012 09:03:09 +0000 (11:03 +0200)] 
include/c: move usleep() fallback to c.h

To make it available everywhere in code.

Signed-off-by: Karel Zak <kzak@redhat.com>
12 years agobuild-sys: remove gethostbyname() check
Sami Kerola [Fri, 12 Oct 2012 21:13:05 +0000 (22:13 +0100)] 
build-sys: remove gethostbyname() check

Removed as unnecessary, there are no references to gethostbyname() in
code.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
12 years agoagetty: replace gethostbyname() with getaddrinfo()
Sami Kerola [Fri, 12 Oct 2012 21:11:16 +0000 (22:11 +0100)] 
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>
12 years agologger: replace gethostbyname() with getaddrinfo()
Sami Kerola [Fri, 12 Oct 2012 20:28:41 +0000 (21:28 +0100)] 
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>
12 years agolibmount, eject: replace index() and rindex() with strrch() or strrchr()
Sami Kerola [Fri, 12 Oct 2012 19:23:54 +0000 (20:23 +0100)] 
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>
12 years agofsck.cramfs: compile with -DINCLUDE_FS_TESTS for make check
Karel Zak [Mon, 22 Oct 2012 08:10:55 +0000 (10:10 +0200)] 
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>
12 years agodocs: add line breaks to whereis.1
Sami Kerola [Wed, 10 Oct 2012 18:14:43 +0000 (19:14 +0100)] 
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>
12 years agoinclude/c: remove MAXHOSTNAMELEN macro
Karel Zak [Fri, 19 Oct 2012 14:58:11 +0000 (16:58 +0200)] 
include/c: remove MAXHOSTNAMELEN macro

Signed-off-by: Karel Zak <kzak@redhat.com>