Module Name:    src
Committed By:   christos
Date:           Sat Aug 13 23:12:15 UTC 2011

Modified Files:
        src/lib/libperfuse: Makefile ops.c perfuse.c perfuse_if.h subr.c

Log Message:
- fix warn/err confusiog
- fix debugging printf
- add func arguments to simple formats


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/lib/libperfuse/Makefile
cvs rdiff -u -r1.38 -r1.39 src/lib/libperfuse/ops.c
cvs rdiff -u -r1.17 -r1.18 src/lib/libperfuse/perfuse.c
cvs rdiff -u -r1.13 -r1.14 src/lib/libperfuse/perfuse_if.h
cvs rdiff -u -r1.12 -r1.13 src/lib/libperfuse/subr.c

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

Modified files:

Index: src/lib/libperfuse/Makefile
diff -u src/lib/libperfuse/Makefile:1.6 src/lib/libperfuse/Makefile:1.7
--- src/lib/libperfuse/Makefile:1.6	Tue Jun 28 16:28:48 2011
+++ src/lib/libperfuse/Makefile	Sat Aug 13 19:12:15 2011
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.6 2011/06/28 20:28:48 riz Exp $
+# $NetBSD: Makefile,v 1.7 2011/08/13 23:12:15 christos Exp $
 
 LIB=            perfuse
 LIBDPLIBS+=     puffs	${.CURDIR}/../libpuffs
@@ -16,4 +16,8 @@
 INCS=           perfuse.h
 INCSDIR=	/usr/include
 
+COPTS.ops.c = -Wno-format-nonliteral
+COPTS.perfuse.c = -Wno-format-nonliteral
+COPTS.subr.c = -Wno-format-nonliteral
+
 .include <bsd.lib.mk>

