Commit Graph

4687 Commits

Author SHA1 Message Date
Karel Zak 505abd8434 lib/pager: fix compiler warnings
pager.c: In function ‘start_command’:
pager.c:82:7: warning: unused variable ‘err’ [-Wunused-variable]
pager.c:49:25: warning: unused variable ‘fderr’ [-Wunused-variable]
pager.c:49:15: warning: unused variable ‘fdout’ [-Wunused-variable]
pager.c:48:25: warning: unused variable ‘need_err’ [-Wunused-variable]
pager.c:48:15: warning: unused variable ‘need_out’ [-Wunused-variable]

Signed-off-by: Karel Zak <kzak@redhat.com>
2012-04-23 11:57:50 +02:00
Davidlohr Bueso 35717a57ac lib: add pager functionality
When some program' output exceeds the terminal's dimensions, it is a nice
feature to call a pager that acts as calling 'less' to allow better user
navigation. This patch adds this functionality, based on what perf and git
have (ie: git log).

Signed-off-by: Davidlohr Bueso <dave@gnu.org>
2012-04-23 11:52:39 +02:00
Karel Zak 89394013f6 namei: fix relative symlinks evaluation
Fedora 17 (/bin is symlink to /usr/bin):

	[root@intel ~]# /bin/namei /bin/namei
	f: /bin/namei
	 d /
	 l bin -> usr/bin
	usr - No such file or directory

Reported-by: Jan Stancek <jstancek@redhat.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-04-20 15:06:57 +02:00
Karel Zak 3e90c89f95 docs: move fstab.5 to sys-utils (mount/ dir is deprecated)
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-04-19 14:48:40 +02:00
Karel Zak 9f9d0f21c4 swapon: add support for PARTUUID= and PARTLABEL=
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-04-19 14:40:22 +02:00
Karel Zak eb0eb262cb mount: (new) add support for PARTUUID= and PARTLABEL=
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-04-19 14:40:06 +02:00
Karel Zak aa0903e06b lsblk: add support for PARTUUID= and PARTLABEL=
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-04-19 14:39:44 +02:00
Karel Zak 090b5e84b2 findmnt: add support for PARTUUID= and PARTLABEL=
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-04-19 14:38:53 +02:00
Karel Zak 10b4d34dc0 blkid: add docs about PARTUUID= and PARTLABEL=
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-04-19 14:34:29 +02:00
Karel Zak cff632afc9 libmount: add support for PARTUUID= and PARTLABEL=
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-04-19 14:33:59 +02:00
Karel Zak fc387ee14c libblkid: add support for PARTUUID= and PARTLABEL=
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-04-19 14:33:49 +02:00
Karel Zak 21d1fa53f1 tests: tiny change in output header
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-04-18 13:14:43 +02:00
Karel Zak f947ae75b6 tests: remove LD_LIBRARY_PATH from swapon tests
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-04-18 13:05:55 +02:00
Karel Zak d335c9bd54 swapon: minor coding style changes
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-04-18 12:58:15 +02:00
Karel Zak 8b0d534155 swapon: cleanup usage()
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-04-18 12:52:13 +02:00
Karel Zak d9f07b100d swapon: cleanup main()
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-04-18 12:44:14 +02:00
Karel Zak 7cf6a65476 swapoff: cleanup usage() and includes
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-04-18 12:38:03 +02:00
Karel Zak d5360e9250 mount: fix man page typo s/reatime/relatime/
Reported-by: Kay Sievers <kay.sievers@vrfy.org>
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-04-18 12:25:28 +02:00
Karel Zak e7b63bea04 swapoff: use libmount to parse fstab
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-04-18 12:22:11 +02:00
Karel Zak 6cf8d46cee swapoff: move code from swapon.c to swapoff.c
* multipurpose binaries (symlinks) suck when used with autotools
 * swapoff shares small subset of the code with swapon
 * usage() and 'struct option' is unnecessary complex when shared
 * shorter and simple code is easer to maintain...

Signed-off-by: Karel Zak <kzak@redhat.com>
2012-04-18 11:43:42 +02:00
Karel Zak 0b0c231f64 swapon: move generic code to swapon-common.c
This will allow to use separate binary for swapon and swapoff.

