aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorNeilBrown <neilb@suse.de>2006-10-02 05:17:47 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2006-10-02 10:57:18 -0400
commit80212d59e32a8a8e030c2ddc5861d8ff70542c56 (patch)
treefb708f92e50ab8a1c13b68d4e6e3db8b50bd07a8 /fs
parent02a375f0ac4bc2e9b767fabb6b2f9915547226a7 (diff)
[PATCH] knfsd: define new nfsdfs file: portlist - contains list of ports
This file will list all ports that nfsd has open. Default when TCP enabled will be ipv4 udp 0.0.0.0 2049 ipv4 tcp 0.0.0.0 2049 Later, the list of ports will be settable. 'portlist' chosen rather than 'ports', to avoid unnecessary confusion with non-mainline patches which created 'ports' with different semantics. [akpm@osdl.org: cleanups, build fix] Signed-off-by: Neil Brown <neilb@suse.de> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'fs')
-rw-r--r--fs/nfsd/nfsctl.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/fs/nfsd/nfsctl.c b/fs/nfsd/nfsctl.c
index d6881774ea57..d4041a05bc19 100644
--- a/fs/nfsd/nfsctl.c
+++ b/fs/nfsd/nfsctl.c
@@ -23,10 +23,12 @@
23#include <linux/pagemap.h> 23#include <linux/pagemap.h>
24#include <linux/init.h> 24#include <linux/init.h>
25#include <linux/string.h> 25#include <linux/string.h>
26#include <linux/smp_lock.h>
26 27
27#include <linux/nfs.h> 28#include <linux/nfs.h>
28#include <linux/nfsd_idmap.h> 29#include <linux/nfsd_idmap.h>
29#include <linux/sunrpc/svc.h> 30#include <linux/sunrpc/svc.h>
31#include <linux/sunrpc/svcsock.h>
30#include <linux/nfsd/nfsd.h> 32#include <linux/nfsd/nfsd.h>
31#include <linux/nfsd/cache.h> 33#include <linux/nfsd/cache.h>
32#include <linux/nfsd/xdr.h> 34#include <linux/nfsd/xdr.h>
@@ -51,6 +53,7 @@ enum {
51 NFSD_Fh, 53 NFSD_Fh,
52 NFSD_Threads, 54 NFSD_Threads,
53 NFSD_Versions, 55 NFSD_Versions,
56 NFSD_Ports,
54 /* 57 /*
55 * The below MUST come last. Otherwise we leave a hole in nfsd_files[] 58 * The below MUST come last. Otherwise we leave a hole in nfsd_files[]
56 * with !CONFIG_NFSD_V4 and simple_fill_super() goes oops 59 * with !CONFIG_NFSD_V4 and simple_fill_super() goes oops
@@ -74,6 +77,7 @@ static ssize_t write_getfs(struct file *file, char *buf, size_t size);
74static ssize_t write_filehandle(struct file *file, char *buf, size_t size); 77static ssize_t write_filehandle(struct file *file, char *buf, size_t size);
75static ssize_t write_threads(struct file *file, char *buf, size_t size); 78static ssize_t write_threads(struct file *file, char *buf, size_t size);
76static ssize_t write_versions(struct file *file, char *buf, size_t size); 79static ssize_t write_versions(struct file *file, char *buf, size_t size);
80static ssize_t write_ports(struct file *file, char *buf, size_t size);
77#ifdef CONFIG_NFSD_V4 81#ifdef CONFIG_NFSD_V4
78static ssize_t write_leasetime(struct file *file, char *buf, size_t size); 82static ssize_t write_leasetime(struct file *file, char *buf, size_t size);
79static ssize_t write_recoverydir(struct file *file, char *buf, size_t size); 83static ssize_t write_recoverydir(struct file *file, char *buf, size_t size);
@@ -90,6 +94,7 @@ static ssize_t (*write_op[])(struct file *, char *, size_t) = {
90 [NFSD_Fh] = write_filehandle, 94 [NFSD_Fh] = write_filehandle,
91 [NFSD_Threads] = write_threads, 95 [NFSD_Threads] = write_threads,
92 [NFSD_Versions] = write_versions, 96 [NFSD_Versions] = write_versions,
97 [NFSD_Ports] = write_ports,
93#ifdef CONFIG_NFSD_V4 98#ifdef CONFIG_NFSD_V4
94 [NFSD_Leasetime] = write_leasetime, 99 [NFSD_Leasetime] = write_leasetime,
95 [NFSD_RecoveryDir] = write_recoverydir, 100 [NFSD_RecoveryDir] = write_recoverydir,
@@ -419,6 +424,20 @@ static ssize_t write_versions(struct file *file, char *buf, size_t size)
419 return len; 424 return len;
420} 425}
421 426
427static ssize_t write_ports(struct file *file, char *buf, size_t size)
428{
429 /* for now, ignore what was written and just
430 * return known ports
431 * AF proto address port
432 */
433 int len = 0;
434 lock_kernel();
435 if (nfsd_serv)
436 len = svc_sock_names(buf, nfsd_serv);
437 unlock_kernel();
438 return len;
439}
440
422#ifdef CONFIG_NFSD_V4 441#ifdef CONFIG_NFSD_V4
423extern time_t nfs4_leasetime(void); 442extern time_t nfs4_leasetime(void);
424 443
@@ -482,6 +501,7 @@ static int nfsd_fill_super(struct super_block * sb, void * data, int silent)
482 [NFSD_Fh] = {"filehandle", &transaction_ops, S_IWUSR|S_IRUSR}, 501 [NFSD_Fh] = {"filehandle", &transaction_ops, S_IWUSR|S_IRUSR},
483 [NFSD_Threads] = {"threads", &transaction_ops, S_IWUSR|S_IRUSR}, 502 [NFSD_Threads] = {"threads", &transaction_ops, S_IWUSR|S_IRUSR},
484 [NFSD_Versions] = {"versions", &transaction_ops, S_IWUSR|S_IRUSR}, 503 [NFSD_Versions] = {"versions", &transaction_ops, S_IWUSR|S_IRUSR},
504 [NFSD_Ports] = {"portlist", &transaction_ops, S_IWUSR|S_IRUGO},
485#ifdef CONFIG_NFSD_V4 505#ifdef CONFIG_NFSD_V4
486 [NFSD_Leasetime] = {"nfsv4leasetime", &transaction_ops, S_IWUSR|S_IRUSR}, 506 [NFSD_Leasetime] = {"nfsv4leasetime", &transaction_ops, S_IWUSR|S_IRUSR},
487 [NFSD_RecoveryDir] = {"nfsv4recoverydir", &transaction_ops, S_IWUSR|S_IRUSR}, 507 [NFSD_RecoveryDir] = {"nfsv4recoverydir", &transaction_ops, S_IWUSR|S_IRUSR},