05ad79
diff -up util-linux-2.23.2/libmount/src/libmount.h.in.kzak util-linux-2.23.2/libmount/src/libmount.h.in
05ad79
--- util-linux-2.23.2/libmount/src/libmount.h.in.kzak	2015-06-23 11:54:00.510210784 +0200
05ad79
+++ util-linux-2.23.2/libmount/src/libmount.h.in	2015-06-23 11:54:58.592785482 +0200
05ad79
@@ -420,6 +420,15 @@ extern int mnt_table_get_root_fs(struct
05ad79
 extern int mnt_table_set_iter(struct libmnt_table *tb, struct libmnt_iter *itr,
05ad79
 			      struct libmnt_fs *fs);
05ad79
 
05ad79
+enum {
05ad79
+	MNT_UNIQ_FORWARD  = (1 << 1),	/* default is backward */
05ad79
+	MNT_UNIQ_KEEPTREE = (1 << 2)
05ad79
+};
05ad79
+extern int mnt_table_uniq_fs(struct libmnt_table *tb, int flags,
05ad79
+				int (*cmp)(struct libmnt_table *,
05ad79
+					   struct libmnt_fs *,
05ad79
+					   struct libmnt_fs *));
05ad79
+
05ad79
 extern struct libmnt_fs *mnt_table_find_mountpoint(struct libmnt_table *tb,
05ad79
 				const char *path, int direction);
05ad79
 extern struct libmnt_fs *mnt_table_find_target(struct libmnt_table *tb,
05ad79
diff -up util-linux-2.23.2/libmount/src/libmount.sym.kzak util-linux-2.23.2/libmount/src/libmount.sym
05ad79
--- util-linux-2.23.2/libmount/src/libmount.sym.kzak	2015-06-23 11:56:47.259989779 +0200
05ad79
+++ util-linux-2.23.2/libmount/src/libmount.sym	2015-06-23 11:56:17.681206366 +0200
05ad79
@@ -256,3 +256,9 @@ global:
05ad79
 	mnt_context_find_umount_fs;
05ad79
 	mnt_table_find_mountpoint;
05ad79
 } MOUNT_2.22;
05ad79
+
05ad79
+/* backport from v2.25 to RHEL7 */
05ad79
+MOUNT_2.25 {
05ad79
+	mnt_table_uniq_fs;
05ad79
+} MOUNT_2.23;
05ad79
+
05ad79
diff -up util-linux-2.23.2/libmount/src/tab.c.kzak util-linux-2.23.2/libmount/src/tab.c
05ad79
--- util-linux-2.23.2/libmount/src/tab.c.kzak	2015-06-23 11:52:04.750058424 +0200
05ad79
+++ util-linux-2.23.2/libmount/src/tab.c	2015-06-23 11:53:26.109462680 +0200
05ad79
@@ -398,6 +398,93 @@ int mnt_table_find_next_fs(struct libmnt
05ad79
 	return 1;
05ad79
 }
05ad79
 
05ad79
+static int mnt_table_move_parent(struct libmnt_table *tb, int oldid, int newid)
05ad79
+{
05ad79
+	struct libmnt_iter itr;
05ad79
+	struct libmnt_fs *fs;
05ad79
+
05ad79
+	if (!tb)
05ad79
+		return -EINVAL;
05ad79
+	if (list_empty(&tb->ents))
05ad79
+		return 0;
05ad79
+
05ad79
+
05ad79
+	mnt_reset_iter(&itr, MNT_ITER_FORWARD);
05ad79
+
05ad79
+	while (mnt_table_next_fs(tb, &itr, &fs) == 0) {
05ad79
+		if (fs->parent == oldid)
05ad79
+			fs->parent = newid;
05ad79
+	}
05ad79
+	return 0;
05ad79
+}
05ad79
+
05ad79
+/**
05ad79
+ * mnt_table_uniq_fs:
05ad79
+ * @tb: table
05ad79
+ * @flags: MNT_UNIQ_*
05ad79
+ * @cmp: function to compare filesystems
05ad79
+ *
05ad79
+ * This function de-duplicate the @tb, but does not change order of the
05ad79
+ * filesystems. The @cmp function has to return 0 if the filesystems are
05ad79
+ * equal, otherwise non-zero.
05ad79
+ *
05ad79
+ * The default is to keep in the table later mounted filesystems (function uses
05ad79
+ * backward mode iterator).
05ad79
+ *
05ad79
+ * @MNT_UNIQ_FORWARD:  remove later mounted filesystems
05ad79
+ * @MNT_UNIQ_KEEPTREE: keep parent->id relation ship stil valid
05ad79
+ *
05ad79
+ * Returns: negative number in case of error, or 0 o success.
05ad79
+ */
05ad79
+int mnt_table_uniq_fs(struct libmnt_table *tb, int flags,
05ad79
+				int (*cmp)(struct libmnt_table *,
05ad79
+					   struct libmnt_fs *,
05ad79
+					   struct libmnt_fs *))
05ad79
+{
05ad79
+	struct libmnt_iter itr;
05ad79
+	struct libmnt_fs *fs;
05ad79
+	int direction = MNT_ITER_BACKWARD;
05ad79
+
05ad79
+	if (!tb || !cmp)
05ad79
+		return -EINVAL;
05ad79
+	if (list_empty(&tb->ents))
05ad79
+		return 0;
05ad79
+
05ad79
+	if (flags & MNT_UNIQ_FORWARD)
05ad79
+		direction = MNT_ITER_FORWARD;
05ad79
+
05ad79
+
05ad79
+	mnt_reset_iter(&itr, direction);
05ad79
+
05ad79
+	if ((flags & MNT_UNIQ_KEEPTREE) && !is_mountinfo(tb))
05ad79
+		flags &= ~MNT_UNIQ_KEEPTREE;
05ad79
+
05ad79
+	while (mnt_table_next_fs(tb, &itr, &fs) == 0) {
05ad79
+		int want = 1;
05ad79
+		struct libmnt_iter xtr;
05ad79
+		struct libmnt_fs *x;
05ad79
+
05ad79
+		mnt_reset_iter(&xtr, direction);
05ad79
+		while (want && mnt_table_next_fs(tb, &xtr, &x) == 0) {
05ad79
+			if (fs == x)
05ad79
+				break;
05ad79
+			want = cmp(tb, x, fs) != 0;
05ad79
+		}
05ad79
+
05ad79
+		if (!want) {
05ad79
+			if (flags & MNT_UNIQ_KEEPTREE)
05ad79
+				mnt_table_move_parent(tb, mnt_fs_get_id(fs),
05ad79
+							  mnt_fs_get_parent_id(fs));
05ad79
+
05ad79
+
05ad79
+
05ad79
+			mnt_table_remove_fs(tb, fs);
05ad79
+		}
05ad79
+	}
05ad79
+
05ad79
+	return 0;
05ad79
+}
05ad79
+
05ad79
 /**
05ad79
  * mnt_table_set_iter:
05ad79
  * @tb: tab pointer
05ad79
diff -up util-linux-2.23.2/sys-utils/fstrim.c.kzak util-linux-2.23.2/sys-utils/fstrim.c
05ad79
--- util-linux-2.23.2/sys-utils/fstrim.c.kzak	2013-06-13 09:46:10.535651605 +0200
05ad79
+++ util-linux-2.23.2/sys-utils/fstrim.c	2015-06-23 11:57:59.435461283 +0200
05ad79
@@ -41,6 +41,11 @@
05ad79
 #include "strutils.h"
05ad79
 #include "c.h"
05ad79
 #include "closestream.h"
05ad79
+#include "pathnames.h"
05ad79
+#include "sysfs.h"
05ad79
+#include "exitcodes.h"
05ad79
+
05ad79
+#include <libmount.h>
05ad79
 
05ad79
 #ifndef FITRIM
05ad79
 struct fstrim_range {
05ad79
@@ -51,16 +56,216 @@ struct fstrim_range {
05ad79
 #define FITRIM		_IOWR('X', 121, struct fstrim_range)
05ad79
 #endif
05ad79
 
05ad79
+/* returns: 0 = success, 1 = unsupported, < 0 = error */
05ad79
+static int fstrim_filesystem(const char *path, struct fstrim_range *rangetpl,
05ad79
+			    int verbose)
05ad79
+{
05ad79
+	int fd;
05ad79
+	struct stat sb;
05ad79
+	struct fstrim_range range;
05ad79
+
05ad79
+	/* kernel modifies the range */
05ad79
+	memcpy(&range, rangetpl, sizeof(range));
05ad79
+
05ad79
+	fd = open(path, O_RDONLY);
05ad79
+	if (fd < 0) {
05ad79
+		warn(_("cannot open %s"), path);
05ad79
+		return -1;
05ad79
+	}
05ad79
+	if (fstat(fd, &sb) == -1) {
05ad79
+		warn(_("stat of %s failed"), path);
05ad79
+		return -1;
05ad79
+	}
05ad79
+	if (!S_ISDIR(sb.st_mode)) {
05ad79
+		warnx(_("%s: not a directory"), path);
05ad79
+		return -1;
05ad79
+	}
05ad79
+	errno = 0;
05ad79
+	if (ioctl(fd, FITRIM, &range)) {
05ad79
+		int rc = errno == EOPNOTSUPP || errno == ENOTTY ? 1 : -1;
05ad79
+
05ad79
+		if (rc != 1)
05ad79
+			warn(_("%s: FITRIM ioctl failed"), path);
05ad79
+		close(fd);
05ad79
+		return rc;
05ad79
+	}
05ad79
+
05ad79
+	if (verbose) {
05ad79
+		char *str = size_to_human_string(
05ad79
+				SIZE_SUFFIX_3LETTER | SIZE_SUFFIX_SPACE,
05ad79
+				(uint64_t) range.len);
05ad79
+		/* TRANSLATORS: The standard value here is a very large number. */
05ad79
+		printf(_("%s: %s (%" PRIu64 " bytes) trimmed\n"),
05ad79
+				path, str, (uint64_t) range.len);
05ad79
+		free(str);
05ad79
+	}
05ad79
+	close(fd);
05ad79
+	return 0;
05ad79
+}
05ad79
+
05ad79
+static int has_discard(const char *devname, struct sysfs_cxt *wholedisk)
05ad79
+{
05ad79
+	struct sysfs_cxt cxt, *parent = NULL;
05ad79
+	uint64_t dg = 0;
05ad79
+	dev_t disk = 0, dev;
05ad79
+	int rc;
05ad79
+
05ad79
+	dev = sysfs_devname_to_devno(devname, NULL);
05ad79
+	if (!dev)
05ad79
+		return 1;
05ad79
+	/*
05ad79
+	 * This is tricky to read the info from sys/, because the queue
05ad79
+	 * atrributes are provided for whole devices (disk) only. We're trying
05ad79
+	 * to reuse the whole-disk sysfs context to optimize this stuff (as
05ad79
+	 * system usually have just one disk only).
05ad79
+	 */
05ad79
+	if (sysfs_devno_to_wholedisk(dev, NULL, 0, &disk) || !disk)
05ad79
+		return 1;
05ad79
+	if (dev != disk) {
05ad79
+		if (wholedisk->devno != disk) {
05ad79
+			sysfs_deinit(wholedisk);
05ad79
+			if (sysfs_init(wholedisk, disk, NULL))
05ad79
+				return 1;
05ad79
+		}
05ad79
+		parent = wholedisk;
05ad79
+	}
05ad79
+
05ad79
+	rc = sysfs_init(&cxt, dev, parent);
05ad79
+	if (!rc)
05ad79
+		rc = sysfs_read_u64(&cxt, "queue/discard_granularity", &dg;;
05ad79
+
05ad79
+	sysfs_deinit(&cxt);
05ad79
+	return rc == 0 && dg > 0;
05ad79
+}
05ad79
+
05ad79
+
05ad79
+static int uniq_fs_target_cmp(
05ad79
+		struct libmnt_table *tb __attribute__((__unused__)),
05ad79
+		struct libmnt_fs *a,
05ad79
+		struct libmnt_fs *b)
05ad79
+{
05ad79
+	return !mnt_fs_streq_target(a, mnt_fs_get_target(b));
05ad79
+}
05ad79
+
05ad79
+static int uniq_fs_source_cmp(
05ad79
+		struct libmnt_table *tb __attribute__((__unused__)),
05ad79
+		struct libmnt_fs *a,
05ad79
+		struct libmnt_fs *b)
05ad79
+{
05ad79
+	int eq;
05ad79
+
05ad79
+	if (mnt_fs_is_pseudofs(a) || mnt_fs_is_netfs(a) ||
05ad79
+	    mnt_fs_is_pseudofs(b) || mnt_fs_is_netfs(b))
05ad79
+		return 1;
05ad79
+
05ad79
+	eq = mnt_fs_streq_srcpath(a, mnt_fs_get_srcpath(b));
05ad79
+	if (eq) {
05ad79
+		const char *aroot = mnt_fs_get_root(a),
05ad79
+			   *broot = mnt_fs_get_root(b);
05ad79
+		if (!aroot || !broot)
05ad79
+			eq = 0;
05ad79
+		else if (strcmp(aroot, broot) != 0)
05ad79
+			eq = 0;
05ad79
+	}
05ad79
+
05ad79
+	return !eq;
05ad79
+}
05ad79
+
05ad79
+/*
05ad79
+ * fstrim --all follows "mount -a" return codes:
05ad79
+ *
05ad79
+ * 0  = all success
05ad79
+ * 32 = all failed
05ad79
+ * 64 = some failed, some success
05ad79
+ */
05ad79
+static int fstrim_all(struct fstrim_range *rangetpl, int verbose)
05ad79
+{
05ad79
+	struct libmnt_fs *fs;
05ad79
+	struct libmnt_iter *itr;
05ad79
+	struct libmnt_table *tab;
05ad79
+	struct sysfs_cxt wholedisk = UL_SYSFSCXT_EMPTY;
05ad79
+	int cnt = 0, cnt_err = 0;
05ad79
+
05ad79
+	mnt_init_debug(0);
05ad79
+
05ad79
+	itr = mnt_new_iter(MNT_ITER_BACKWARD);
05ad79
+	if (!itr)
05ad79
+		err(MOUNT_EX_FAIL, _("failed to initialize libmount iterator"));
05ad79
+
05ad79
+	tab = mnt_new_table_from_file(_PATH_PROC_MOUNTINFO);
05ad79
+	if (!tab)
05ad79
+		err(MOUNT_EX_FAIL, _("failed to parse %s"), _PATH_PROC_MOUNTINFO);
05ad79
+
05ad79
+	/* de-duplicate by mountpoints */
05ad79
+	mnt_table_uniq_fs(tab, 0, uniq_fs_target_cmp);
05ad79
+
05ad79
+	/* de-duplicate by source and root */
05ad79
+	mnt_table_uniq_fs(tab, 0, uniq_fs_source_cmp);
05ad79
+
05ad79
+	while (mnt_table_next_fs(tab, itr, &fs) == 0) {
05ad79
+		const char *src = mnt_fs_get_srcpath(fs),
05ad79
+			   *tgt = mnt_fs_get_target(fs);
05ad79
+		char *path;
05ad79
+		int rc = 1;
05ad79
+
05ad79
+		if (!src || !tgt || *src != '/' ||
05ad79
+		    mnt_fs_is_pseudofs(fs) ||
05ad79
+		    mnt_fs_is_netfs(fs))
05ad79
+			continue;
05ad79
+
05ad79
+		/* Is it really accessible mountpoint? Not all mountpoints are
05ad79
+		 * accessible (maybe over mounted by another fylesystem) */
05ad79
+		path = mnt_get_mountpoint(tgt);
05ad79
+		if (path && strcmp(path, tgt) == 0)
05ad79
+			rc = 0;
05ad79
+		free(path);
05ad79
+		if (rc)
05ad79
+			continue;	/* overlaying mount */
05ad79
+
05ad79
+		if (!has_discard(src, &wholedisk))
05ad79
+			continue;
05ad79
+		cnt++;
05ad79
+
05ad79
+		/*
05ad79
+		 * We're able to detect that the device supports discard, but
05ad79
+		 * things also depend on filesystem or device mapping, for
05ad79
+		 * example vfat or LUKS (by default) does not support FSTRIM.
05ad79
+		 *
05ad79
+		 * This is reason why we ignore EOPNOTSUPP and ENOTTY errors
05ad79
+		 * from discard ioctl.
05ad79
+		 */
05ad79
+		if (fstrim_filesystem(tgt, rangetpl, verbose) < 0)
05ad79
+		       cnt_err++;
05ad79
+	}
05ad79
+
05ad79
+	sysfs_deinit(&wholedisk);
05ad79
+	mnt_free_table(tab);
05ad79
+	mnt_free_iter(itr);
05ad79
+
05ad79
+	if (cnt && cnt == cnt_err)
05ad79
+		return MOUNT_EX_FAIL;		/* all failed */
05ad79
+	if (cnt && cnt_err)
05ad79
+		return MOUNT_EX_SOMEOK;		/* some ok */
05ad79
+
05ad79
+	return EXIT_SUCCESS;
05ad79
+}
05ad79
+
05ad79
 static void __attribute__((__noreturn__)) usage(FILE *out)
05ad79
 {
05ad79
 	fputs(USAGE_HEADER, out);
05ad79
 	fprintf(out,
05ad79
 	      _(" %s [options] <mount point>\n"), program_invocation_short_name);
05ad79
+
05ad79
+	fputs(USAGE_SEPARATOR, out);
05ad79
+	fputs(_("Discard unused blocks on a mounted filesystem.\n"), out);
05ad79
+
05ad79
 	fputs(USAGE_OPTIONS, out);
05ad79
-	fputs(_(" -o, --offset <num>  offset in bytes to discard from\n"
05ad79
-		" -l, --length <num>  length of bytes to discard from the offset\n"
05ad79
-		" -m, --minimum <num> minimum extent length to discard\n"
05ad79
-		" -v, --verbose       print number of discarded bytes\n"), out);
05ad79
+	fputs(_(" -a, --all           trim all mounted filesystems that are supported\n"), out);
05ad79
+	fputs(_(" -o, --offset <num>  the offset in bytes to start discarding from\n"), out);
05ad79
+	fputs(_(" -l, --length <num>  the number of bytes to discard\n"), out);
05ad79
+	fputs(_(" -m, --minimum <num> the minimum extent length to discard\n"), out);
05ad79
+	fputs(_(" -v, --verbose       print number of discarded bytes\n"), out);
05ad79
+
05ad79
 	fputs(USAGE_SEPARATOR, out);
05ad79
 	fputs(USAGE_HELP, out);
05ad79
 	fputs(USAGE_VERSION, out);
05ad79
@@ -70,12 +275,12 @@ static void __attribute__((__noreturn__)
05ad79
 
05ad79
 int main(int argc, char **argv)
05ad79
 {
05ad79
-	char *path;
05ad79
-	int c, fd, verbose = 0;
05ad79
+	char *path = NULL;
05ad79
+	int c, rc, verbose = 0, all = 0;
05ad79
 	struct fstrim_range range;
05ad79
-	struct stat sb;
05ad79
 
05ad79
 	static const struct option longopts[] = {
05ad79
+	    { "all",       0, 0, 'a' },
05ad79
 	    { "help",      0, 0, 'h' },
05ad79
 	    { "version",   0, 0, 'V' },
05ad79
 	    { "offset",    1, 0, 'o' },
05ad79
@@ -93,8 +298,11 @@ int main(int argc, char **argv)
05ad79
 	memset(&range, 0, sizeof(range));
05ad79
 	range.len = ULLONG_MAX;
05ad79
 
05ad79
-	while ((c = getopt_long(argc, argv, "hVo:l:m:v", longopts, NULL)) != -1) {
05ad79
+	while ((c = getopt_long(argc, argv, "ahVo:l:m:v", longopts, NULL)) != -1) {
05ad79
 		switch(c) {
05ad79
+		case 'a':
05ad79
+			all = 1;
05ad79
+			break;
05ad79
 		case 'h':
05ad79
 			usage(stdout);
05ad79
 			break;
05ad79
@@ -122,38 +330,26 @@ int main(int argc, char **argv)
05ad79
 		}
05ad79
 	}
05ad79
 
05ad79
-	if (optind == argc)
05ad79
-		errx(EXIT_FAILURE, _("no mountpoint specified"));
05ad79
-
05ad79
-	path = argv[optind++];
05ad79
+	if (!all) {
05ad79
+		if (optind == argc)
05ad79
+			errx(EXIT_FAILURE, _("no mountpoint specified"));
05ad79
+		path = argv[optind++];
05ad79
+	}
05ad79
 
05ad79
 	if (optind != argc) {
05ad79
 		warnx(_("unexpected number of arguments"));
05ad79
 		usage(stderr);
05ad79
 	}
05ad79
 
05ad79
-	if (stat(path, &sb) == -1)
05ad79
-		err(EXIT_FAILURE, _("stat failed %s"), path);
05ad79
-	if (!S_ISDIR(sb.st_mode))
05ad79
-		errx(EXIT_FAILURE, _("%s: not a directory"), path);
05ad79
-
05ad79
-	fd = open(path, O_RDONLY);
05ad79
-	if (fd < 0)
05ad79
-		err(EXIT_FAILURE, _("cannot open %s"), path);
05ad79
-
05ad79
-	if (ioctl(fd, FITRIM, &range))
05ad79
-		err(EXIT_FAILURE, _("%s: FITRIM ioctl failed"), path);
05ad79
-
05ad79
-	if (verbose) {
05ad79
-		char *str = size_to_human_string(SIZE_SUFFIX_3LETTER |
05ad79
-						 SIZE_SUFFIX_SPACE,
05ad79
-						 (uint64_t) range.len);
05ad79
-		/* TRANSLATORS: The standard value here is a very large number. */
05ad79
-		printf(_("%s: %s (%" PRIu64 " bytes) trimmed\n"),
05ad79
-						path, str,
05ad79
-						(uint64_t) range.len);
05ad79
-		free(str);
05ad79
+	if (all)
05ad79
+		rc = fstrim_all(&range, verbose);
05ad79
+	else {
05ad79
+		rc = fstrim_filesystem(path, &range, verbose);
05ad79
+		if (rc == 1) {
05ad79
+			warnx(_("%s: the discard operation is not supported"), path);
05ad79
+			rc = EXIT_FAILURE;
05ad79
+		}
05ad79
 	}
05ad79
-	close(fd);
05ad79
-	return EXIT_SUCCESS;
05ad79
+
05ad79
+	return rc;
05ad79
 }
05ad79
diff -up util-linux-2.23.2/sys-utils/fstrim.service.in.kzak util-linux-2.23.2/sys-utils/fstrim.service
05ad79
--- util-linux-2.23.2/sys-utils/fstrim.service.in.kzak	2015-06-23 12:02:18.505564273 +0200
05ad79
+++ util-linux-2.23.2/sys-utils/fstrim.service.in	2015-06-23 12:02:05.049662802 +0200
05ad79
@@ -0,0 +1,6 @@
05ad79
+[Unit]
05ad79
+Description=Discard unused blocks
05ad79
+
05ad79
+[Service]
05ad79
+Type=oneshot
05ad79
+ExecStart=@sbindir@/fstrim -a
05ad79
diff -up util-linux-2.23.2/sys-utils/fstrim.timer.kzak util-linux-2.23.2/sys-utils/fstrim.timer
05ad79
--- util-linux-2.23.2/sys-utils/fstrim.timer.kzak	2015-06-23 12:02:18.505564273 +0200
05ad79
+++ util-linux-2.23.2/sys-utils/fstrim.timer	2015-06-23 12:02:05.049662802 +0200
05ad79
@@ -0,0 +1,11 @@
05ad79
+[Unit]
05ad79
+Description=Discard unused blocks once a week
05ad79
+Documentation=man:fstrim
05ad79
+
05ad79
+[Timer]
05ad79
+OnCalendar=weekly
05ad79
+AccuracySec=1h
05ad79
+Persistent=true
05ad79
+
05ad79
+[Install]
05ad79
+WantedBy=multi-user.target
05ad79
diff -up util-linux-2.23.2/sys-utils/Makemodule.am.kzak util-linux-2.23.2/sys-utils/Makemodule.am
05ad79
--- util-linux-2.23.2/sys-utils/Makemodule.am.kzak	2015-06-23 11:59:05.803975307 +0200
05ad79
+++ util-linux-2.23.2/sys-utils/Makemodule.am	2015-06-23 12:01:18.682002323 +0200
05ad79
@@ -68,7 +68,18 @@ fsfreeze_SOURCES = sys-utils/fsfreeze.c
05ad79
 sbin_PROGRAMS += fstrim
05ad79
 dist_man_MANS += sys-utils/fstrim.8
05ad79
 fstrim_SOURCES = sys-utils/fstrim.c
05ad79
-fstrim_LDADD = $(LDADD) libcommon.la
05ad79
+fstrim_LDADD = $(LDADD) libcommon.la libmount.la
05ad79
+fstrim_CFLAGS = $(AM_CFLAGS) -I$(ul_libmount_incdir)
05ad79
+
05ad79
+if HAVE_SYSTEMD
05ad79
+systemdsystemunit_DATA += \
05ad79
+		sys-utils/fstrim.service \
05ad79
+		sys-utils/fstrim.timer
05ad79
+endif
05ad79
+
05ad79
+PATHFILES += sys-utils/fstrim.service
05ad79
+EXTRA_DIST += sys-utils/fstrim.timer
05ad79
+
05ad79
 
05ad79
 sbin_PROGRAMS += blkdiscard
05ad79
 dist_man_MANS += sys-utils/blkdiscard.8