All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC][PATCH 1/2] cifs: show enabled features in /proc
@ 2010-07-30  9:59 Suresh Jayaraman
       [not found] ` <4C52A287.7020904-l3A5Bk7waGM@public.gmane.org>
  0 siblings, 1 reply; 3+ messages in thread
From: Suresh Jayaraman @ 2010-07-30  9:59 UTC (permalink / raw)
  To: Steve French (smfltc); +Cc: Jeff Layton, linux-cifs-u79uwXL29TY76Z2rM5mHXA

Based on the previous discussions and suggestion by Jeff on providing a way
to tell about compiled kernel config options, I wrote a simple patch. It seems
useful. But, feel free to ignore this patch if you think it is not..

From: Suresh Jayaraman <sjayaraman-l3A5Bk7waGM@public.gmane.org>
Subject: [RFC][PATCH 1/2] cifs: show enabled features in /proc

Here's a simple patch to show the compiled in CIFS features. This patch adds a
/proc file called "features" when read will show the features enabled in the
running kernel as shown below:

	$cat /proc/fs/cifs/features
	# CIFS features enabled
	dfs spnego fsc

This provides a definitive way to tell what features are currently enabled.
This could be useful as a debugging information as well.

Signed-off-by: Suresh Jayaraman <sjayaraman-l3A5Bk7waGM@public.gmane.org>
Cc: Jeff Layton <jlayton-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
---
 fs/cifs/cifs_debug.c |   36 ++++++++++++++++++++++++++++++++++++
 1 files changed, 36 insertions(+), 0 deletions(-)

diff --git a/fs/cifs/cifs_debug.c b/fs/cifs/cifs_debug.c
index 4fce6e6..af5dbf7 100644
--- a/fs/cifs/cifs_debug.c
+++ b/fs/cifs/cifs_debug.c
@@ -402,6 +402,7 @@ static const struct file_operations cifs_multiuser_mount_proc_fops;
 static const struct file_operations cifs_security_flags_proc_fops;
 static const struct file_operations cifs_experimental_proc_fops;
 static const struct file_operations cifs_linux_ext_proc_fops;
+static const struct file_operations cifs_feat_proc_fops;
 
 void
 cifs_proc_init(void)
@@ -428,6 +429,8 @@ cifs_proc_init(void)
 		    &cifs_security_flags_proc_fops);
 	proc_create("LookupCacheEnabled", 0, proc_fs_cifs,
 		    &cifs_lookup_cache_proc_fops);
+	proc_create("features", 0, proc_fs_cifs,
+		    &cifs_feat_proc_fops);
 }
 
 void
@@ -448,6 +451,7 @@ cifs_proc_clean(void)
 	remove_proc_entry("LinuxExtensionsEnabled", proc_fs_cifs);
 	remove_proc_entry("Experimental", proc_fs_cifs);
 	remove_proc_entry("LookupCacheEnabled", proc_fs_cifs);
+	remove_proc_entry("features", proc_fs_cifs);
 	remove_proc_entry("fs/cifs", NULL);
 }
 
@@ -791,6 +795,38 @@ static const struct file_operations cifs_security_flags_proc_fops = {
 	.release	= single_release,
 	.write		= cifs_security_flags_proc_write,
 };
+
+static int cifs_feat_proc_show(struct seq_file *m, void *v)
+{
+	seq_printf(m, "# CIFS features enabled\n");
+#ifdef CONFIG_CIFS_DFS_UPCALL
+	seq_printf(m, "dfs");
+	seq_putc(m, ' ');
+#endif
+#ifdef CONFIG_CIFS_UPCALL
+	seq_printf(m, "spnego");
+	seq_putc(m, ' ');
+#endif
+#ifdef CONFIG_CIFS_FSCACHE
+	seq_printf(m, "fsc");
+	seq_putc(m, ' ');
+#endif
+	seq_putc(m, '\n');
+	return 0;
+}
+
+static int cifs_feat_proc_open(struct inode *inode, struct file *file)
+{
+	return single_open(file, cifs_feat_proc_show, NULL);
+}
+
+static const struct file_operations cifs_feat_proc_fops = {
+	.owner		= THIS_MODULE,
+	.open		= cifs_feat_proc_open,
+	.read		= seq_read,
+	.llseek		= seq_lseek,
+	.release	= single_release,
+};
 #else
 inline void cifs_proc_init(void)
 {

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2010-07-30 11:29 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-07-30  9:59 [RFC][PATCH 1/2] cifs: show enabled features in /proc Suresh Jayaraman
     [not found] ` <4C52A287.7020904-l3A5Bk7waGM@public.gmane.org>
2010-07-30 11:09   ` Jeff Layton
     [not found]     ` <20100730070933.12ddc467-4QP7MXygkU+dMjc06nkz3ljfA9RmPOcC@public.gmane.org>
2010-07-30 11:29       ` Suresh Jayaraman

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.