Merge tag '5.13-rc3-smb3' of git://git.samba.org/sfrench/cifs-2.6
[linux-2.6-microblaze.git] / fs / cifs / cifs_debug.c
index 3aedc48..68e8e5b 100644 (file)
 #include "cifsproto.h"
 #include "cifs_debug.h"
 #include "cifsfs.h"
+#include "fs_context.h"
 #ifdef CONFIG_CIFS_DFS_UPCALL
 #include "dfs_cache.h"
 #endif
 #ifdef CONFIG_CIFS_SMB_DIRECT
 #include "smbdirect.h"
 #endif
-#ifdef CONFIG_CIFS_SWN_UPCALL
 #include "cifs_swn.h"
-#endif
 
 void
 cifs_dump_mem(char *label, void *data, int length)
@@ -118,10 +117,8 @@ static void cifs_debug_tcon(struct seq_file *m, struct cifs_tcon *tcon)
                seq_printf(m, " POSIX Extensions");
        if (tcon->ses->server->ops->dump_share_caps)
                tcon->ses->server->ops->dump_share_caps(m, tcon);
-#ifdef CONFIG_CIFS_SWN_UPCALL
        if (tcon->use_witness)
                seq_puts(m, " Witness");
-#endif
 
        if (tcon->need_reconnect)
                seq_puts(m, "\tDISCONNECTED ");
@@ -207,7 +204,7 @@ static int cifs_debug_files_proc_show(struct seq_file *m, void *v)
                                                from_kuid(&init_user_ns, cfile->uid),
                                                cfile->dentry);
 #ifdef CONFIG_CIFS_DEBUG2
-                                       seq_printf(m, " 0x%llx\n", cfile->fid.mid);
+                                       seq_printf(m, " %llu\n", cfile->fid.mid);
 #else
                                        seq_printf(m, "\n");
 #endif /* CIFS_DEBUG2 */
@@ -490,10 +487,8 @@ skip_rdma:
 
        spin_unlock(&cifs_tcp_ses_lock);
        seq_putc(m, '\n');
-
-#ifdef CONFIG_CIFS_SWN_UPCALL
        cifs_swn_dump(m);
-#endif
+
        /* BB add code to dump additional info such as TCP session info now */
        return 0;
 }
@@ -702,6 +697,7 @@ static const struct proc_ops cifs_lookup_cache_proc_ops;
 static const struct proc_ops traceSMB_proc_ops;
 static const struct proc_ops cifs_security_flags_proc_ops;
 static const struct proc_ops cifs_linux_ext_proc_ops;
+static const struct proc_ops cifs_mount_params_proc_ops;
 
 void
 cifs_proc_init(void)
@@ -726,6 +722,8 @@ cifs_proc_init(void)
        proc_create("LookupCacheEnabled", 0644, proc_fs_cifs,
                    &cifs_lookup_cache_proc_ops);
 
+       proc_create("mount_params", 0444, proc_fs_cifs, &cifs_mount_params_proc_ops);
+
 #ifdef CONFIG_CIFS_DFS_UPCALL
        proc_create("dfscache", 0644, proc_fs_cifs, &dfscache_proc_ops);
 #endif
@@ -764,6 +762,7 @@ cifs_proc_clean(void)
        remove_proc_entry("SecurityFlags", proc_fs_cifs);
        remove_proc_entry("LinuxExtensionsEnabled", proc_fs_cifs);
        remove_proc_entry("LookupCacheEnabled", proc_fs_cifs);
+       remove_proc_entry("mount_params", proc_fs_cifs);
 
 #ifdef CONFIG_CIFS_DFS_UPCALL
        remove_proc_entry("dfscache", proc_fs_cifs);
@@ -1023,6 +1022,51 @@ static const struct proc_ops cifs_security_flags_proc_ops = {
        .proc_release   = single_release,
        .proc_write     = cifs_security_flags_proc_write,
 };
+
+/* To make it easier to debug, can help to show mount params */
+static int cifs_mount_params_proc_show(struct seq_file *m, void *v)
+{
+       const struct fs_parameter_spec *p;
+       const char *type;
+
+       for (p = smb3_fs_parameters; p->name; p++) {
+               /* cannot use switch with pointers... */
+               if (!p->type) {
+                       if (p->flags == fs_param_neg_with_no)
+                               type = "noflag";
+                       else
+                               type = "flag";
+               } else if (p->type == fs_param_is_bool)
+                       type = "bool";
+               else if (p->type == fs_param_is_u32)
+                       type = "u32";
+               else if (p->type == fs_param_is_u64)
+                       type = "u64";
+               else if (p->type == fs_param_is_string)
+                       type = "string";
+               else
+                       type = "unknown";
+
+               seq_printf(m, "%s:%s\n", p->name, type);
+       }
+
+       return 0;
+}
+
+static int cifs_mount_params_proc_open(struct inode *inode, struct file *file)
+{
+       return single_open(file, cifs_mount_params_proc_show, NULL);
+}
+
+static const struct proc_ops cifs_mount_params_proc_ops = {
+       .proc_open      = cifs_mount_params_proc_open,
+       .proc_read      = seq_read,
+       .proc_lseek     = seq_lseek,
+       .proc_release   = single_release,
+       /* No need for write for now */
+       /* .proc_write  = cifs_mount_params_proc_write, */
+};
+
 #else
 inline void cifs_proc_init(void)
 {