Signed-off-by: Karel Zak <kzak@redhat.com>
2012-04-18 11:21:12 +02:00
Karel Zak 5072b90a65 swapon: use libmount for fstab parsing (for swapon --all)
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-04-18 10:14:44 +02:00
Karel Zak d789077846 mount: (new) be more pedantic about --make-*
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-04-18 10:09:49 +02:00
Karel Zak 5d451abbbf libmount: add mnt_context_get_options()
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-04-18 10:06:35 +02:00
Karel Zak e5157fc9f0 swapon: use only libmount for paths/tags evealuation
libmount provides very simple API for paths and tags canonicalizations,
let's use it, rather directly link to libblkid and lib/canonicalize.c.

Signed-off-by: Karel Zak <kzak@redhat.com>
2012-04-17 13:05:04 +02:00
Karel Zak 64b588814e swapon: use libmount for /proc/swaps parsing
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-04-17 12:49:11 +02:00
Karel Zak 58f108ef2b mount: (new) improve error messages
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-04-17 11:39:49 +02:00
Karel Zak e01c731992 libmount: add mnt_context_fstab_applied()
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-04-17 11:36:32 +02:00
Lennart Poettering 8fb6a2de79 wdctl: add watchdog status tool
For: util-linux

This patch adds a tiny tool "wdctl" which may be used to query the
status of Linux watchdog devices (/dev/watchdog).

This will simply query all fields that may be queried from the
device and print them nicely formatted.

Signed-off-by: Lennart Poettering <lennart@poettering.net>
2012-04-16 14:24:49 +02:00
James Le Cuirot 69cabd7204 cal: Fix building under uClibc.
Commit fbc333fec0 broke building under uClibc because HAVE_DECL macros are set to 0, not undefined.

Signed-off-by: James Le Cuirot <chewi@aura-online.co.uk>
2012-04-16 11:13:13 +01:00
Karel Zak cd3d55ef20 fdisk: remove unused file
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-04-11 12:55:51 +02:00
Karel Zak 1b1af0c1d0 login-utils: add missing header, fix setpwnam.c fclose logic
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-04-11 12:52:36 +02:00
Karel Zak 6259c257d8 Merge branch 'close_stream' of git://github.com/kerolasa/lelux-utiliteetit
* 'close_stream' of git://github.com/kerolasa/lelux-utiliteetit:
  disk-utils: verify writing to streams was successful
  fdisk: verify writing to streams was successful
  getopt: verify writing to streams was successful
  hwclock: verify writing to streams was successful
  login-utils: verify writing to streams was successful
  misc-utils: verify writing to streams was successful
  mount: verify writing to streams was successful
  partx: verify writing to streams was successful
  schedutils: verify writing to streams was successful
  sys-utils: verify writing to streams was successful
  term-utils: verify writing to streams was successful
  text-utils: verify writing to streams was successful
  include: add stream error checking facility

Conflicts:
	fdisk/fdisk.c
2012-04-11 12:37:59 +02:00
Davidlohr Bueso b2244df618 libuuid: use randutils
Signed-off-by: Davidlohr Bueso <dave@gnu.org>
2012-04-10 13:15:35 +02:00
Davidlohr Bueso 2a2319bbac fdisk: use randutils for mbr signature creation
Signed-off-by: Davidlohr Bueso <dave@gnu.org>
2012-04-10 13:15:32 +02:00
Davidlohr Bueso fe72459e41 lib: random utilities
Add a random number(s) generator specific file. The intial functions are based
on what libuuid provide. I did some modifications like avoid WIN32 checks - this
is util-LINUX.

[kzak@redhat.com: - move jrand_seed to lib/randutils.c
                  - use TLS for jrand_seed (like original code from libuuid)
                  - use size_t for buffer sizes
                  - add close() to random_get_bytes]

Signed-off-by: Davidlohr Bueso <dave@gnu.org>
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-04-10 13:12:43 +02:00
Karel Zak c344350948 lib/blkdev: fix compiler warning [-Wreturn-type]
../lib/blkdev.c: In function ‘blkdev_get_geometry’:
../lib/blkdev.c:287:1: warning: control reaches end of non-void function [-Wreturn-type]

Signed-off-by: Karel Zak <kzak@redhat.com>
2012-04-10 12:29:10 +02:00
Petr Uzel 9c45d49fe0 sfdisk: fix calculation due to type mismatch (ix86)
Instructing sfdisk to create one partition spanning
across entire disk (",,") on 32bit system, if the disk
is sufficiently large (~2TB) leads to wrong calculation
in compute_start_sect() due to type mismatch.