Index: src/lib/libperfuse/ops.c
diff -u src/lib/libperfuse/ops.c:1.38 src/lib/libperfuse/ops.c:1.39
--- src/lib/libperfuse/ops.c:1.38	Tue Aug  9 05:06:52 2011
+++ src/lib/libperfuse/ops.c	Sat Aug 13 19:12:15 2011
@@ -1,4 +1,4 @@
-/*  $NetBSD: ops.c,v 1.38 2011/08/09 09:06:52 manu Exp $ */
+/*  $NetBSD: ops.c,v 1.39 2011/08/13 23:12:15 christos Exp $ */
 
 /*-
  *  Copyright (c) 2010-2011 Emmanuel Dreyfus. All rights reserved.
@@ -343,7 +343,7 @@
 
 	namelen = PNPLEN(dpn) + 1 + namelen + 1;
 	if ((path = malloc(namelen)) == NULL)
-		DERR(EX_OSERR, "malloc failed");
+		DERR(EX_OSERR, "%s: malloc failed", __func__);
 	(void)snprintf(path, namelen, "%s/%s", 
 		       perfuse_node_path((puffs_cookie_t)dpn), name);
 
@@ -609,7 +609,7 @@
 	
 			dents = PERFUSE_NODE_DATA(opc)->pnd_dirent;
 			if ((dents = realloc(dents, dents_len)) == NULL)
-				DERR(EX_OSERR, "malloc failed");
+				DERR(EX_OSERR, "%s: malloc failed", __func__);
 
 			PERFUSE_NODE_DATA(opc)->pnd_dirent = dents;
 			PERFUSE_NODE_DATA(opc)->pnd_dirent_len = dents_len;
@@ -831,7 +831,7 @@
 	ps = puffs_getspecific(pu);
 	
         if (puffs_mount(pu, ps->ps_target, ps->ps_mountflags, ps->ps_root) != 0)
-                DERR(EX_OSERR, "puffs_mount failed");
+                DERR(EX_OSERR, "%s: puffs_mount failed", __func__);
 
 	/*
 	 * Linux 2.6.34.1 sends theses flags:
@@ -2388,7 +2388,7 @@
 		pnd->pnd_all_fd = realloc(pnd->pnd_all_fd, 
 					  pnd->pnd_all_fd_len + fd_len);
 		if (pnd->pnd_all_fd  == NULL)
-			DERR(EX_OSERR, "malloc failed");
+			DERR(EX_OSERR, "%s: malloc failed", __func__);
 
 		afdp = (char *)(void *)pnd->pnd_all_fd + pnd->pnd_all_fd_len;
 		(void)memcpy(afdp, fd, fd_len);

Index: src/lib/libperfuse/perfuse.c
diff -u src/lib/libperfuse/perfuse.c:1.17 src/lib/libperfuse/perfuse.c:1.18
--- src/lib/libperfuse/perfuse.c:1.17	Tue Aug  9 02:58:33 2011
+++ src/lib/libperfuse/perfuse.c	Sat Aug 13 19:12:15 2011
@@ -1,4 +1,4 @@
-/*  $NetBSD: perfuse.c,v 1.17 2011/08/09 06:58:33 manu Exp $ */
+/*  $NetBSD: perfuse.c,v 1.18 2011/08/13 23:12:15 christos Exp $ */
 
 /*-
  *  Copyright (c) 2010-2011 Emmanuel Dreyfus. All rights reserved.
@@ -57,7 +57,7 @@
 	char opts[1024];
 
 	if ((ps = malloc(sizeof(*ps))) == NULL)
-		DERR(EX_OSERR, "malloc failed");
+		DERR(EX_OSERR, "%s: malloc failed", __func__);
 
 	(void)memset(ps, 0, sizeof(*ps));
 	ps->ps_max_write = UINT_MAX;
@@ -164,7 +164,7 @@
 
 		if ((sv[0] = socket(PF_LOCAL, SOCK_DGRAM, 0)) == -1) {
 #ifdef PERFUSE_DEBUG
-			DWARN("%s:%d socket failed: %s", __func__, __LINE__);
+			DWARN("%s: %d socket failed", __func__, __LINE__);
 #endif
 			return -1;
 		}
@@ -412,7 +412,7 @@
 
 	if (pmi->pmi_source) {
 		if ((ps->ps_source = strdup(pmi->pmi_source)) == NULL)
-			DERR(EX_OSERR, "strdup failed");
+			DERR(EX_OSERR, "%s: strdup failed", __func__);
 
 		source = ps->ps_source;
 	}
@@ -422,20 +422,20 @@
 
 		ps->ps_filesystemtype = strdup(pmi->pmi_filesystemtype);
 		if (ps->ps_filesystemtype == NULL)
-			DERR(EX_OSERR, "strdup failed");
+			DERR(EX_OSERR, "%s: strdup failed", __func__);
 
 		len = sizeof("perfuse|") + strlen(ps->ps_filesystemtype) + 1;
 		if ((fstype = malloc(len)) == NULL)
-			DERR(EX_OSERR, "malloc failed");
+			DERR(EX_OSERR, "%s: malloc failed", __func__);
 
 		(void)sprintf(fstype, "perfuse|%s", ps->ps_filesystemtype);
 	} else {
 		if ((fstype = strdup("perfuse")) == NULL)
-			DERR(EX_OSERR, "strdup failed");
+			DERR(EX_OSERR, "%s: strdup failed", __func__);
 	}
 
 	if ((ps->ps_target = strdup(pmi->pmi_target)) == NULL)
-		DERR(EX_OSERR, "strdup failed");
+		DERR(EX_OSERR, "%s: strdup failed", __func__);
 
 	ps->ps_mountflags = pmi->pmi_mountflags;
 
@@ -508,7 +508,7 @@
 		puffs_flags |= PUFFS_FLAG_OPDUMP;
 
 	if ((pu = puffs_init(pops, source, fstype, ps, puffs_flags)) == NULL)
-		DERR(EX_OSERR, "puffs_init failed");
+		DERR(EX_OSERR, "%s: puffs_init failed", __func__);
 
 	ps->ps_pu = pu;
 
@@ -594,7 +594,7 @@
 
 	ps->ps_flags |= PS_INLOOP;
 	if (puffs_mainloop(ps->ps_pu) != 0) {
-		DERR(EX_OSERR, "puffs_mainloop failed");
+		DERR(EX_OSERR, "%s: failed", __func__);
 		return -1;
 	}
 

Index: src/lib/libperfuse/perfuse_if.h
diff -u src/lib/libperfuse/perfuse_if.h:1.13 src/lib/libperfuse/perfuse_if.h:1.14
--- src/lib/libperfuse/perfuse_if.h:1.13	Mon May 30 10:50:08 2011
+++ src/lib/libperfuse/perfuse_if.h	Sat Aug 13 19:12:15 2011
@@ -1,4 +1,4 @@
-/*  $NetBSD: perfuse_if.h,v 1.13 2011/05/30 14:50:08 manu Exp $ */
+/*  $NetBSD: perfuse_if.h,v 1.14 2011/08/13 23:12:15 christos Exp $ */
 
 /*-
  *  Copyright (c) 2010-2011 Emmanuel Dreyfus. All rights reserved.
@@ -81,7 +81,8 @@
 	char strerrbuf[BUFSIZ];						\
 									\
 	(void)strerror_r(errno, strerrbuf, sizeof(strerrbuf));		\
-	(void)sprintf(fmterr, "%s: %s\n", fmt, strerrbuf);		\
+	(void)snprintf(fmterr, sizeof(fmterr), "%s: %s\n", fmt, 	\
+	    strerrbuf);							\
 									\
 	if (perfuse_diagflags & PDF_SYSLOG)				\
 		syslog(LOG_ERR, fmterr, ## __VA_ARGS__);		\
@@ -90,7 +91,7 @@
 		(void)fprintf(stderr,  fmterr, ## __VA_ARGS__);		\
 		abort();						\
 	} else {							\
-		errx(status, fmt, ## __VA_ARGS__);			\
+		err(status, fmt, ## __VA_ARGS__);			\
 	}								\
 } while (0 /* CONSTCOND */)
 
