CVS commit: src/libexec/lfs_cleanerd

2021-07-31 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Sat Jul 31 15:02:54 UTC 2021

Modified Files:
src/libexec/lfs_cleanerd: lfs_cleanerd.8

Log Message:
s/threshhold/threshold


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/libexec/lfs_cleanerd/lfs_cleanerd.8

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/libexec/lfs_cleanerd/lfs_cleanerd.8
diff -u src/libexec/lfs_cleanerd/lfs_cleanerd.8:1.20 src/libexec/lfs_cleanerd/lfs_cleanerd.8:1.21
--- src/libexec/lfs_cleanerd/lfs_cleanerd.8:1.20	Sat Aug 31 07:49:48 2019
+++ src/libexec/lfs_cleanerd/lfs_cleanerd.8	Sat Jul 31 15:02:54 2021
@@ -1,4 +1,4 @@
-.\"	$NetBSD: lfs_cleanerd.8,v 1.20 2019/08/31 07:49:48 wiz Exp $
+.\"	$NetBSD: lfs_cleanerd.8,v 1.21 2021/07/31 15:02:54 andvar Exp $
 .\"
 .\" Copyright (c) 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -40,7 +40,7 @@
 .Op Fl bcDdfmqs
 .Op Fl i Ar segment-number
 .Op Fl J Ar raw-device
-.Op Fl l Ar load-threshhold
+.Op Fl l Ar load-threshold
 .Op Fl n Ar number-of-segments
 .Op Fl r Ar report-frequency
 .Op Fl S Ar semaphore-address
@@ -102,9 +102,9 @@ trying to figure it out from the mount p
 This is mostly useful when the cleaner is compiled into
 .Xr rump_lfs 8
 and the ATF test framework.
-.It Fl l Ar load-threshhold
-Clean more aggressively when the system load is below the given threshhold.
-The default threshhold is 0.2.
+.It Fl l Ar load-threshold
+Clean more aggressively when the system load is below the given threshold.
+The default threshold is 0.2.
 .It Fl m
 Does nothing.
 This option is present for historical compatibility.



CVS commit: src/libexec/lfs_cleanerd

2020-06-07 Thread Santhosh Raju
Module Name:src
Committed By:   fox
Date:   Sun Jun  7 23:15:53 UTC 2020

Modified Files:
src/libexec/lfs_cleanerd: Makefile.inc

Log Message:
libexec/lfs_cleanerd: Suppress -Werror=stringop-truncation error

This logic correctly uses strncpy(3) to fully initialize a fixed-width field, 
and also ensures
NUL-termination on the next line as other users of the field expect.

Add -Werror=stringop-truncation to prevent build failure, when run with 
MKSANITIZER=yes.

Error was reported when build.sh was run with MKSANITIZER=yes flag.

Reviewed by: kamil@, riastradh@


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/libexec/lfs_cleanerd/Makefile.inc

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/libexec/lfs_cleanerd/Makefile.inc
diff -u src/libexec/lfs_cleanerd/Makefile.inc:1.6 src/libexec/lfs_cleanerd/Makefile.inc:1.7
--- src/libexec/lfs_cleanerd/Makefile.inc:1.6	Sat Jun  8 21:15:29 2013
+++ src/libexec/lfs_cleanerd/Makefile.inc	Sun Jun  7 23:15:53 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.inc,v 1.6 2013/06/08 21:15:29 dholland Exp $
+#	$NetBSD: Makefile.inc,v 1.7 2020/06/07 23:15:53 fox Exp $
 #	@(#)Makefile	8.1 (Berkeley) 6/18/93
 
 WARNS?=3		# XXX: too many sign-compare issues
@@ -11,6 +11,8 @@ SRCS+=	bufcache.c vnode.c lfs.c kernelop
 .PATH:	${NETBSDSRCDIR}/sys/ufs/lfs ${NETBSDSRCDIR}/sbin/fsck_lfs	\
 	${NETBSDSRCDIR}/libexec/lfs_cleanerd
 
+COPTS.lfs_cleanerd.c+=	${GCC_NO_STRINGOP_TRUNCATION}
+
 FSCK_LFS= ${NETBSDSRCDIR}/sbin/fsck_lfs
 DPADD+=  ${LIBUTIL}
 LDADD+=  -lutil



CVS commit: src/libexec/lfs_cleanerd

2016-03-19 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Wed Mar 16 18:58:34 UTC 2016

Modified Files:
src/libexec/lfs_cleanerd: lfs_cleanerd.c

Log Message:
make the GCC 4.8 specific hack for ci.clean being set GCC >= 4.8.


To generate a diff of this commit:
cvs rdiff -u -r1.56 -r1.57 src/libexec/lfs_cleanerd/lfs_cleanerd.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/libexec/lfs_cleanerd/lfs_cleanerd.c
diff -u src/libexec/lfs_cleanerd/lfs_cleanerd.c:1.56 src/libexec/lfs_cleanerd/lfs_cleanerd.c:1.57
--- src/libexec/lfs_cleanerd/lfs_cleanerd.c:1.56	Fri Feb 19 03:54:37 2016
+++ src/libexec/lfs_cleanerd/lfs_cleanerd.c	Wed Mar 16 18:58:34 2016
@@ -1,4 +1,4 @@
-/* $NetBSD: lfs_cleanerd.c,v 1.56 2016/02/19 03:54:37 riastradh Exp $	 */
+/* $NetBSD: lfs_cleanerd.c,v 1.57 2016/03/16 18:58:34 mrg Exp $	 */
 
 /*-
  * Copyright (c) 2005 The NetBSD Foundation, Inc.
@@ -1453,10 +1453,11 @@ lfs_cleaner_main(int argc, char **argv)
 	char *cp, *pidname;
 #endif
 
-#if defined(__GNUC__) && __GNUC__ >= 4 && __GNUC_MINOR__ == 8 && \
+#if defined(__GNUC__) && \
+(__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8)) && \
 defined(__OPTIMIZE_SIZE__)
 	/*
-	 * XXX: Work around apparent bug with gcc 4.8 and -Os: it
+	 * XXX: Work around apparent bug with GCC >= 4.8 and -Os: it
 	 * claims that ci.clean is uninitialized in clean_fs (at one
 	 * of the several uses of it, which is neither the first nor
 	 * last use) -- this doesn't happen with plain -O2.



CVS commit: src/libexec/lfs_cleanerd

2016-03-19 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Fri Mar 18 10:10:21 UTC 2016

Modified Files:
src/libexec/lfs_cleanerd: lfs_cleanerd.c

Log Message:
move the compiler hack closer to the source of the fail


To generate a diff of this commit:
cvs rdiff -u -r1.57 -r1.58 src/libexec/lfs_cleanerd/lfs_cleanerd.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/libexec/lfs_cleanerd/lfs_cleanerd.c
diff -u src/libexec/lfs_cleanerd/lfs_cleanerd.c:1.57 src/libexec/lfs_cleanerd/lfs_cleanerd.c:1.58
--- src/libexec/lfs_cleanerd/lfs_cleanerd.c:1.57	Wed Mar 16 18:58:34 2016
+++ src/libexec/lfs_cleanerd/lfs_cleanerd.c	Fri Mar 18 10:10:21 2016
@@ -1,4 +1,4 @@
-/* $NetBSD: lfs_cleanerd.c,v 1.57 2016/03/16 18:58:34 mrg Exp $	 */
+/* $NetBSD: lfs_cleanerd.c,v 1.58 2016/03/18 10:10:21 mrg Exp $	 */
 
 /*-
  * Copyright (c) 2005 The NetBSD Foundation, Inc.
@@ -1284,8 +1284,23 @@ needs_cleaning(struct clfs *fs, CLEANERI
 	double loadavg;
 
 	/* If this fs is "on hold", don't clean it. */
