summaryrefslogtreecommitdiffstats
path: root/sys/fs/nfs
diff options
context:
space:
mode:
authorrmacklem <rmacklem@FreeBSD.org>2012-09-09 21:00:45 +0000
committerrmacklem <rmacklem@FreeBSD.org>2012-09-09 21:00:45 +0000
commitcbc3fb8c5b3ee1fac8d2fe39949d961464a6c7f8 (patch)
treee6a7b1760610b8a8eb6594dfdda1e882052d6c2d /sys/fs/nfs
parent15f63ad1a95fe8317cd49a3f2d3cafb5735284eb (diff)
downloadFreeBSD-src-cbc3fb8c5b3ee1fac8d2fe39949d961464a6c7f8.zip
FreeBSD-src-cbc3fb8c5b3ee1fac8d2fe39949d961464a6c7f8.tar.gz
Add a simple printf() based debug facility to the new nfs client.
Use it for a printf() that can be harmlessly generated for mmap()'d files. It will be used extensively for the NFSv4.1 client. Debugging printf()s are enabled by setting vfs.nfs.debuglevel to a non-zero value. The higher the value, the more debugging printf()s. Reviewed by: jhb MFC after: 2 weeks
Diffstat (limited to 'sys/fs/nfs')
-rw-r--r--sys/fs/nfs/nfs_commonport.c3
-rw-r--r--sys/fs/nfs/nfscl.h6
2 files changed, 9 insertions, 0 deletions
diff --git a/sys/fs/nfs/nfs_commonport.c b/sys/fs/nfs/nfs_commonport.c
index 46f3620..acc387d 100644
--- a/sys/fs/nfs/nfs_commonport.c
+++ b/sys/fs/nfs/nfs_commonport.c
@@ -60,6 +60,7 @@ struct mount nfsv4root_mnt;
int newnfs_numnfsd = 0;
struct nfsstats newnfsstats;
int nfs_numnfscbd = 0;
+int nfscl_debuglevel = 0;
char nfsv4_callbackaddr[INET6_ADDRSTRLEN];
struct callout newnfsd_callout;
void (*nfsd_call_servertimer)(void) = NULL;
@@ -76,6 +77,8 @@ SYSCTL_INT(_vfs_nfs, OID_AUTO, realign_count, CTLFLAG_RW, &nfs_realign_count,
SYSCTL_STRING(_vfs_nfs, OID_AUTO, callback_addr, CTLFLAG_RW,
nfsv4_callbackaddr, sizeof(nfsv4_callbackaddr),
"NFSv4 callback addr for server to use");
+SYSCTL_INT(_vfs_nfs, OID_AUTO, debuglevel, CTLFLAG_RW, &nfscl_debuglevel,
+ 0, "Debug level for new nfs client");
/*
* Defines for malloc
diff --git a/sys/fs/nfs/nfscl.h b/sys/fs/nfs/nfscl.h
index 1c459ad..1ff4d8b 100644
--- a/sys/fs/nfs/nfscl.h
+++ b/sys/fs/nfs/nfscl.h
@@ -68,4 +68,10 @@ struct nfsv4node {
#define NFSSATTR_SIZENEG1 0x4
#define NFSSATTR_SIZERDEV 0x8
+/* Use this macro for debug printfs. */
+#define NFSCL_DEBUG(level, ...) do { \
+ if (nfscl_debuglevel >= (level)) \
+ printf(__VA_ARGS__); \
+ } while (0)
+
#endif /* _NFS_NFSCL_H */
OpenPOWER on IntegriCloud