@@ -102,16 +103,17 @@
 } while (0 /* CONSTCOND */)
 
 #define DWARN(fmt, ...) do {						\
-	char fmterr[BUFSIZ];						\
-	char strerrbuf[BUFSIZ];						\
 									\
-	(void)strerror_r(errno, strerrbuf, sizeof(strerrbuf));		\
-	(void)sprintf(fmterr, "%s: %s\n", fmt, strerrbuf);		\
+	if (perfuse_diagflags & PDF_SYSLOG) {				\
+		char fmterr[BUFSIZ];					\
+		char strerrbuf[BUFSIZ];					\
 									\
-	if (perfuse_diagflags & PDF_SYSLOG)				\
+		(void)strerror_r(errno, strerrbuf, sizeof(strerrbuf));	\
+		(void)sprintf(fmterr, "%s: %s\n", fmt, strerrbuf);	\
 		syslog(LOG_WARNING, fmterr, ## __VA_ARGS__);		\
+	}								\
 									\
-	warn(fmterr, ## __VA_ARGS__);					\
+	warn(fmt, ## __VA_ARGS__);					\
 } while (0 /* CONSTCOND */)
 
 /*

Index: src/lib/libperfuse/subr.c
diff -u src/lib/libperfuse/subr.c:1.12 src/lib/libperfuse/subr.c:1.13
--- src/lib/libperfuse/subr.c:1.12	Tue Jun 28 12:19:16 2011
+++ src/lib/libperfuse/subr.c	Sat Aug 13 19:12:15 2011
@@ -1,4 +1,4 @@
-/*  $NetBSD: subr.c,v 1.12 2011/06/28 16:19:16 manu Exp $ */
+/*  $NetBSD: subr.c,v 1.13 2011/08/13 23:12:15 christos Exp $ */
 
 /*-
  *  Copyright (c) 2010-2011 Emmanuel Dreyfus. All rights reserved.
@@ -58,10 +58,10 @@
 	struct perfuse_node_data *pnd;
 
 	if ((pnd = malloc(sizeof(*pnd))) == NULL)
-		DERR(EX_OSERR, "malloc failed");
+		DERR(EX_OSERR, "%s: malloc failed", __func__);
 
 	if ((pn = puffs_pn_new(pu, pnd)) == NULL)
-		DERR(EX_SOFTWARE, "puffs_pn_new failed");
+		DERR(EX_SOFTWARE, "%s: puffs_pn_new failed", __func__);
 
 	(void)memset(pnd, 0, sizeof(*pnd));
 	pnd->pnd_rfh = FUSE_UNKNOWN_FH;

Reply via email to