summaryrefslogtreecommitdiffstats
path: root/sys-utils/swapon.c
Commit message (Collapse)AuthorAgeFilesLines
...
* libsmartcols: clean up flags usageKarel Zak2014-04-031-3/+3
| | | | | | | | | * rename flags functions to scols_table_enable_* * rename *_no_foo() functions to _nofoo() * output formats are mutually exclusive, so don't use flags there * don't assume symbols in scols_new_table(), use scols_table_set_symbols() Signed-off-by: Karel Zak <kzak@redhat.com>
* swapon: clean up scols usageKarel Zak2014-04-031-19/+11Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* swapon: use libsmartcolsOndrej Oprala2014-04-031-23/+30
| | | | Signed-off-by: Ondrej Oprala <ooprala@redhat.com>
* swapon: use TT_FL_FREEDATA for tt tableKarel Zak2013-09-161-1/+1
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* swapon: allow a more flexible swap discard policyRafael Aquini2013-08-231-21/+72
| | | | | | | | | | | | | | | | | | | | Introduce the necessary changes to swapon(8) allowing a sysadmin to leverage the new changes introduced to sys_swapon by "swap: discard while swapping only if SWAP_FLAG_DISCARD_PAGES", therefore allowing a more flexible set of choices when selection the discard policy for mounted swap areas. This patch introduces the following optional arguments to the already existent swapon(8) "--discard" option, in order to allow a discard type to be selected at swapon time: * once : only single-time area discards are issued. (swapon) * pages : discard freed pages before they are reused. If no policy is selected both discard types are enabled. (default) [kzak@redhat.com: - support <policy> argument for short -d option too, - add errx() on unsupported policy name] Signed-off-by: Rafael Aquini <aquini@redhat.com> Acked-by: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com> Signed-off-by: Karel Zak <kzak@redhat.com>
* misc: use libmnt_cache reference countingKarel Zak2013-08-211-1/+1
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: add mnt_table_is_empty(), improve table list usageKarel Zak2013-08-201-2/+4
| | | | | | | | Currently you have to use mnt_table_remove_fs() + mnt_free_fs() to destroy the list in the table. This is complicated in same situations. This patch allows to use mnt_free_fs() only. Signed-off-by: Karel Zak <kzak@redhat.com>
* swapon: check writing to a file descriptor was successfulSami Kerola2013-04-261-1/+4
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* translation: unify exec error messagesSami Kerola2013-02-061-1/+1
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* swapon: default to --show if nothing is requestedSami Kerola2013-01-091-4/+1Star
| | | | | | Proposed-by: Karel Zak <kzak@redhat.com> References: http://www.spinics.net/lists/util-linux-ng/msg07301.html Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* swapon: print warning about insecure owner/permissionsKarel Zak2013-01-081-10/+6Star
| | | | | | | | | Let's make it more obvious if swap area is accessible for non-root users. The old version prints the warning only if --verbose is specified. Reported-by: mp.lists@free.fr Signed-off-by: Karel Zak <kzak@redhat.com>
* swapon: fix memmory leak [coverity scan]Karel Zak2012-12-121-4/+4
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* swapon: don't care about xasprintf() return codeKarel Zak2012-12-121-7/+6Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* swapon: remove loop declaration [smatch scan]Sami Kerola2012-10-151-1/+2
| | | | | | | sys-utils/swapon.c:677:2: error: 'for' loop initial declarations are only allowed in C99 mode Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* swapon: check numeric user inputsSami Kerola2012-10-151-1/+2
| | | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi> Signed-off-by: Karel Zak <kzak@redhat.com>
* translation: unify file open error messagesSami Kerola2012-07-161-2/+2
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* translation: unify stat error messagesSami Kerola2012-07-161-1/+1
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* swapon: remove unused variablesSami Kerola2012-07-161-1/+0Star
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* swapon: fix --summary output regressionSami Kerola2012-07-101-1/+1
| | | | | | | Commit 64b588814e5f081a7ab37f820984aa7a2de9eee9 changed --summary header alignment, and usage of spaces vs tabs in output. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* swapon: make --show size to be human readable by defaultSami Kerola2012-07-101-7/+25
| | | | | | | Cc: Bernhard Voelker <mail@bernhard-voelker.de> Signed-off-by: Sami Kerola <kerolasa@iki.fi> Signed-off-by: Karel Zak <kzak@redhat.com>
* swapon: add --show optionSami Kerola2012-07-101-1/+186
| | | | | | | | | | | | The --show uses lib/tt.c, which allows user to specify columns he is interested of, and avoids using hard coded field sizes which may be problematic when system has large enough swap. [kzak@redhat.com: - improve usage(), remove unused code] Cc: Bernhard Voelker <mail@bernhard-voelker.de> Signed-off-by: Sami Kerola <kerolasa@iki.fi> Signed-off-by: Karel Zak <kzak@redhat.com>
* swapon: fix typoKarel Zak2012-06-271-1/+1
| | | | | Reported-by: Manan Tuli <mt_void@yahoo.com> Signed-off-by: Karel Zak <kzak@redhat.com>
* swapon: add support for PARTUUID= and PARTLABEL=Karel Zak2012-04-191-5/+7
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* swapon: minor coding style changesKarel Zak2012-04-181-32/+23Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* swapon: cleanup usage()Karel Zak2012-04-181-54/+52Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* swapon: cleanup main()Karel Zak2012-04-181-32/+16Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* swapoff: move code from swapon.c to swapoff.cKarel Zak2012-04-181-169/+1Star
| | | | | | | | | * 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>
* swapon: move generic code to swapon-common.cKarel Zak2012-04-181-86/+21Star
| | | | | | This will allow to use separate binary for swapon and swapoff. Signed-off-by: Karel Zak <kzak@redhat.com>
* swapon: use libmount for fstab parsing (for swapon --all)Karel Zak2012-04-181-41/+51
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* swapon: use only libmount for paths/tags evealuationKarel Zak2012-04-171-15/+9Star
| | | | | | | 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>
* swapon: use libmount for /proc/swaps parsingKarel Zak2012-04-171-99/+65Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* sys-utils: verify writing to streams was successfulSami Kerola2012-04-041-0/+2
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* swapon: use directly blkid rather than fsprobe wrapperKarel Zak2012-03-271-13/+44
| | | | | | | | | * remove dependence on lib/fsprobe.c * reuse already read swap header for --fixpgsz (don't re-read the header by libblkid) Signed-off-by: Karel Zak <kzak@redhat.com>
* checkxalloc: nudge regex, fix newfound instancesDave Reisner2012-03-201-4/+2Star
| | | | | | | | | | | | | | | | Using the -w flag with grep actually fought against us here, and hid some instances where xalloc functions weren't used. Discard it in favor of an explicit word boundary as a prefix to the function name, and extend our requirements on the trailing side of the pattern. This also fixes the few new instances that were overlooked because of the regex's deficiency. [kzak@redhat.com: - fix also newfound in findmnt - remove unnecessary checks after xallocs] Signed-off-by: Dave Reisner <dreisner@archlinux.org> Signed-off-by: Karel Zak <kzak@redhat.com>
* sys-utils: fix typosDavidlohr Bueso2012-02-241-1/+1
| | | | Signed-off-by: Davidlohr Bueso <dave@gnu.org>
* swapon: add break to keep static analysers happyKarel Zak2012-01-311-0/+1
|
* build-sys: move swapon from mount/ to sys-utils/Karel Zak2012-01-111-0/+877
... to make it independent on mount stuff. Signed-off-by: Karel Zak <kzak@redhat.com>