Commit Graph

7467 Commits

Author SHA1 Message Date
Karel Zak 8c3a5a440f cfdisk: basic UI stuff 2014-03-11 11:35:13 +01:00
Karel Zak 2e6c3a53f9 include/xalloc: add xvasprintf()
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-03-11 11:35:13 +01:00
Karel Zak 04406c0d0c libfdisk: add fdisk_table_get_nents()
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-03-11 11:35:13 +01:00
Karel Zak 9f7fdeaf0e libfdisk: tiny clean up in fdisk_table_to_string()
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-03-11 11:35:13 +01:00
Karel Zak d0059a2491 libfdisk: clean up cylinder column
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-03-11 11:35:13 +01:00
Karel Zak 9f670072f4 libfdisk: remove tt stuff from API
The include/tt.h has to be used only internally by the library (for
example to convert fdisk_table to string).

The fdisk_ask API should not be more used for complex tasks like print
partition table. The application has to use fdisk_get_table() and
fdisk_table_to_string() or something else.

Signed-off-by: Karel Zak <kzak@redhat.com>
2014-03-11 11:35:13 +01:00
Karel Zak 6c89f750d2 libfdisk: use fdisk_table to generate output
* add generic fdisk_iter iterator
 * use fdisk_table to convert partition table to human readable output
 * clean up partition.c API (don't use reference to fdisk_context in
   fdisk_partition struct)
 * extern table.c API to use fdisk_iter iterator
 * remove old fdisk_list_partitions()

Signed-off-by: Karel Zak <kzak@redhat.com>
2014-03-11 11:35:12 +01:00
Karel Zak ed494c8d50 include/tt: add function to convert table to string
Note that open_memstream() is POSIX-1.2008, so it's possible than not
all libc have already implemented this function.

Signed-off-by: Karel Zak <kzak@redhat.com>
2014-03-11 11:35:12 +01:00
Karel Zak 187de51c8a libfdisk: move partition stuff to partition.c
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-03-11 11:35:12 +01:00
Karel Zak b48cdebcb4 libfdisk: add table container
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-03-11 11:35:12 +01:00
Karel Zak d6cfa8b327 libfdisk: add reference counting to fdisk_partition
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-03-11 11:35:12 +01:00
Karel Zak 1de9fddbe5 libfdisk: add support to list free space
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-03-11 11:35:12 +01:00
Karel Zak 77d6a70ac4 libfdisk: use partition template
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-03-11 11:35:12 +01:00
Karel Zak 851515216f libfdisk: remove fdisk_get_partition_type()
Let's use more generic:

	fdisk_get_partition()
        fdisk_partition_get_parttype()

rather than fdisk_get_partition_type().

The patch also improves fdisk_get_partition() semantic to allocate
a new partition struct if the argument is NULL.

Signed-off-by: Karel Zak <kzak@redhat.com>
2014-03-11 11:35:12 +01:00
Karel Zak 27d4d07292 libfdisk: (sun) remove get_partition_type()
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-03-11 11:35:12 +01:00
Karel Zak 5d660fa488 libfdisk: (sgi) remove get_partition_type()
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-03-11 11:35:12 +01:00
Karel Zak 7f01ec7aad libfdisk: (dos) remove get_partition_type()
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-03-11 11:35:12 +01:00
Karel Zak a699b27de4 libfdisk: (bsd) remove get_partition_type()
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-03-11 11:35:12 +01:00
Karel Zak 7f539277e8 libfdisk: (gpt) remove get_partition_type()
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-03-11 11:35:12 +01:00
Karel Zak 0a2aedf0e2 libfdisk: (sun) use new list() and get_part() API
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-03-11 11:35:12 +01:00
Karel Zak d787618b97 libfdisk: (sgi) use new list() and get_part() API
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-03-11 11:35:12 +01:00
Karel Zak 262002ee6f libfdisk: (dos) use new list() and get_part() API
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-03-11 11:35:12 +01:00
Karel Zak d6faa8e00d libfdisk: add new list() columns, cleanup
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-03-11 11:35:12 +01:00
Karel Zak d48419f3a9 libfdisk: (bsd) use new get_part() API
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-03-11 11:35:12 +01:00
Karel Zak 82ebc7dea7 libfdisk: improve conversion to string
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-03-11 11:35:12 +01:00
Karel Zak 8c0a7f9136 libfdisk: add struct fdisk_partition
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-03-11 11:35:12 +01:00
Karel Zak 7358229637 lib/tt: add reduce term width functionality
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-03-11 11:35:12 +01:00
Karel Zak b839bd4fa1 lib/tt: add TT_FL_MAX to fill screen
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-03-11 11:35:12 +01:00
Karel Zak 575a1de03a lib/tt: add tb_get_nlines()
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-03-11 11:35:12 +01:00
Karel Zak 0cd73f41e8 lib/tt: don't hardcode stdout as output
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-03-11 11:35:12 +01:00
Karel Zak 6941952e8d libfdisk: (gpt) use fdisk_column
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-03-11 11:35:12 +01:00
Karel Zak 8152753d58 libfdisk: implement generic functions for FDISK_COL_ stuff
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-03-11 11:35:12 +01:00
Karel Zak 21a44c9b84 libfdisk: extend API definition to list info about partitions
This change adds a struct fdisk_column to provide generic description
for information about partitions. The struct is used for tt tables as
well as lists of possible columns for specified label driver.

We use the same concept in all applications linked with tt.c (lsblk,
findmnt, partx, ...) where is possible to dynamically change columns,
order of the columns etc. Now it will be possible to do the same with
fdisk.

