/*
 * Test program for lazyatime mount option.  Use it to remount a file
 * system with the lazyatime option (and no other other options).
 * Example:
 *
 * # ./my_mount /dev/sda6 /home ext3
 *
 */
#include <stdio.h>
#include <stdlib.h>
#include <sys/mount.h>

#ifndef MS_LAZYATIME
#define MS_LAZYATIME	(1<<21)	/* Lazily update on-disk access times. */
#endif

int main (int argc, char *argv[])
{
	int err;
	char *cmd = argv[0];

	if (argc != 4) {
		fprintf(stderr,"Usage: %s <device> <mountpoint> <fs type>\n",
			cmd);
		exit (1);
	}

	err = mount(argv[1], argv[2], argv[3], MS_REMOUNT | MS_LAZYATIME, NULL);
	if (err)
		perror(cmd);

	return (err ? 1 : 0);
}
