Subject: Re: Adding -f option to mount_lfs(8)
To: Juan RP <juan@xtraeme.nopcode.org>
From: Julio M. Merino Vidal <jmmv84@gmail.com>
List: tech-userlevel
Date: 03/31/2005 17:49:23
On Thu, 2005-03-31 at 00:50 +0200, Juan RP wrote:
> I wanted to give a try to the -f option of lfs_cleanerd(8), but this
> option wasn't supported, so I created a simple patch:
>
> Is ok to commit?
> Index: mount_lfs.c
> ===================================================================
> RCS file: /cvsroot/src/sbin/mount_lfs/mount_lfs.c,v
> retrieving revision 1.22
> diff -b -u -r1.22 mount_lfs.c
> --- mount_lfs.c 9 Feb 2005 14:31:29 -0000 1.22
> +++ mount_lfs.c 30 Mar 2005 22:47:16 -0000
> @@ -75,7 +75,7 @@
> static void kill_daemon(char *);
> static void kill_cleaner(char *);
>
> -static int short_rds, cleaner_debug, cleaner_bytes;
> +static int short_rds, cleaner_debug, cleaner_bytes, fs_idle;
> static char *nsegs;
>
> #ifndef MOUNT_NOMAIN
> @@ -101,7 +101,7 @@
> nsegs = "4";
> mntflags = noclean = 0;
> cleaner_bytes = 1;
> - while ((ch = getopt(argc, argv, "bdN:no:s")) != -1)
> + while ((ch = getopt(argc, argv, "bdfN:no:s")) != -1)
> switch (ch) {
> case 'b':
> cleaner_bytes = !cleaner_bytes;
> @@ -109,6 +109,9 @@
> case 'd':
> cleaner_debug = 1;
> break;
> + case 'f':
> + fs_idle = 1;
> + break;
Note the bogus indentation. You used spaces rather than tabs.
> case 'n':
> noclean = 1;
> break;
> @@ -252,7 +255,7 @@
> static void
> invoke_cleaner(char *name)
> {
> - char *args[6], **ap = args;
> + char *args[7], **ap = args;
>
> /* Build the argument list. */
> *ap++ = _PATH_LFS_CLEANERD;
> @@ -266,6 +269,8 @@
> *ap++ = "-s";
> if (cleaner_debug)
> *ap++ = "-d";
> + if (fs_idle)
> + *ap++ = "-f";
Same here.
--
Julio M. Merino Vidal <jmmv84@gmail.com>
http://www.livejournal.com/users/jmmv/
The NetBSD Project - http://www.NetBSD.org/