Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/lib/libperfuse - fix warn/err confusiog
details: https://anonhg.NetBSD.org/src/rev/ec650a305ed9
branches: trunk
changeset: 768291:ec650a305ed9
user: christos <christos%NetBSD.org@localhost>
date: Sat Aug 13 23:12:15 2011 +0000
description:
- fix warn/err confusiog
- fix debugging printf
- add func arguments to simple formats
diffstat:
lib/libperfuse/Makefile | 6 +++++-
lib/libperfuse/ops.c | 10 +++++-----
lib/libperfuse/perfuse.c | 20 ++++++++++----------
lib/libperfuse/perfuse_if.h | 24 +++++++++++++-----------
lib/libperfuse/subr.c | 6 +++---
5 files changed, 36 insertions(+), 30 deletions(-)
diffs (218 lines):
diff -r a54ff527ef69 -r ec650a305ed9 lib/libperfuse/Makefile
--- a/lib/libperfuse/Makefile Sat Aug 13 22:35:27 2011 +0000
+++ b/lib/libperfuse/Makefile Sat Aug 13 23:12:15 2011 +0000
@@ -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>
diff -r a54ff527ef69 -r ec650a305ed9 lib/libperfuse/ops.c
--- a/lib/libperfuse/ops.c Sat Aug 13 22:35:27 2011 +0000
+++ b/lib/libperfuse/ops.c Sat Aug 13 23:12:15 2011 +0000
@@ -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);
diff -r a54ff527ef69 -r ec650a305ed9 lib/libperfuse/perfuse.c
--- a/lib/libperfuse/perfuse.c Sat Aug 13 22:35:27 2011 +0000
+++ b/lib/libperfuse/perfuse.c Sat Aug 13 23:12:15 2011 +0000
@@ -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;
}
diff -r a54ff527ef69 -r ec650a305ed9 lib/libperfuse/perfuse_if.h
--- a/lib/libperfuse/perfuse_if.h Sat Aug 13 22:35:27 2011 +0000
+++ b/lib/libperfuse/perfuse_if.h Sat Aug 13 23:12:15 2011 +0000
@@ -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]; \
+ \
+ if (perfuse_diagflags & PDF_SYSLOG) { \
+ char fmterr[BUFSIZ]; \
+ char strerrbuf[BUFSIZ]; \
\
- (void)strerror_r(errno, strerrbuf, sizeof(strerrbuf)); \
- (void)sprintf(fmterr, "%s: %s\n", fmt, strerrbuf); \
+ (void)strerror_r(errno, strerrbuf, sizeof(strerrbuf)); \
+ (void)sprintf(fmterr, "%s: %s\n", fmt, strerrbuf); \
+ syslog(LOG_WARNING, fmterr, ## __VA_ARGS__); \
+ } \
\
- if (perfuse_diagflags & PDF_SYSLOG) \
- syslog(LOG_WARNING, fmterr, ## __VA_ARGS__); \
- \
- warn(fmterr, ## __VA_ARGS__); \
+ warn(fmt, ## __VA_ARGS__); \
} while (0 /* CONSTCOND */)
/*
diff -r a54ff527ef69 -r ec650a305ed9 lib/libperfuse/subr.c
--- a/lib/libperfuse/subr.c Sat Aug 13 22:35:27 2011 +0000
+++ b/lib/libperfuse/subr.c Sat Aug 13 23:12:15 2011 +0000
@@ -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;
Home |
Main Index |
Thread Index |
Old Index