-	if (fs->clfs_onhold)
+	if (fs->clfs_onhold) {
+#if defined(__GNUC__) && \
+(__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8)) && \
+defined(__OPTIMIZE_SIZE__)
+	/*
+	 * XXX: Work around apparent bug with GCC >= 4.8 and -Os: it
+	 * claims that ci.clean is uninitialized in clean_fs (at one
+	 * of the several uses of it, which is neither the first nor
+	 * last use) -- this doesn't happen with plain -O2.
+	 *
+	 * Hopefully in the future further rearrangements will allow
+	 * removing this hack.
+	 */
+		cip->clean = 0;
+#endif
 		return 0;
+	}
 
 	/*
 	 * Read the cleanerinfo block from the Ifile.  We don't want
@@ -1453,21 +1468,6 @@ lfs_cleaner_main(int argc, char **argv)
 	char *cp, *pidname;
 #endif
 
-#if defined(__GNUC__) && \
-(__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8)) && \
-defined(__OPTIMIZE_SIZE__)
-	/*
-	 * XXX: Work around apparent bug with GCC >= 4.8 and -Os: it
-	 * claims that ci.clean is uninitialized in clean_fs (at one
-	 * of the several uses of it, which is neither the first nor
-	 * last use) -- this doesn't happen with plain -O2.
-	 *
-	 * Hopefully in the future further rearrangements will allow
-	 * removing this hack.
-	 */
-	ci.clean = 0;
-#endif
-
 	/*
 	 * Set up defaults
 	 */



CVS commit: src/libexec/lfs_cleanerd

2016-02-18 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Fri Feb 19 03:54:37 UTC 2016

Modified Files:
src/libexec/lfs_cleanerd: lfs_cleanerd.c

Log Message:
Need  for true/false.


To generate a diff of this commit:
cvs rdiff -u -r1.55 -r1.56 src/libexec/lfs_cleanerd/lfs_cleanerd.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/libexec/lfs_cleanerd/lfs_cleanerd.c
diff -u src/libexec/lfs_cleanerd/lfs_cleanerd.c:1.55 src/libexec/lfs_cleanerd/lfs_cleanerd.c:1.56
--- src/libexec/lfs_cleanerd/lfs_cleanerd.c:1.55	Thu Oct 15 06:25:04 2015
+++ src/libexec/lfs_cleanerd/lfs_cleanerd.c	Fri Feb 19 03:54:37 2016
@@ -1,4 +1,4 @@
-/* $NetBSD: lfs_cleanerd.c,v 1.55 2015/10/15 06:25:04 dholland Exp $	 */
+/* $NetBSD: lfs_cleanerd.c,v 1.56 2016/02/19 03:54:37 riastradh Exp $	 */
 
 /*-
  * Copyright (c) 2005 The NetBSD Foundation, Inc.
@@ -45,6 +45,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 



CVS commit: src/libexec/lfs_cleanerd

2015-10-15 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Thu Oct 15 06:25:04 UTC 2015

Modified Files:
src/libexec/lfs_cleanerd: lfs_cleanerd.c

Log Message:
Enable lfs64 in the cleaner.


To generate a diff of this commit:
cvs rdiff -u -r1.54 -r1.55 src/libexec/lfs_cleanerd/lfs_cleanerd.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/libexec/lfs_cleanerd/lfs_cleanerd.c
diff -u src/libexec/lfs_cleanerd/lfs_cleanerd.c:1.54 src/libexec/lfs_cleanerd/lfs_cleanerd.c:1.55
--- src/libexec/lfs_cleanerd/lfs_cleanerd.c:1.54	Sat Oct  3 08:28:30 2015
+++ src/libexec/lfs_cleanerd/lfs_cleanerd.c	Thu Oct 15 06:25:04 2015
@@ -1,4 +1,4 @@
-/* $NetBSD: lfs_cleanerd.c,v 1.54 2015/10/03 08:28:30 dholland Exp $	 */
+/* $NetBSD: lfs_cleanerd.c,v 1.55 2015/10/15 06:25:04 dholland Exp $	 */
 
 /*-
  * Copyright (c) 2005 The NetBSD Foundation, Inc.
@@ -264,12 +264,27 @@ init_fs(struct clfs *fs, char *fsname)
 	free(sbuf);
 
 	/* If it is not LFS, complain and exit! */