And it's also possible to use FDISK_COL_* Ids to address data, for
example:

   fdisk_partition_get_data(cxt, FDISK_COL_SIZE, 1, &data);

returns a string with human readable size (<num>{MGT}) of the second
partition.

Signed-off-by: Karel Zak <kzak@redhat.com>
2014-03-11 11:35:12 +01:00
Karel Zak 11fd5edb9d include/tt: add tt_is_empty()
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-03-11 11:35:11 +01:00
Karel Zak 873e7a59d7 ipcs: fix size_t overflow
Addresses: https://github.com/karelzak/util-linux/issues/51
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-03-11 11:22:07 +01:00
Karel Zak 329b0ee753 lib/colors: support <name>.enable too
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-03-11 10:38:15 +01:00
Karel Zak 60ec67ff4e lib/colors: add info to man pages, add terminal-colors.d.5
Co-Author: Ondrej Oprala <ooprala@redhat.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-03-11 10:05:32 +01:00
Ondrej Oprala d0c9ddc3cc lib/colors: check for /etc/terminal-colors.d/[util].disable
[kzak@redhat.com: - move paths to pathnames.h,
                  - use static path buffer]

Signed-off-by: Ondrej Oprala <ooprala@redhat.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-03-11 09:38:09 +01:00
Sami Kerola 2f79154639 tests: check commands needed for running a test exist
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-03-07 11:52:57 +01:00
Sami Kerola 22c3c4f936 tools: make config-gen to require build target argument
When argument is not supplied help user by telling what arguments can be
used.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2014-03-07 11:45:54 +01:00
Karel Zak 5a2fd9329e lsblk: add PARTFLAGS column
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-03-07 11:14:46 +01:00
Karel Zak df019e9be7 libmount: add statfs_magic.h
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-03-06 13:09:16 +01:00
Karel Zak 65acdc8734 build-sys: remove deprecated-mount/
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-03-05 13:19:19 +01:00
Chris MacGregor 4a44a54b3c hwclock: fix possible hang and other set_hardware_clock_exact() issues
In sys-utils/hwclock.c, set_hardware_clock_exact() has some problems when the
process gets pre-empted (for more than 100ms) before reaching the time for
which it waits:

1. The "continue" statement causes execution to skip the final tdiff
assignment at the end of the do...while loop, leading to the while condition
using the wrong value of tdiff, and thus always exiting the loop once
newhwtime != sethwtime (e.g., after 1 second).  This masks bug # 2, below.

2. The previously-existing bug is that because it starts over waiting for the
desired time whenever two successive calls to gettimeofday() return values >
100ms apart, the loop will never terminate unless the process holds the CPU
(without losing it for more than 100ms) for at least 500ms.  This can happen
on a heavily loaded machine or on a virtual machine (or on a heavily loaded
virtual machine).  This has been observed to occur, preventing a machine from
completing the shutdown or reboot process due to a "hwclock --systohc" call in
a shutdown script.

The new implementation presented in this patch takes a somewhat different
approach, intended to accomplish the same goals:

It computes the desired target system time (at which the requested hardware
clock time will be applied to the hardware clock), and waits for that time to
arrive.  If it misses the time (such as due to being pre-empted for too long),
it recalculates the target time, and increases the tolerance (how late it can
be relative to the target time, and still be "close enough".  Thus, if all is
well, the time will be set *very* precisely.  On a machine where the hwclock
process is repeatedly pre-empted, it will set the time as precisely as is
possible under the conditions present on that particular machine.  In any
case, it will always terminate eventually (and pretty quickly); it will never
hang forever.

[kzak@redhat.com: - tiny coding style changes]

Signed-off-by: Chris MacGregor <chrismacgregor@google.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-03-05 12:42:00 +01:00
Bernhard Voelker 260412b19f libmount: define BTRFS_TEST_MAGIC if missing
* libmount/src/utils.c (BTRFS_TEST_MAGIC): Conditionally add define
which is used since commit v2.24-243-g6a52473.

Signed-off-by: Bernhard Voelker <mail@bernhard-voelker.de>
2014-03-05 12:14:54 +01:00
Karel Zak 9a7d05fedb chcpu: cleanup stdout/stderr usage
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-03-05 11:23:16 +01:00
Karel Zak 48fc00c1c7 chcpu: cleanup return codes
The code currently always return EXIT_SUCCESS, that's strange. It
seems better to return 0 on success, 1 on complete failure and 64 on
partial success.

Signed-off-by: Karel Zak <kzak@redhat.com>
2014-03-05 11:06:59 +01:00
Karel Zak dbf7043ea1 build-sys: don't connect _DEPENDENCIES and _LIBADD
The _DEPENDENCIES has to be used for dependencies on another in-tree
files, but _LIBADD is to specify additional libs (including external
libs).

Reported-by: oleid <notifications@github.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-03-05 10:20:10 +01:00
Karel Zak 013efbfad4 Merge branch 'master' of https://github.com/rudimeier/util-linux
* 'master' of https://github.com/rudimeier/util-linux:
  travis-ci: import travis yaml controller
2014-03-05 09:25:43 +01:00
Benno Schulenberg 01cc21f5b6 docs: fix two command representations in the man page of more
The previous-file command is not :P but :p, and the back-to-where
command is not an acute accent but an apostrophe.  Also condense
some of the descriptions and remove some useless comments.

Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
2014-03-04 13:52:14 +01:00