Can be reproduced as:

--------------------------
linux-3ln5:~ # modprobe scsi_debug virtual_gb=2000
linux-3ln5:~ # sfdisk /dev/sda <<< ',,'
Checking that no-one is using this disk right now ...
OK

Disk /dev/sda: 261083 cylinders, 255 heads, 63 sectors/track

sfdisk: ERROR: sector 0 does not have an msdos signature
sfdisk:  /dev/sda: unrecognized partition table type

Old situation:
sfdisk: No partitions found

no room for partition descriptor
sfdisk: bad input
--------------------------

Addresses: https://bugzilla.novell.com/show_bug.cgi?id=754789
Reported-by: Dan Mares <dan.mares@norcrossgroup.com>
Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
2012-04-10 12:21:49 +02:00
Sami Kerola 0b66315a8e docs: eject.1: align with Documentation/howto-man-page.txt
* Add spaces after dots (English spacing).
* Add line break macros.
* Use URL and email macros where appropriate.
* Fix typo at the end of the manual (s/lsblk/eject/).

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-04-10 12:21:41 +02:00
Sami Kerola 92091356f9 eject: close open file [cppcheck]
[eject.c:498]: (error) Resource leak: f

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-04-10 12:21:37 +02:00
Sami Kerola 38de283e35 eject: inform why open failed
Mostly to cover common case when user does not have permission to use
eject.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-04-10 12:21:33 +02:00
Davidlohr Bueso 958d2b712a strutils: return success on test program
Signed-off-by: Davidlohr Bueso <dave@gnu.org>
2012-04-10 12:21:30 +02:00
Mike Frysinger df3449d541 eject: use CDROM_DRIVE_STATUS if available for tray toggling
One some platforms, the -T option can be unreliable (see reference bug
report for some examples).  Instead, if the kernel supports the cdrom
status ioctl, use that to ask explicitly for the current tray status
and then open/close accordingly.

The eject_cdrom() func was reworked slightly, but none of the existing
callers care about the explicit normalization to [0,1] values, so have
it return the raw value so we can convert toggle_tray() over to using
that.

Finally, now that toggle_tray() uses a lot of helper functions, drop
the check on CDROMCLOSETRAY.  The sub-functions take care of that.

Reference: https://bugs.gentoo.org/261880
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2012-04-10 12:21:27 +02:00
Mike Frysinger 0cb8dc47e4 eject(1): fix typo in mount(1) reference
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2012-04-10 12:21:22 +02:00
Mike Frysinger e99f842daf eject: constify array
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2012-04-10 12:21:19 +02:00
Davidlohr Bueso 64128b705c fdisk: move kernel geometry into blkdev
This is a more generic place for this ioctl.

Signed-off-by: Davidlohr Bueso <dave@gnu.org>
2012-04-10 12:21:16 +02:00
Dave Reisner e00fa45272 fsck: don't free fstab table on parse failure
Even if we fail parsing, fstab gets referenced later in the code (and
will subsequently crash via heap corruption). Take the easy way out and
simply avoid deallocating this table, as it will be freed for us on
program exit regardless.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-04-10 11:44:47 +02:00
Karel Zak b2d4a671a5 sfdisk: make -l less verbose about missing PT
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-04-06 10:12:32 +02:00
Karel Zak 4f469e588d Merge branch 'eject'
* eject: (47 commits)
  tests: use eject --force
  eject: use BUILD_EJECT, move to sys-utils
  eject: clean up usage()
  eject: clean up man page
  eject: add --force option
  eject: check for hotplug/removable attribute
  eject: remove obsolete code, use EXIT_* macros
  tests: add umount-by-eject tests
  eject: improve work with partitioned devices
  lib/sysfs: improve sysfs_is_partition_dirent()
  eject: call umount <mountpoint> rather than <device>
  eject: use libmount to detect if cdrom is mounted
  eject: make the code robust
  eject: use SG_IO ioctl for scsi
  eject: support CDIOCEJECT ioctl
  eject: new close_tray code from Fedora
  eject: new auto_eject code from Fedora
  eject: add -X from Fedora
  eject: add --manualeject from fedora
  eject: clean up devname usage
  ...
2012-04-05 15:58:28 +02:00
Karel Zak f33fa26e0f tests: use eject --force
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-04-05 15:57:12 +02:00