summaryrefslogtreecommitdiffstats
path: root/sys-utils/zramctl.c
Commit message (Collapse)AuthorAgeFilesLines
* zramctl: use xstrncpy()Karel Zak2019-05-201-4/+2Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* misc: consolidate version printing and close_stdout()Karel Zak2019-04-161-3/+3
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* zramctl: use new ul_path_* APIKarel Zak2018-06-211-41/+54
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* Merge branch 'output-all' of https://github.com/kerolasa/lelux-utiliteetitKarel Zak2018-05-101-1/+10
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 'output-all' of https://github.com/kerolasa/lelux-utiliteetit: zramctl: add --output-all option swapon: add --output-all option rfkill: add --output-all option partx: add --output-all option lsns: add --output-all option lsmem: add --output-all option lslogins: add --output-all option lslocks: add --output-all option lscpu: add --output-all option losetup: add --output-all option findmnt: add --output-all option
| * zramctl: add --output-all optionSami Kerola2018-05-031-1/+10
| | | | | | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* | zramctl: fix truncation warningSami Kerola2018-05-101-2/+2
|/ | | | | | | | | | | | | | | sys-utils/zramctl.c: In function ‘zram_get_sysfs’: sys-utils/zramctl.c:220:52: warning: ‘%s’ directive output may be truncated writing up to 4095 bytes into a region of size 27 [-Wformat-truncation=] snprintf(z->devname, sizeof(z->devname), "/dev/%s", name); As an additional good thing zramctl will no longer allocate 4096 bytes from stack when just 23 bytes is enough. [kzak@redhat.com: - use macro rather than hardcoded string for the path] Signed-off-by: Sami Kerola <kerolasa@iki.fi> Signed-off-by: Karel Zak <kzak@redhat.com>
* zramctl: use xstrdup()Karel Zak2018-01-301-11/+5Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* Added the support for lz4hc, deflate, and 842Libor Bukata2018-01-241-14/+16
| | | | | | compression algorithms in zramctl utility. Signed-off-by: Libor Bukata <lbukata@gmail.com>
* zramctl: fix show all non-zero zram devicesJames Sanford2017-10-161-13/+24
| | | | | Addresses: https://github.com/karelzak/util-linux/issues/521 Signed-off-by: Karel Zak <kzak@redhat.com>
* zramctl: remove unused ZRAM_EMPTY and blank lineJames Sanford2017-10-141-4/+0Star
|
* 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: cosmetics, remove argument from usage(FILE*)Ruediger Meier2017-06-261-3/+4
| | | | | | | | | | | | | | This patch is trivial and changes nothing, because we were always using usage(stdout) Now all our usage() functions look very similar. If wanted we could auto-generate another big cosmetical patch to remove all the useless "FILE *out" constants and use printf and puts rather than their f* friends. Such patch could be automatically synchronized with the translation project (newlines!) to not make the translators sick. Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* misc: consolidate usage() "Available columns"Karel Zak2017-06-261-1/+1
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* zramctl: add mising line terminatorKarel Zak2017-05-181-1/+1
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* misc: consolidate smartcols error messagesKarel Zak2017-05-181-4/+4
| | | | | | ... just to keep translators happy Signed-off-by: Karel Zak <kzak@redhat.com>
* zramctl: make mm_stat parser more robustKarel Zak2017-03-301-2/+6
| | | | | | | | Let's fallback to attribute files if mm_stat file is incomplete. It should not happen, but I have seen RHEL7 kernel where is no num_migrated/pages_compacted attribute... Signed-off-by: Karel Zak <kzak@redhat.com>
* Use --help suggestion on invalid optionKarel Zak2016-12-191-1/+1
| | | | | | | | 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>
* misc: Fix various typosSebastian Rasmussen2016-05-311-1/+1
| | | | | | | Fix various typos in error messages, warnings, debug strings, comments and names of static functions. Signed-off-by: Sebastian Rasmussen <sebras@gmail.com>
* ramctl: add support for zram-controlKarel Zak2016-05-111-3/+61
| | | | | | | | Based on patch from Timofey Titovets. Addresses: https://github.com/karelzak/util-linux/issues/318 Reported-by: Timofey Titovets <nefelim4ag@gmail.com> Signed-off-by: Karel Zak <kzak@redhat.com>
* zramctl: fix typoKarel Zak2016-01-211-1/+1
| | | | | Reported-by: Rafael Fontenelle <rffontenelle@gmail.com> Signed-off-by: Karel Zak <kzak@redhat.com>
* zramctl: fix lists of the all devicesKarel Zak2015-09-241-3/+12
| | | | | | | The command zramctl lists the same stat info for all devices (DATA COMPR TOTAL). Reported-by: Oliver Freyermuth <o.freyermuth@googlemail.com> Signed-off-by: Karel Zak <kzak@redhat.com>
* Fix trivial typosYuri Chornoivan2015-08-251-1/+1
|
* misc: fix shadow declarationsSami Kerola2015-08-241-3/+3
| | | | | | | | | | | | | | | | | | | | | | sys-utils/zramctl.c: In function 'get_mm_stat': sys-utils/zramctl.c:276:58: warning: declaration of 'inbytes' shadows a global declaration [-Wshadow] static char *get_mm_stat(struct zram *z, size_t idx, int inbytes) sys-utils/zramctl.c:119:39: note: shadowed declaration is here static unsigned int raw, no_headings, inbytes; libmount/src/tab.c: In function 'mnt_table_get_fs_root': libmount/src/tab.c:1221:22: warning: declaration of 'fs' shadows a parameter [-Wshadow] struct libmnt_fs *fs = mnt_table_find_mountpoint(tb, libmount/src/tab.c:1197:24: note: shadowed declaration is here struct libmnt_fs *fs, disk-utils/fsck.minix.c: In function 'main': disk-utils/fsck.minix.c:1364:17: warning: declaration of 'i' shadows a previous local [-Wshadow] unsigned long i, free; disk-utils/fsck.minix.c:1250:6: note: shadowed declaration is here int i; Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* zramctl: add MEM-LIMIT, MEM-USED and MIGRATED columnsKarel Zak2015-05-181-7/+21
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* zramctl: support /sys/block/zram<id>/mm_statKarel Zak2015-05-181-13/+78
| | | | | | Linux >= 4.1 provides all memory related statistics by one file. Signed-off-by: Karel Zak <kzak@redhat.com>
* maint: fix shadow declarationSami Kerola2015-01-071-1/+1
| | | | | | | | | | | | | | | | This change fixes all shadow declarations. The worth while to mention fix is with libfdisk sun geometry. It comes from bitops.h cpu_to_be16 macro that further expands from include/bits/byteswap.h that has the shadowing. libfdisk/src/sun.c:961:173: warning: declaration of '__v' shadows a previous local [-Wshadow] libfdisk/src/sun.c:961:69: warning: shadowed declaration is here [-Wshadow] libfdisk/src/sun.c:961:178: warning: declaration of '__x' shadows a previous local [-Wshadow] libfdisk/src/sun.c:961:74: warning: shadowed declaration is here [-Wshadow] That could have caused earlier some unexpected results. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* textual: add a docstring to most of the utilitiesBenno Schulenberg2015-01-061-0/+3
| | | | | | | | | 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>
* zramctl: fixed two -Wformat-security warningsSteven Honeyman2014-09-151-2/+2
| | | | | | (they prevented compilation if -Werror=format-security is enabled) Signed-off-by: Steven Honeyman <stevenhoneyman@users.noreply.github.com>
* zramctl: improve option combination error messagingSami Kerola2014-08-111-3/+4
| | | | | | | | | | | Use of --algorithm or --streams is not expected to work without reseting device, that happens when --size is specified, so ensure the former options to be combined with the later. [kzak@redhat.com: - make it more generic] Signed-off-by: Sami Kerola <kerolasa@iki.fi> Signed-off-by: Karel Zak <kzak@redhat.com>
* zramctl: cannonicalize devname when no fullpath specifiedKarel Zak2014-08-111-0/+6
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* zramctl: improve error messageSami Kerola2014-08-111-1/+1
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* zramctl: fail status printout when device does not existKarel Zak2014-08-111-4/+14
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* zramctl: remove extra \n from usage()Karel Zak2014-08-061-1/+1
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* zramctl: fix typoKarel Zak2014-08-061-1/+1
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* zramctl: fix typoKarel Zak2014-08-051-1/+1
| | | | | Reported-by: Steven Honeyman Signed-off-by: Karel Zak <kzak@redhat.com>
* zramctl: fix the wording of some message stringsBenno Schulenberg2014-08-051-13/+12Star
| | | | Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
* zrmactl: add new command to control /dev/zramN devicesKarel Zak2014-08-011-0/+571
Co-Author: Timofey Titovets <nefelim4ag@gmail.com> Signed-off-by: Karel Zak <kzak@redhat.com>