diff options
author | Jan Synacek <jsynacek@redhat.com> | 2014-09-24 14:29:05 +0200 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2014-09-29 11:08:12 -0400 |
commit | 86b23b07c96b185126bfbf217227dad362a20c25 (patch) | |
tree | 897437332588d77a7f2e27d1a3dc486ecbdd562f /src/fstab-generator | |
parent | 70f1b2ddc6b94d3fa5539eb8503887b465f7fcc7 (diff) |
swap: introduce Discard property
Process possible "discard" values from /etc/fstab.
Diffstat (limited to 'src/fstab-generator')
-rw-r--r-- | src/fstab-generator/fstab-generator.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/fstab-generator/fstab-generator.c b/src/fstab-generator/fstab-generator.c index 2c38ab977c..5569325a16 100644 --- a/src/fstab-generator/fstab-generator.c +++ b/src/fstab-generator/fstab-generator.c @@ -73,6 +73,8 @@ static int mount_find_pri(struct mntent *me, int *ret) { static int add_swap(const char *what, struct mntent *me) { _cleanup_free_ char *name = NULL, *unit = NULL, *lnk = NULL; _cleanup_fclose_ FILE *f = NULL; + char *discard = NULL; + bool noauto; int r, pri = -1; @@ -118,6 +120,14 @@ static int add_swap(const char *what, struct mntent *me) { "What=%s\n", what); + discard = mount_test_option(me->mnt_opts, "discard"); + if (discard) { + discard = strpbrk(discard, "="); + fprintf(f, + "Discard=%s\n", + discard ? discard+1 : "all"); + } + if (pri >= 0) fprintf(f, "Priority=%i\n", |