-	if (fs->lfs_dlfs_u.u_32.dlfs_magic != LFS_MAGIC) {
+	switch (fs->lfs_dlfs_u.u_32.dlfs_magic) {
+	case LFS_MAGIC:
+		fs->lfs_is64 = false;
+		fs->lfs_dobyteswap = false;
+		break;
+	case LFS_MAGIC_SWAPPED:
+		fs->lfs_is64 = false;
+		fs->lfs_dobyteswap = true;
+		break;
+	case LFS64_MAGIC:
+		fs->lfs_is64 = true;
+		fs->lfs_dobyteswap = false;
+		break;
+	case LFS64_MAGIC_SWAPPED:
+		fs->lfs_is64 = true;
+		fs->lfs_dobyteswap = true;
+		break;
+	default:
 		syslog(LOG_ERR, "%s: not LFS", fsname);
 		return -1;
 	}
-	fs->lfs_is64 = 0; /* XXX notyet */
-	fs->lfs_dobyteswap = 0; /* XXX notyet */
 	/* XXX: can this ever need to be set? does the cleaner even care? */
 	fs->lfs_hasolddirfmt = 0;
 



CVS commit: src/libexec/lfs_cleanerd

2015-10-10 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Sat Oct 10 22:34:47 UTC 2015

Modified Files:
src/libexec/lfs_cleanerd: Makefile coalesce.c

Log Message:
Use llabs(), not abs(), on the difference of daddr_t's.
Caught by clang, reported by joerg.

Turn off the clang-specific compiler flags that were making the report
nonfatal.


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/libexec/lfs_cleanerd/Makefile
cvs rdiff -u -r1.32 -r1.33 src/libexec/lfs_cleanerd/coalesce.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/libexec/lfs_cleanerd/Makefile
diff -u src/libexec/lfs_cleanerd/Makefile:1.18 src/libexec/lfs_cleanerd/Makefile:1.19
--- src/libexec/lfs_cleanerd/Makefile:1.18	Tue Mar  4 21:06:47 2014
+++ src/libexec/lfs_cleanerd/Makefile	Sat Oct 10 22:34:46 2015
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.18 2014/03/04 21:06:47 joerg Exp $
+#	$NetBSD: Makefile,v 1.19 2015/10/10 22:34:46 dholland Exp $
 #	@(#)Makefile	8.1 (Berkeley) 6/18/93
 
 .include "Makefile.inc"
@@ -11,6 +11,4 @@ BINDIR=		/libexec
 LDSTATIC?=  -static
 .endif
 
-CWARNFLAGS.clang+=	-Wno-error=absolute-value
-
 .include 

Index: src/libexec/lfs_cleanerd/coalesce.c
diff -u src/libexec/lfs_cleanerd/coalesce.c:1.32 src/libexec/lfs_cleanerd/coalesce.c:1.33
--- src/libexec/lfs_cleanerd/coalesce.c:1.32	Wed Aug 12 18:28:00 2015
+++ src/libexec/lfs_cleanerd/coalesce.c	Sat Oct 10 22:34:46 2015
@@ -1,4 +1,4 @@
-/*  $NetBSD: coalesce.c,v 1.32 2015/08/12 18:28:00 dholland Exp $  */
+/*  $NetBSD: coalesce.c,v 1.33 2015/10/10 22:34:46 dholland Exp $  */
 
 /*-
  * Copyright (c) 2002, 2005 The NetBSD Foundation, Inc.
@@ -269,7 +269,7 @@ clean_inode(struct clfs *fs, ino_t ino)
 	for (i = 1; i < nb; i++) {
 		if (bip[i].bi_daddr != bip[i - 1].bi_daddr + lfs_sb_getfrag(fs))
 			++noff;
-		toff += abs(bip[i].bi_daddr - bip[i - 1].bi_daddr
+		toff += llabs(bip[i].bi_daddr - bip[i - 1].bi_daddr
 		- lfs_sb_getfrag(fs)) >> lfs_sb_getfbshift(fs);
 	}
 



CVS commit: src/libexec/lfs_cleanerd

2015-10-03 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Sat Oct  3 08:28:30 UTC 2015

Modified Files:
src/libexec/lfs_cleanerd: lfs_cleanerd.c

Log Message:
Use IINFO in the cleaner.


To generate a diff of this commit:
cvs rdiff -u -r1.53 -r1.54 src/libexec/lfs_cleanerd/lfs_cleanerd.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/libexec/lfs_cleanerd/lfs_cleanerd.c
diff -u src/libexec/lfs_cleanerd/lfs_cleanerd.c:1.53 src/libexec/lfs_cleanerd/lfs_cleanerd.c:1.54
--- src/libexec/lfs_cleanerd/lfs_cleanerd.c:1.53	Tue Sep  1 06:16:58 2015
+++ src/libexec/lfs_cleanerd/lfs_cleanerd.c	Sat Oct  3 08:28:30 2015
@@ -1,4 +1,4 @@
-/* $NetBSD: lfs_cleanerd.c,v 1.53 2015/09/01 06:16:58 dholland Exp $	 */
+/* $NetBSD: lfs_cleanerd.c,v 1.54 2015/10/03 08:28:30 dholland Exp $	 */
 
 /*-
  * Copyright (c) 2005 The NetBSD Foundation, Inc.
@@ -419,9 +419,9 @@ parse_pseg(struct clfs *fs, daddr_t dadd
 	SEGSUM *ssp;
 	IFILE *ifp;
 	BLOCK_INFO *bip, *nbip;
-	int32_t *iaddrp;
 	daddr_t idaddr, odaddr;
 	FINFO *fip;
+	IINFO *iip;
 	struct ubuf *ifbp;
 	union lfs_dinode *dip;
 	u_int32_t ck, vers;
@@ -440,8 +440,7 @@ parse_pseg(struct clfs *fs, daddr_t dadd
 	 */
 	cp = fd_ptrget(fs->clfs_devvp, daddr);
 	ssp = (SEGSUM *)cp;
-	/* XXX ondisk32 */
-	iaddrp = ((int32_t *)(cp + lfs_sb_getibsize(fs))) - 1;
+	iip = SEGSUM_IINFOSTART(fs, cp);
 	fip = SEGSUM_FINFOBASE(fs, cp);
 
 	/*
@@ -479,7 +478,7 @@ parse_pseg(struct clfs *fs, daddr_t dadd
 		 * We must have either a file block or an inode block.
 		 * If we don't have either one, it's an error.
 		 */
-		if (fic >= lfs_ss_getnfinfo(fs, ssp) && *iaddrp != daddr) {
+		if (fic >= lfs_ss_getnfinfo(fs, ssp) && lfs_ii_getblock(fs, iip) != daddr) {
 			syslog(LOG_WARNING, "%s: bad pseg at %jx (seg %d)",
 			   lfs_sb_getfsmnt(fs), (intmax_t)odaddr, lfs_dtosn(fs, odaddr));
 			*bipp = bip;
@@ -489,7 +488,7 @@ parse_pseg(struct clfs *fs, daddr_t dadd
 		/*
 		 * Note each inode from the inode blocks
 		 */
-		if (inoc < lfs_ss_getninos(fs, ssp) && *iaddrp == daddr) {
+		if (inoc < lfs_ss_getninos(fs, ssp) && lfs_ii_getblock(fs, iip) == daddr) {
 			cp = fd_ptrget(fs->clfs_devvp, daddr);
 			ck = lfs_cksum_part(cp, sizeof(u_int32_t), ck);
 			for (i = 0; i < lfs_sb_getinopb(fs); i++) {
@@ -531,7 +530,7 @@ parse_pseg(struct clfs *fs, daddr_t dadd
 			}
 			inoc += i;
 			daddr += lfs_btofsb(fs, lfs_sb_getibsize(fs));
-			--iaddrp;
+			iip = NEXTLOWER_IINFO(fs, iip);
 			continue;
 		}
 



CVS commit: src/libexec/lfs_cleanerd

2013-06-08 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Sat Jun  8 21:15:30 UTC 2013

Modified Files:
src/libexec/lfs_cleanerd: Makefile.inc coalesce.c lfs_cleanerd.c

Log Message:
Missed one of the -I${NETBSDSRCDIR}/sys hacks yesterday; remove it now.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/libexec/lfs_cleanerd/Makefile.inc
cvs rdiff -u -r1.21 -r1.22 src/libexec/lfs_cleanerd/coalesce.c
cvs rdiff -u -r1.34 -r1.35 src/libexec/lfs_cleanerd/lfs_cleanerd.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/libexec/lfs_cleanerd/Makefile.inc
diff -u src/libexec/lfs_cleanerd/Makefile.inc:1.5 src/libexec/lfs_cleanerd/Makefile.inc:1.6
--- src/libexec/lfs_cleanerd/Makefile.inc:1.5	Sat Jun  8 21:13:19 2013
+++ src/libexec/lfs_cleanerd/Makefile.inc	Sat Jun  8 21:15:29 2013
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.inc,v 1.5 2013/06/08 21:13:19 dholland Exp $
+#	$NetBSD: Makefile.inc,v 1.6 2013/06/08 21:15:29 dholland Exp $
 #	@(#)Makefile	8.1 (Berkeley) 6/18/93
 
 WARNS?=3		# XXX: too many sign-compare issues
@@ -17,6 +17,3 @@ LDADD+=  -lutil
 CPPFLAGS+=-I${FSCK_LFS} -I${NETBSDSRCDIR}/sbin/mount_lfs # -DUSE_CLIENT_SERVER 
 #CPPFLAGS+=-DREPAIR_ZERO_FINFO
 #CPPFLAGS+=-DTEST_PATTERN
-
-# XXX
-CPPFLAGS+=-I${NETBSDSRCDIR}/sys

Index: src/libexec/lfs_cleanerd/coalesce.c
diff -u src/libexec/lfs_cleanerd/coalesce.c:1.21 src/libexec/lfs_cleanerd/coalesce.c:1.22
--- src/libexec/lfs_cleanerd/coalesce.c:1.21	Thu Jun  6 00:53:35 2013
+++ src/libexec/lfs_cleanerd/coalesce.c	Sat Jun  8 21:15:30 2013
@@ -1,4 +1,4 @@
-/*  $NetBSD: coalesce.c,v 1.21 2013/06/06 00:53:35 dholland Exp $  */
+/*  $NetBSD: coalesce.c,v 1.22 2013/06/08 21:15:30 dholland Exp $  */
 
 /*-
  * Copyright (c) 2002, 2005 The NetBSD Foundation, Inc.
@@ -37,7 +37,6 @@
 #include sys/wait.h
 #include sys/mman.h
 
-#include ufs/lfs/ulfs_dinode.h
 #include ufs/lfs/lfs.h
 
 #include fcntl.h

Index: src/libexec/lfs_cleanerd/lfs_cleanerd.c
diff -u src/libexec/lfs_cleanerd/lfs_cleanerd.c:1.34 src/libexec/lfs_cleanerd/lfs_cleanerd.c:1.35
--- src/libexec/lfs_cleanerd/lfs_cleanerd.c:1.34	Sat Jun  8 02:09:35 2013
+++ src/libexec/lfs_cleanerd/lfs_cleanerd.c	Sat Jun  8 21:15:30 2013
@@ -1,4 +1,4 @@
-/* $NetBSD: lfs_cleanerd.c,v 1.34 2013/06/08 02:09:35 dholland Exp $	 */
+/* $NetBSD: lfs_cleanerd.c,v 1.35 2013/06/08 21:15:30 dholland Exp $	 */
 
 /*-
  * Copyright (c) 2005 The NetBSD Foundation, Inc.
@@ -38,7 +38,6 @@
 #include sys/param.h
 #include sys/mount.h
 #include sys/stat.h
-#include ufs/lfs/ulfs_inode.h
 #include ufs/lfs/lfs.h
 
 #include assert.h



CVS commit: src/libexec/lfs_cleanerd

2013-06-05 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Thu Jun  6 00:53:35 UTC 2013

Modified Files:
src/libexec/lfs_cleanerd: cleansrv.c coalesce.c lfs_cleanerd.c

Log Message:
ufs - ulfs for lfs_cleanerd


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/libexec/lfs_cleanerd/cleansrv.c
cvs rdiff -u -r1.20 -r1.21 src/libexec/lfs_cleanerd/coalesce.c
cvs rdiff -u -r1.32 -r1.33 src/libexec/lfs_cleanerd/lfs_cleanerd.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/libexec/lfs_cleanerd/cleansrv.c
diff -u src/libexec/lfs_cleanerd/cleansrv.c:1.3 src/libexec/lfs_cleanerd/cleansrv.c:1.4
--- src/libexec/lfs_cleanerd/cleansrv.c:1.3	Mon Apr 28 20:23:04 2008
+++ src/libexec/lfs_cleanerd/cleansrv.c	Thu Jun  6 00:53:35 2013
@@ -1,4 +1,4 @@
-/* $NetBSD: cleansrv.c,v 1.3 2008/04/28 20:23:04 martin Exp $	 */
+/* $NetBSD: cleansrv.c,v 1.4 2013/06/06 00:53:35 dholland Exp $	 */
 
 /*-
  * Copyright (c) 2005 The NetBSD Foundation, Inc.
@@ -39,7 +39,7 @@
 #include sys/mount.h
 #include sys/socket.h
 #include sys/un.h
-#include ufs/ufs/inode.h
+#include ufs/lfs/ulfs_inode.h
 #include ufs/lfs/lfs.h
 
 #include bufcache.h

Index: src/libexec/lfs_cleanerd/coalesce.c
diff -u src/libexec/lfs_cleanerd/coalesce.c:1.20 src/libexec/lfs_cleanerd/coalesce.c:1.21
--- src/libexec/lfs_cleanerd/coalesce.c:1.20	Tue Jan 22 09:39:11 2013
+++ src/libexec/lfs_cleanerd/coalesce.c	Thu Jun  6 00:53:35 2013
@@ -1,4 +1,4 @@
-/*  $NetBSD: coalesce.c,v 1.20 2013/01/22 09:39:11 dholland Exp $  */
+/*  $NetBSD: coalesce.c,v 1.21 2013/06/06 00:53:35 dholland Exp $  */
 
 /*-
  * Copyright (c) 2002, 2005 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
 #include sys/wait.h
 #include sys/mman.h
 
-#include ufs/ufs/dinode.h
+#include ufs/lfs/ulfs_dinode.h
 #include ufs/lfs/lfs.h
 
 #include fcntl.h
@@ -104,13 +104,13 @@ const char *coalesce_return[] = {
 	No such error
 };
 
-static struct ufs1_dinode *
+static struct ulfs1_dinode *
 get_dinode(struct clfs *fs, ino_t ino)
 {
 	IFILE *ifp;
 	daddr_t daddr;
 	struct ubuf *bp;
-	struct ufs1_dinode *dip, *r;
+	struct ulfs1_dinode *dip, *r;
 
 	lfs_ientry(ifp, fs, ino, bp);
 	daddr = ifp-if_daddr;
@@ -120,10 +120,10 @@ get_dinode(struct clfs *fs, ino_t ino)
 		return NULL;
 
 	bread(fs-clfs_devvp, daddr, fs-lfs_ibsize, NOCRED, 0, bp);
-	for (dip = (struct ufs1_dinode *)bp-b_data;
-	 dip  (struct ufs1_dinode *)(bp-b_data + fs-lfs_ibsize); dip++)
+	for (dip = (struct ulfs1_dinode *)bp-b_data;
+	 dip  (struct ulfs1_dinode *)(bp-b_data + fs-lfs_ibsize); dip++)
 		if (dip-di_inumber == ino) {
-			r = (struct ufs1_dinode *)malloc(sizeof(*r));
+			r = (struct ulfs1_dinode *)malloc(sizeof(*r));
 			if (r == NULL)
 break;
 			memcpy(r, dip, sizeof(*r));
@@ -144,7 +144,7 @@ clean_inode(struct clfs *fs, ino_t ino)
 	BLOCK_INFO *bip = NULL, *tbip;
 	CLEANERINFO cip;
 	struct ubuf *bp;
-	struct ufs1_dinode *dip;
+	struct ulfs1_dinode *dip;
 	struct clfs_seguse *sup;
 	struct lfs_fcntl_markv /* {
 		BLOCK_INFO *blkiov;
@@ -164,7 +164,7 @@ clean_inode(struct clfs *fs, ino_t ino)
 	onb = nb = lblkno(fs, dip-di_size);
 
 	/* XXX for now, don't do any file small enough to have fragments */
-	if (nb  UFS_NDADDR) {
+	if (nb  ULFS_NDADDR) {
 		free(dip);
 		return COALESCE_TOOSMALL;
 	}

Index: src/libexec/lfs_cleanerd/lfs_cleanerd.c
diff -u src/libexec/lfs_cleanerd/lfs_cleanerd.c:1.32 src/libexec/lfs_cleanerd/lfs_cleanerd.c:1.33
--- src/libexec/lfs_cleanerd/lfs_cleanerd.c:1.32	Tue Jan 22 09:39:11 2013
+++ src/libexec/lfs_cleanerd/lfs_cleanerd.c	Thu Jun  6 00:53:35 2013
@@ -1,4 +1,4 @@
-/* $NetBSD: lfs_cleanerd.c,v 1.32 2013/01/22 09:39:11 dholland Exp $	 */
+/* $NetBSD: lfs_cleanerd.c,v 1.33 2013/06/06 00:53:35 dholland Exp $	 */
 
 /*-
  * Copyright (c) 2005 The NetBSD Foundation, Inc.
@@ -38,7 +38,7 @@
 #include sys/param.h
 #include sys/mount.h
 #include sys/stat.h
-#include ufs/ufs/inode.h
+#include ufs/lfs/ulfs_inode.h
 #include ufs/lfs/lfs.h
 
 #include assert.h
@@ -93,7 +93,7 @@ struct cleaner_stats {
 extern u_int32_t cksum(void *, size_t);
 extern u_int32_t lfs_sb_cksum(struct dlfs *);
 extern u_int32_t lfs_cksum_part(void *, size_t, u_int32_t);
-extern int ufs_getlbns(struct lfs *, struct uvnode *, daddr_t, struct indir *, int *);
+extern int ulfs_getlbns(struct lfs *, struct uvnode *, daddr_t, struct indir *, int *);
 
 /* Compat */
 void pwarn(const char *unused, ...) { /* Does nothing */ };
@@ -342,9 +342,9 @@ lfs_ientry(IFILE **ifpp, struct clfs *fs
 
 #ifdef TEST_PATTERN
 /*
- * Check UFS_ROOTINO for file data.  The assumption is that we are running
+ * Check ULFS_ROOTINO for file data.  The assumption is that we are running
  * the twofiles test with the rest of the filesystem empty.  Files
- * created by twofiles match the test pattern, but UFS_ROOTINO and the
+ * created by twofiles match the test pattern, but ULFS_ROOTINO and the
  * executable itself (assumed to be inode 3) 

CVS commit: src/libexec/lfs_cleanerd

2012-04-16 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Mon Apr 16 10:48:27 UTC 2012

Modified Files:
src/libexec/lfs_cleanerd: lfs_cleanerd.c

Log Message:
Make load_threshold double and restore original value of 0.2.
From NAKAJIMA Yoshihiro.


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/libexec/lfs_cleanerd/lfs_cleanerd.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/libexec/lfs_cleanerd/lfs_cleanerd.c
diff -u src/libexec/lfs_cleanerd/lfs_cleanerd.c:1.30 src/libexec/lfs_cleanerd/lfs_cleanerd.c:1.31
--- src/libexec/lfs_cleanerd/lfs_cleanerd.c:1.30	Thu Apr 12 11:46:16 2012
+++ src/libexec/lfs_cleanerd/lfs_cleanerd.c	Mon Apr 16 10:48:27 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: lfs_cleanerd.c,v 1.30 2012/04/12 11:46:16 joerg Exp $	 */
+/* $NetBSD: lfs_cleanerd.c,v 1.31 2012/04/16 10:48:27 joerg Exp $	 */
 
 /*-
  * Copyright (c) 2005 The NetBSD Foundation, Inc.
@@ -67,7 +67,7 @@
 /* XXX these top few should really be fs-specific */
 int use_fs_idle;	/* Use fs idle rather than cpu idle time */
 int use_bytes;		/* Use bytes written rather than segments cleaned */
-int load_threshold;	/* How idle is idle (CPU idle) */
+double load_threshold;	/* How idle is idle (CPU idle) */
 int atatime;		/* How many segments (bytes) to clean at a time */
 
 int nfss;		/* Number of filesystems monitored by this cleanerd */
@@ -1365,7 +1365,7 @@ lfs_cleaner_main(int argc, char **argv)
 	 */
 	atatime	 = 1;
 	segwait_timeout = 300; /* Five minutes */
-	load_threshold	= 0;
+	load_threshold	= 0.2;
 	stat_report	= 0;
 	inval_segment	= -1;
 	copylog_filename = NULL;



CVS commit: src/libexec/lfs_cleanerd

2012-04-12 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Thu Apr 12 10:30:17 UTC 2012

Modified Files:
src/libexec/lfs_cleanerd: fdfs.c

Log Message:
Use the same loop order for freeing as for allocation. Simpler code and
easier to process for analyzers.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/libexec/lfs_cleanerd/fdfs.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/libexec/lfs_cleanerd/fdfs.c
diff -u src/libexec/lfs_cleanerd/fdfs.c:1.8 src/libexec/lfs_cleanerd/fdfs.c:1.9
--- src/libexec/lfs_cleanerd/fdfs.c:1.8	Fri Jul  1 02:48:48 2011
+++ src/libexec/lfs_cleanerd/fdfs.c	Thu Apr 12 10:30:17 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: fdfs.c,v 1.8 2011/07/01 02:48:48 joerg Exp $	 */
+/* $NetBSD: fdfs.c,v 1.9 2012/04/12 10:30:17 joerg Exp $	 */
 
 /*-
  * Copyright (c) 2005 The NetBSD Foundation, Inc.
@@ -98,7 +98,7 @@ fd_vget(int fd, int bsize, int segsize, 
 	vp = (struct uvnode *) malloc(sizeof(*vp));
 	if (vp == NULL) {
 		if (fs-fd_bufp) {
-			for (i = nseg - 1; i = 0; i--)
+			for (i = 0; i  nseg; i++)
 free(fs-fd_bufp[i].buf);
 			free(fs-fd_bufp);
 		}



CVS commit: src/libexec/lfs_cleanerd

2012-02-01 Thread Konrad Schroder
Module Name:src
Committed By:   perseant
Date:   Thu Feb  2 03:47:11 UTC 2012

Modified Files:
src/libexec/lfs_cleanerd: lfs_cleanerd.c

Log Message:
Shut down the cleaner earlier if the filesystem is unmounted.


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/libexec/lfs_cleanerd/lfs_cleanerd.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/libexec/lfs_cleanerd/lfs_cleanerd.c
diff -u src/libexec/lfs_cleanerd/lfs_cleanerd.c:1.28 src/libexec/lfs_cleanerd/lfs_cleanerd.c:1.29
--- src/libexec/lfs_cleanerd/lfs_cleanerd.c:1.28	Mon Jan  2 21:35:18 2012
+++ src/libexec/lfs_cleanerd/lfs_cleanerd.c	Thu Feb  2 03:47:11 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: lfs_cleanerd.c,v 1.28 2012/01/02 21:35:18 perseant Exp $	 */
+/* $NetBSD: lfs_cleanerd.c,v 1.29 2012/02/02 03:47:11 perseant Exp $	 */
 
 /*-
  * Copyright (c) 2005 The NetBSD Foundation, Inc.
@@ -1158,6 +1158,12 @@ clean_fs(struct clfs *fs, CLEANERINFO *c
 fd_release_all(fs-clfs_devvp);
 return r;
 			}
+			if (oerrno == ESHUTDOWN) {
+syslog(LOG_NOTICE, %s: filesystem unmounted,
+   fs-lfs_fsmnt);
+fd_release_all(fs-clfs_devvp);
+return r;
+			}
 		}
 	}
 



CVS commit: src/libexec/lfs_cleanerd

2011-06-30 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Fri Jul  1 02:48:48 UTC 2011

Modified Files:
src/libexec/lfs_cleanerd: fdfs.c

Log Message:
Fix memset usage.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/libexec/lfs_cleanerd/fdfs.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/libexec/lfs_cleanerd/fdfs.c
diff -u src/libexec/lfs_cleanerd/fdfs.c:1.7 src/libexec/lfs_cleanerd/fdfs.c:1.8
--- src/libexec/lfs_cleanerd/fdfs.c:1.7	Thu Aug  6 00:51:55 2009
+++ src/libexec/lfs_cleanerd/fdfs.c	Fri Jul  1 02:48:48 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: fdfs.c,v 1.7 2009/08/06 00:51:55 pooka Exp $	 */
+/* $NetBSD: fdfs.c,v 1.8 2011/07/01 02:48:48 joerg Exp $	 */
 
 /*-
  * Copyright (c) 2005 The NetBSD Foundation, Inc.
@@ -143,7 +143,7 @@
 		free(fs-fd_bufp[i].buf);
 	free(fs-fd_bufp);
 	free(fs);
-	memset(vp, 0, sizeof(vp));
+	memset(vp, 0, sizeof(*vp));
 }
 
 /*



CVS commit: src/libexec/lfs_cleanerd

2010-12-23 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Thu Dec 23 18:08:41 UTC 2010

Modified Files:
src/libexec/lfs_cleanerd: lfs_cleanerd.c

Log Message:
Deduce raw device correctly by prepending r to basename.


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/libexec/lfs_cleanerd/lfs_cleanerd.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/libexec/lfs_cleanerd/lfs_cleanerd.c
diff -u src/libexec/lfs_cleanerd/lfs_cleanerd.c:1.26 src/libexec/lfs_cleanerd/lfs_cleanerd.c:1.27
--- src/libexec/lfs_cleanerd/lfs_cleanerd.c:1.26	Mon Aug 16 22:11:55 2010
+++ src/libexec/lfs_cleanerd/lfs_cleanerd.c	Thu Dec 23 18:08:41 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: lfs_cleanerd.c,v 1.26 2010/08/16 22:11:55 pooka Exp $	 */
+/* $NetBSD: lfs_cleanerd.c,v 1.27 2010/12/23 18:08:41 mlelstv Exp $	 */
 
 /*-
  * Copyright (c) 2005 The NetBSD Foundation, Inc.
@@ -205,6 +205,7 @@
 	int rootfd;
 	int i;
 	void *sbuf;
+	char *bn;
 
 	/*
 	 * Get the raw device from the block device.
@@ -218,7 +219,11 @@
 		syslog(LOG_ERR, couldn't malloc device name string: %m);
 		return -1;
 	}
-	sprintf(fs-clfs_dev, /dev/r%s, sf.f_mntfromname + 5);
+	bn = strrchr(sf.f_mntfromname, '/');
+	bn = bn ? bn+1 : sf.f_mntfromname;
+	strlcpy(fs-clfs_dev, sf.f_mntfromname, bn - sf.f_mntfromname + 1);
+	strcat(fs-clfs_dev, r);
+	strcat(fs-clfs_dev, bn);
 	if ((fs-clfs_devfd = kops.ko_open(fs-clfs_dev, O_RDONLY, 0))  0) {
 		syslog(LOG_ERR, couldn't open device %s for reading,
 			fs-clfs_dev);



CVS commit: src/libexec/lfs_cleanerd

2010-08-16 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Mon Aug 16 22:11:55 UTC 2010

Modified Files:
src/libexec/lfs_cleanerd: lfs_cleanerd.c

Log Message:
Don't exit when running as a lib after FS is unmounted, just return
from the mainloop.


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/libexec/lfs_cleanerd/lfs_cleanerd.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/libexec/lfs_cleanerd/lfs_cleanerd.c
diff -u src/libexec/lfs_cleanerd/lfs_cleanerd.c:1.25 src/libexec/lfs_cleanerd/lfs_cleanerd.c:1.26
--- src/libexec/lfs_cleanerd/lfs_cleanerd.c:1.25	Thu Jul 29 14:09:45 2010
+++ src/libexec/lfs_cleanerd/lfs_cleanerd.c	Mon Aug 16 22:11:55 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: lfs_cleanerd.c,v 1.25 2010/07/29 14:09:45 pooka Exp $	 */
+/* $NetBSD: lfs_cleanerd.c,v 1.26 2010/08/16 22:11:55 pooka Exp $	 */
 
 /*-
  * Copyright (c) 2005 The NetBSD Foundation, Inc.
@@ -1543,6 +1543,7 @@
 	if (semaddr)
 		sem_post(semaddr);
 #endif
+	error = 0;
 	while (nfss  0) {
 		int cleaned_one;
 		do {
@@ -1581,11 +1582,17 @@
 	handle_error(fsp, i);
 	assert(nfss == 0);
 }
-			} else
+			} else {
+#ifdef LFS_CLEANER_AS_LIB
+error = ESHUTDOWN;
+break;
+#else
 err(1, LFCNSEGWAITALL);
+#endif
+			}
 		}
 	}
 
 	/* NOTREACHED */
-	return 0;
+	return error;
 }



CVS commit: src/libexec/lfs_cleanerd

2010-07-29 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Thu Jul 29 14:07:39 UTC 2010

Modified Files:
src/libexec/lfs_cleanerd: lfs_cleanerd.c

Log Message:
Add a method for posting a semaphore when cleaner init has reached
the main loop.  This is useful for very quickly executed lfs runs
such as those in tests, as an initialization phase cleaner may
prevent file system unmount.


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/libexec/lfs_cleanerd/lfs_cleanerd.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/libexec/lfs_cleanerd/lfs_cleanerd.c
diff -u src/libexec/lfs_cleanerd/lfs_cleanerd.c:1.23 src/libexec/lfs_cleanerd/lfs_cleanerd.c:1.24
--- src/libexec/lfs_cleanerd/lfs_cleanerd.c:1.23	Tue Feb 16 23:13:13 2010
+++ src/libexec/lfs_cleanerd/lfs_cleanerd.c	Thu Jul 29 14:07:39 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: lfs_cleanerd.c,v 1.23 2010/02/16 23:13:13 mlelstv Exp $	 */
+/* $NetBSD: lfs_cleanerd.c,v 1.24 2010/07/29 14:07:39 pooka Exp $	 */
 
 /*-
  * Copyright (c) 2005 The NetBSD Foundation, Inc.
@@ -45,6 +45,7 @@
 #include err.h
 #include errno.h
 #include fcntl.h
+#include semaphore.h
 #include stdio.h
 #include stdlib.h
 #include string.h
@@ -1339,6 +1340,7 @@
 {
 	int i, opt, error, r, loopcount, nodetach;
 	struct timeval tv;
+	sem_t *semaddr = NULL;
 	CLEANERINFO ci;
 #ifndef USE_CLIENT_SERVER
 	char *cp, *pidname;
@@ -1358,7 +1360,7 @@
 	/*
 	 * Parse command-line arguments
 	 */
-	while ((opt = getopt(argc, argv, bC:cdDfi:l:mn:qr:st:)) != -1) {
+	while ((opt = getopt(argc, argv, bC:cdDfi:l:mn:qr:sS:t:)) != -1) {
 		switch (opt) {
 		case 'b':	/* Use bytes written, not segments read */
 			use_bytes = 1;
@@ -1399,6 +1401,13 @@
 		case 's':	/* Small writes */
 			do_small = 1;
 			break;
+		case 'S':	/* semaphore */
+#ifndef LFS_CLEANER_AS_LIB
+			usage();
+			/*NOTREACHED*/
+#endif
+			semaddr = (void*)(uintptr_t)strtoull(optarg,NULL,0);
+			break;
 		case 't':	/* timeout */
 			segwait_timeout = atoi(optarg);
 			break;
@@ -1530,6 +1539,8 @@
 	 * Main cleaning loop.
 	 */
 	loopcount = 0;
+	if (semaddr)
+		sem_post(semaddr);
 	while (nfss  0) {
 		int cleaned_one;
 		do {



CVS commit: src/libexec/lfs_cleanerd

2010-07-28 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Wed Jul 28 22:35:52 UTC 2010

Modified Files:
src/libexec/lfs_cleanerd: Makefile.inc

Log Message:
always add to SRCS


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/libexec/lfs_cleanerd/Makefile.inc

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/libexec/lfs_cleanerd/Makefile.inc
diff -u src/libexec/lfs_cleanerd/Makefile.inc:1.2 src/libexec/lfs_cleanerd/Makefile.inc:1.3
--- src/libexec/lfs_cleanerd/Makefile.inc:1.2	Fri Oct  9 20:19:44 2009
+++ src/libexec/lfs_cleanerd/Makefile.inc	Wed Jul 28 22:35:52 2010
@@ -1,12 +1,12 @@
-#	$NetBSD: Makefile.inc,v 1.2 2009/10/09 20:19:44 pooka Exp $
+#	$NetBSD: Makefile.inc,v 1.3 2010/07/28 22:35:52 pooka Exp $
 #	@(#)Makefile	8.1 (Berkeley) 6/18/93
 
 WARNS?=3		# XXX: too many sign-compare issues
 
 .include bsd.own.mk
 
-SRCS=	lfs_cleanerd.c fdfs.c coalesce.c cleansrv.c
-SRCS+=  lfs_cksum.c
+SRCS+=	lfs_cleanerd.c fdfs.c coalesce.c cleansrv.c
+SRCS+=	lfs_cksum.c
 SRCS+=	bufcache.c vnode.c lfs.c kernelops.c # segwrite.c
 .PATH:	${NETBSDSRCDIR}/sys/ufs/lfs ${NETBSDSRCDIR}/sbin/fsck_lfs	\
 	${NETBSDSRCDIR}/libexec/lfs_cleanerd



CVS commit: src/libexec/lfs_cleanerd

2010-02-16 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Tue Feb 16 23:13:13 UTC 2010

Modified Files:
src/libexec/lfs_cleanerd: lfs_cleanerd.c

Log Message:
Read the padded superblocks to avoid problems with disks that have
larger sectors than 512 Bytes.


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/libexec/lfs_cleanerd/lfs_cleanerd.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/libexec/lfs_cleanerd/lfs_cleanerd.c
diff -u src/libexec/lfs_cleanerd/lfs_cleanerd.c:1.22 src/libexec/lfs_cleanerd/lfs_cleanerd.c:1.23
--- src/libexec/lfs_cleanerd/lfs_cleanerd.c:1.22	Fri Oct  9 16:35:17 2009
+++ src/libexec/lfs_cleanerd/lfs_cleanerd.c	Tue Feb 16 23:13:13 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: lfs_cleanerd.c,v 1.22 2009/10/09 16:35:17 pooka Exp $	 */
+/* $NetBSD: lfs_cleanerd.c,v 1.23 2010/02/16 23:13:13 mlelstv Exp $	 */
 
 /*-
  * Copyright (c) 2005 The NetBSD Foundation, Inc.
@@ -203,6 +203,7 @@
 	struct statvfs sf;
 	int rootfd;
 	int i;
+	void *sbuf;
 
 	/*
 	 * Get the raw device from the block device.
@@ -233,10 +234,20 @@
 		return -4;
 	kops.ko_close(rootfd);
 
+	sbuf = malloc(LFS_SBPAD);
+	if (sbuf == NULL) {
+		syslog(LOG_ERR, couldn't malloc superblock buffer);
+		return -1;
+	}
+
 	/* Load in the superblock */
-	if (kops.ko_pread(fs-clfs_devfd, (fs-lfs_dlfs), sizeof(struct dlfs),
-		  LFS_LABELPAD)  0)
+	if (kops.ko_pread(fs-clfs_devfd, sbuf, LFS_SBPAD, LFS_LABELPAD)  0) {
+		free(sbuf);
 		return -1;
+	}
+
+	memcpy((fs-lfs_dlfs), sbuf, sizeof(struct dlfs));
+	free(sbuf);
 
 	/* If this is not a version 2 filesystem, complain and exit */
 	if (fs-lfs_version != 2) {



CVS commit: src/libexec/lfs_cleanerd

2009-08-06 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Thu Aug  6 21:18:54 UTC 2009

Modified Files:
src/libexec/lfs_cleanerd: lfs_cleanerd.8

Log Message:
Describe -D. Bump date.


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/libexec/lfs_cleanerd/lfs_cleanerd.8

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/libexec/lfs_cleanerd/lfs_cleanerd.8
diff -u src/libexec/lfs_cleanerd/lfs_cleanerd.8:1.17 src/libexec/lfs_cleanerd/lfs_cleanerd.8:1.18
--- src/libexec/lfs_cleanerd/lfs_cleanerd.8:1.17	Sat Dec 23 07:21:34 2006
+++ src/libexec/lfs_cleanerd/lfs_cleanerd.8	Thu Aug  6 21:18:54 2009
@@ -1,4 +1,4 @@
-.\	$NetBSD: lfs_cleanerd.8,v 1.17 2006/12/23 07:21:34 wiz Exp $
+.\	$NetBSD: lfs_cleanerd.8,v 1.18 2009/08/06 21:18:54 wiz Exp $
 .\
 .\ Copyright (c) 1993
 .\	The Regents of the University of California.  All rights reserved.
@@ -29,7 +29,7 @@
 .\
 .\	from: @(#)lfs_cleanerd.8	8.2 (Berkeley) 12/11/93
 .\
-.Dd November 18, 2006
+.Dd August 6, 2009
 .Dt LFS_CLEANERD 8
 .Os
 .Sh NAME
@@ -37,7 +37,7 @@
 .Nd garbage collect a log-structured file system
 .Sh SYNOPSIS
 .Nm
-.Op Fl bcdfmqs
+.Op Fl bcDdfmqs
 .Op Fl i Ar segment-number
 .Op Fl l Ar load-threshhold
 .Op Fl n Ar number-of-segments
@@ -75,6 +75,10 @@
 blocks that are not contiguous, and if it does, rewrite it.
 After a single pass through the filesystem the cleaner will exit.
 This option has been reported to corrupt file data; do not use it.
+.It Fl D
+Stay in the foreground, do not become a daemon process.
+Does not print additional debugging information (in contrast to
+.Fl d ) .
 .It Fl d
 Run in debug mode.
 Do not become a daemon process, and print debugging information.
@@ -94,7 +98,8 @@
 Clean more aggressively when the system load is below the given threshhold.
 The default threshhold is 0.2.
 .It Fl m
-Does nothing.  This option is present for historical compatibility.
+Does nothing.
+This option is present for historical compatibility.
 .It Fl n Ar number-of-segments
 Clean this number of segments at a time: that is, pass this many
 segments' blocks through a single call to lfs_markv, or, if



CVS commit: src/libexec/lfs_cleanerd

2009-08-05 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Thu Aug  6 00:05:01 UTC 2009

Modified Files:
src/libexec/lfs_cleanerd: lfs_cleanerd.c

Log Message:
Check main loop fcntl return value and error out if it fails.
Prevents e.g. from 5.0 cleaner looping forever against -current
lfs driver (fcntl data structure sizes are different).


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/libexec/lfs_cleanerd/lfs_cleanerd.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/libexec/lfs_cleanerd/lfs_cleanerd.c
diff -u src/libexec/lfs_cleanerd/lfs_cleanerd.c:1.17 src/libexec/lfs_cleanerd/lfs_cleanerd.c:1.18
--- src/libexec/lfs_cleanerd/lfs_cleanerd.c:1.17	Mon Mar 16 00:08:10 2009
+++ src/libexec/lfs_cleanerd/lfs_cleanerd.c	Thu Aug  6 00:05:01 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: lfs_cleanerd.c,v 1.17 2009/03/16 00:08:10 lukem Exp $	 */
+/* $NetBSD: lfs_cleanerd.c,v 1.18 2009/08/06 00:05:01 pooka Exp $	 */
 
 /*-
  * Copyright (c) 2005 The NetBSD Foundation, Inc.
@@ -1533,7 +1533,9 @@
 		} while(cleaned_one);
 		tv.tv_sec = segwait_timeout;
 		tv.tv_usec = 0;
-		fcntl(fsp[0]-clfs_ifilefd, LFCNSEGWAITALL, tv);
+		error = fcntl(fsp[0]-clfs_ifilefd, LFCNSEGWAITALL, tv);
+		if (error)
+			err(1, LFCNSEGWAITALL);
 	}
 
 	/* NOTREACHED */



CVS commit: src/libexec/lfs_cleanerd

2009-08-05 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Thu Aug  6 00:20:45 UTC 2009

Modified Files:
src/libexec/lfs_cleanerd: lfs_cleanerd.c

Log Message:
add -D, which prompts to stay on foreground without debug spewage


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/libexec/lfs_cleanerd/lfs_cleanerd.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/libexec/lfs_cleanerd/lfs_cleanerd.c
diff -u src/libexec/lfs_cleanerd/lfs_cleanerd.c:1.18 src/libexec/lfs_cleanerd/lfs_cleanerd.c:1.19
--- src/libexec/lfs_cleanerd/lfs_cleanerd.c:1.18	Thu Aug  6 00:05:01 2009
+++ src/libexec/lfs_cleanerd/lfs_cleanerd.c	Thu Aug  6 00:20:45 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: lfs_cleanerd.c,v 1.18 2009/08/06 00:05:01 pooka Exp $	 */
+/* $NetBSD: lfs_cleanerd.c,v 1.19 2009/08/06 00:20:45 pooka Exp $	 */
 
 /*-
  * Copyright (c) 2005 The NetBSD Foundation, Inc.
@@ -1315,7 +1315,7 @@
 int
 main(int argc, char **argv)
 {
-	int i, opt, error, r, loopcount;
+	int i, opt, error, r, loopcount, nodetach;
 	struct timeval tv;
 	CLEANERINFO ci;
 #ifndef USE_CLIENT_SERVER
@@ -1331,6 +1331,7 @@
 	stat_report	= 0;
 	inval_segment	= -1;
 	copylog_filename = NULL;
+	nodetach= 0;
 
 	/*
 	 * Parse command-line arguments
@@ -1347,8 +1348,12 @@
 			do_coalesce++;
 			break;
 		case 'd':	/* Debug mode. */
+			nodetach++;
 			debug++;
 			break;
+		case 'D':	/* stay-on-foreground */
+			nodetach++;
+			break;
 		case 'f':	/* Use fs idle time rather than cpu idle */
 			use_fs_idle = 1;
 			break;
@@ -1397,9 +1402,9 @@
 	}
 
 	/*
-	 * Set up daemon mode or verbose debug mode
+	 * Set up daemon mode or foreground mode
 	 */
-	if (debug) {
+	if (nodetach) {
 		openlog(lfs_cleanerd, LOG_NDELAY | LOG_PID | LOG_PERROR,
 			LOG_DAEMON);
 		signal(SIGINT, sig_report);



CVS commit: src/libexec/lfs_cleanerd

2009-06-21 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Jun 21 20:20:50 UTC 2009

Modified Files:
src/libexec/lfs_cleanerd: Makefile

Log Message:
PR/40965: NAKAJIMA Yoshihiro: lfs_cleanerd isn't adapted to !MKDYNAMICROOT


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/libexec/lfs_cleanerd/Makefile

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/libexec/lfs_cleanerd/Makefile
diff -u src/libexec/lfs_cleanerd/Makefile:1.13 src/libexec/lfs_cleanerd/Makefile:1.14
--- src/libexec/lfs_cleanerd/Makefile:1.13	Sun Mar 15 22:24:56 2009
+++ src/libexec/lfs_cleanerd/Makefile	Sun Jun 21 16:20:50 2009
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.13 2009/03/16 02:24:56 lukem Exp $
+#	$NetBSD: Makefile,v 1.14 2009/06/21 20:20:50 christos Exp $
 #	@(#)Makefile	8.1 (Berkeley) 6/18/93
 
 WARNS?=3		# XXX: too many sign-compare issues
@@ -21,5 +21,8 @@
 #CPPFLAGS+=-DTEST_PATTERN
 
 BINDIR=		/libexec
+.if (${MKDYNAMICROOT} == no)
+LDSTATIC?=  -static
+.endif
 
 .include bsd.prog.mk