summaryrefslogtreecommitdiffstats
path: root/disk-utils/swaplabel.c
Commit message (Collapse)AuthorAgeFilesLines
* misc: consolidate version printing and close_stdout()Karel Zak2019-04-161-3/+2Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* swaplabel: fix --disable-libuuid compilationKarel Zak2017-09-151-0/+5
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* misc: consolidate macro style USAGE_HELP_OPTIONSRuediger Meier2017-06-291-2/+2
| | | | | | | | | changed in include/c.h and applied via sed: sed -i 's/fprintf.*\(USAGE_MAN_TAIL.*\)/printf(\1/' $(git ls-files -- "*.c") sed -i 's/print_usage_help_options\(.*\);/printf(USAGE_HELP_OPTIONS\1);/' $(git ls-files -- "*.c") Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* misc: introduce print_usage_help_options()Ruediger Meier2017-06-271-2/+1Star
| | | | | | | | | | | | Consolidate --help and --version descriptions. We are now able to align them to the other options. We changed include/c.h. The rest of this patch was generated by sed, plus manually setting the right alignment numbers. We do not change anything but white spaces in the --help output. Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* misc: never use usage(stderr)Ruediger Meier2017-06-261-6/+8
| | | | | | | Here we fix all cases where we have usage(FILE*) functions. Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* misc: do not use plain 0 as NULL [smatch scan]Sami Kerola2017-02-201-5/+5
| | | | | | | | | | text-utils/tailf.c:69:21: warning: Using plain integer as NULL pointer Since many 'struct option' has used zero as NULL make them more readable in same go by reindenting, and using named argument requirements. Reference: https://lwn.net/Articles/93577/ Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* Use --help suggestion on invalid optionKarel Zak2016-12-191-2/+1Star
| | | | | | | | The current default is to print all usage() output. This is overkill in many case. Addresses: https://github.com/karelzak/util-linux/issues/338 Signed-off-by: Karel Zak <kzak@redhat.com>
* textual: add a docstring to most of the utilitiesBenno Schulenberg2015-01-061-0/+4
| | | | | | | | | This adds a concise description of a tool to its usage text. A first form of this patch was proposed by Steven Honeyman (see http://www.spinics.net/lists/util-linux-ng/msg09994.html). Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
* swapon: split swapon-common.cKarel Zak2014-09-221-5/+5
| | | | | | | | | | | swapon - requires libmount and libblkid swapoff - requires libmount swaplabel - requires libblkid This patch add lib/swapprober.c with blkid stuff for swap. It allows to use and link libblkid only when necessary. Signed-off-by: Karel Zak <kzak@redhat.com>
* swaplabel: move swapon-common to include directorySami Kerola2014-07-281-0/+1
| | | | | | | | | | This fixes the following compiler warning. disk-utils/swaplabel.c:175:2: warning: implicit declaration of function 'get_swap_prober' [-Wimplicit-function-declaration] Signed-off-by: Sami Kerola <kerolasa@iki.fi> Signed-off-by: Karel Zak <kzak@redhat.com>
* swapon: share get_swap_prober() with swaplabel to print uuid and labelSami Kerola2014-07-221-46/+0Star
| | | | | | | | | | | | The swapon(8) listing was almost complete, apart from label and uuid. This change moves the code from swaplabel(8) to shared scope to be used for printouts in other swap commands, such as swapon. Adding this feature to lsblk(8) was a consideration, but lsblk is not interested of swapfiles, so the swapon seems like a better option to add this information. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* mkswap, swaplabel: move version number to headerSami Kerola2014-05-041-2/+2
| | | | | | | Corrently only the swap version 1 is supported, which is a magic value so move it to header. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* swaplabel: wrong version number in checkSami Kerola2014-02-171-1/+1
| | | | | | | | | | | $ swaplabel /dev/sda2 swaplabel: /dev/sda2: unsupported swap version '1' The mkswap does not allow any other version, so swaplabel(8) must be wrong. Reference: https://github.com/karelzak/util-linux/blob/master/disk-utils/mkswap.c#L520 Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* swaplabel: check writing to a file descriptor was successfulSami Kerola2013-04-261-1/+4
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* translation: unify file open error messagesSami Kerola2012-07-161-1/+1
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* swaplabel: check blkid_probe_lookup_value() result [coverity scan]Karel Zak2012-06-211-2/+3
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* include: rename writeall.h to all-io.hPetr Uzel2012-05-151-1/+1
| | | | Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
* disk-utils: verify writing to streams was successfulSami Kerola2012-04-041-0/+2
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* swaplabel: add --version and align with howto-usage-function.txtSami Kerola2012-03-301-11/+15
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* swaplabel: fix compiler warnings [-Wunused-parameter]Karel Zak2011-08-011-2/+2
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* build-sys: include <uuid.h> rather than <uuid/uuid.h>Karel Zak2011-03-161-5/+1Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* move struct option to .rodataKarel Zak2011-03-031-1/+1
| | | | | | | It does not make sense to have writable large arrays of "struct option" on the stack. Signed-off-by: Karel Zak <kzak@redhat.com>
* build-sys: provide alternatives for err, errx, warn and warnxFabian Groffen2011-02-141-1/+0Star
| | | | | | | | Solaris lacks err, errx, warn and warnx. This also means the err.h header doesn't exist. Removed err.h include from all files, and included err.h from c.h instead if it exists, otherwise alternatives are provided. Signed-off-by: Fabian Groffen <grobian@gentoo.org>
* lib: [strutils] general purpose string handling functionsDavidlohr Bueso2010-11-231-1/+1
| | | | | | | | | | | | | This patch replaces a few functions used throughout the source: * Renames getnum (from schedutils) to strtol_or_err * Moves strtosize (from lib/strtosize.c) * Moves xstrncpy (from include/xstrncpy.h) * Adds strnlen, strnchr and strndup if not available (remove it from libmount utils) A few Makefile.am files were modified to compile accordingly along with trivial renaming in schedutils source code. Signed-off-by: Davidlohr Bueso <dave@gnu.org>
* swaplabel: new commandJason Borden2010-04-021-0/+226
Print or change the label / UUID of a swap area. [kzak@redhat.com: - code refactoring - add long options - clean up Makefile.am] Signed-off-by: Jason Borden <jborden@bluehost.com> Signed-off-by: Karel Zak <kzak@redhat.com>