static int add_matching_lines(struct libmnt_table *tb,
			      struct libscols_table *table, int direction)
{
	struct libmnt_iter *itr;
	struct libmnt_fs *fs;
	int nlines = 0, rc = -1;

	itr = mnt_new_iter(direction);
	if (!itr) {
		warn(_("failed to initialize libmount iterator"));
		goto done;
	}

	while((fs = get_next_fs(tb, itr))) {
		if ((flags & FL_TREE) || (flags & FL_SUBMOUNTS))
			rc = create_treenode(table, tb, fs, NULL);
		else
			rc = !add_line(table, fs, NULL);
		if (rc)
			goto done;
		nlines++;
		if (flags & FL_FIRSTONLY)
			break;
		flags |= FL_NOSWAPMATCH;
	}

	if (nlines)
		rc = 0;
done:
	mnt_free_iter(itr);
	return rc;
}
static int add_matching_lines(struct libmnt_table *tb,
			      struct libscols_table *table, int direction)
{
	struct libmnt_iter *itr;
	struct libmnt_fs *fs;
	int nlines = 0, rc = -1;

	itr = mnt_new_iter(direction);
	if (!itr) {
		warn(_("failed to initialize libmount iterator"));
		goto done;
	}

	while((fs = get_next_fs(tb, itr))) {
		if ((flags & FL_TREE) || (flags & FL_SUBMOUNTS))
			rc = create_treenode(table, tb, fs, NULL);
		else
			rc = !add_line(table, fs, NULL);
		if (rc)
			goto done;
		nlines++;
		if (flags & FL_FIRSTONLY)
			break;
		flags |= FL_NOSWAPMATCH;
	}

	if (nlines)
		rc = 0;
done:
	mnt_free_iter(itr);
	return rc;
}