kconfig: remove leading whitespace in menu prompts
[powerpc.git] / fs / cifs / cifs_debug.c
index b7fb064..f4124a3 100644 (file)
@@ -203,6 +203,53 @@ cifs_debug_data_read(char *buf, char **beginBuffer, off_t offset,
 }
 
 #ifdef CONFIG_CIFS_STATS
+
+static int
+cifs_stats_write(struct file *file, const char __user *buffer,
+               unsigned long count, void *data)
+{
+        char c;
+        int rc;
+       struct list_head *tmp;
+       struct cifsTconInfo *tcon;
+
+        rc = get_user(c, buffer);
+        if (rc)
+                return rc;
+
+        if (c == '1' || c == 'y' || c == 'Y' || c == '0') {
+               read_lock(&GlobalSMBSeslock);
+#ifdef CONFIG_CIFS_STATS2
+               atomic_set(&totBufAllocCount, 0);
+               atomic_set(&totSmBufAllocCount, 0);
+#endif /* CONFIG_CIFS_STATS2 */
+               list_for_each(tmp, &GlobalTreeConnectionList) {
+                       tcon = list_entry(tmp, struct cifsTconInfo,
+                                       cifsConnectionList);
+                       atomic_set(&tcon->num_smbs_sent, 0);
+                       atomic_set(&tcon->num_writes, 0);
+                       atomic_set(&tcon->num_reads, 0);
+                       atomic_set(&tcon->num_oplock_brks, 0);
+                       atomic_set(&tcon->num_opens, 0);
+                       atomic_set(&tcon->num_closes, 0);
+                       atomic_set(&tcon->num_deletes, 0);
+                       atomic_set(&tcon->num_mkdirs, 0);
+                       atomic_set(&tcon->num_rmdirs, 0);
+                       atomic_set(&tcon->num_renames, 0);
+                       atomic_set(&tcon->num_t2renames, 0);
+                       atomic_set(&tcon->num_ffirst, 0);
+                       atomic_set(&tcon->num_fnext, 0);
+                       atomic_set(&tcon->num_fclose, 0);
+                       atomic_set(&tcon->num_hardlinks, 0);
+                       atomic_set(&tcon->num_symlinks, 0);
+                       atomic_set(&tcon->num_locks, 0);
+               }
+               read_unlock(&GlobalSMBSeslock);
+       }
+
+        return count;
+}
+
 static int
 cifs_stats_read(char *buf, char **beginBuffer, off_t offset,
                  int count, int *eof, void *data)
@@ -233,6 +280,14 @@ cifs_stats_read(char *buf, char **beginBuffer, off_t offset,
                        smBufAllocCount.counter,cifs_min_small);
        length += item_length;
        buf += item_length;
+#ifdef CONFIG_CIFS_STATS2
+        item_length = sprintf(buf, "Total Large %d Small %d Allocations\n",
+                               atomic_read(&totBufAllocCount),
+                               atomic_read(&totSmBufAllocCount));
+       length += item_length;
+       buf += item_length;
+#endif /* CONFIG_CIFS_STATS2 */
+
        item_length = 
                sprintf(buf,"Operations (MIDs): %d\n",
                        midCount.counter);
@@ -267,7 +322,7 @@ cifs_stats_read(char *buf, char **beginBuffer, off_t offset,
                        atomic_read(&tcon->num_oplock_brks));
                buf += item_length;
                length += item_length;
-               item_length = sprintf(buf, "\nReads:  %d Bytes %lld",
+               item_length = sprintf(buf, "\nReads:  %d Bytes: %lld",
                        atomic_read(&tcon->num_reads),
                        (long long)(tcon->bytes_read));
                buf += item_length;
@@ -346,8 +401,8 @@ static read_proc_t ntlmv2_enabled_read;
 static write_proc_t ntlmv2_enabled_write;
 static read_proc_t packet_signing_enabled_read;
 static write_proc_t packet_signing_enabled_write;
-static read_proc_t quotaEnabled_read;
-static write_proc_t quotaEnabled_write;
+static read_proc_t experimEnabled_read;
+static write_proc_t experimEnabled_write;
 static read_proc_t linuxExtensionsEnabled_read;
 static write_proc_t linuxExtensionsEnabled_write;
 
@@ -365,8 +420,10 @@ cifs_proc_init(void)
                                cifs_debug_data_read, NULL);
 
 #ifdef CONFIG_CIFS_STATS
-       create_proc_read_entry("Stats", 0, proc_fs_cifs,
+       pde = create_proc_read_entry("Stats", 0, proc_fs_cifs,
                                cifs_stats_read, NULL);
+       if (pde)
+               pde->write_proc = cifs_stats_write;
 #endif
        pde = create_proc_read_entry("cifsFYI", 0, proc_fs_cifs,
                                cifsFYI_read, NULL);
@@ -385,9 +442,9 @@ cifs_proc_init(void)
                pde->write_proc = oplockEnabled_write;
 
        pde = create_proc_read_entry("Experimental", 0, proc_fs_cifs,
-                               quotaEnabled_read, NULL);
+                               experimEnabled_read, NULL);
        if (pde)
-               pde->write_proc = quotaEnabled_write;
+               pde->write_proc = experimEnabled_write;
 
        pde = create_proc_read_entry("LinuxExtensionsEnabled", 0, proc_fs_cifs,
                                linuxExtensionsEnabled_read, NULL);
@@ -483,6 +540,8 @@ cifsFYI_write(struct file *file, const char __user *buffer,
                cifsFYI = 0;
        else if (c == '1' || c == 'y' || c == 'Y')
                cifsFYI = 1;
+       else if((c > '1') && (c <= '9'))
+               cifsFYI = (int) (c - '0'); /* see cifs_debug.h for meanings */
 
        return count;
 }
@@ -527,14 +586,13 @@ oplockEnabled_write(struct file *file, const char __user *buffer,
 }
 
 static int
-quotaEnabled_read(char *page, char **start, off_t off,
+experimEnabled_read(char *page, char **start, off_t off,
                    int count, int *eof, void *data)
 {
         int len;
 
         len = sprintf(page, "%d\n", experimEnabled);
-/* could also check if quotas are enabled in kernel
-       as a whole first */
+
         len -= off;
         *start = page + off;
 
@@ -549,21 +607,23 @@ quotaEnabled_read(char *page, char **start, off_t off,
         return len;
 }
 static int
-quotaEnabled_write(struct file *file, const char __user *buffer,
+experimEnabled_write(struct file *file, const char __user *buffer,
                     unsigned long count, void *data)
 {
-        char c;
-        int rc;
+       char c;
+       int rc;
 
-        rc = get_user(c, buffer);
-        if (rc)
-                return rc;
-        if (c == '0' || c == 'n' || c == 'N')
-                experimEnabled = 0;
-        else if (c == '1' || c == 'y' || c == 'Y')
-                experimEnabled = 1;
+       rc = get_user(c, buffer);
+       if (rc)
+               return rc;
+       if (c == '0' || c == 'n' || c == 'N')
+               experimEnabled = 0;
+       else if (c == '1' || c == 'y' || c == 'Y')
+               experimEnabled = 1;
+       else if (c == '2')
+               experimEnabled = 2;
 
-        return count;
+       return count;
 }
 
 static int
@@ -573,8 +633,6 @@ linuxExtensionsEnabled_read(char *page, char **start, off_t off,
         int len;
 
         len = sprintf(page, "%d\n", linuxExtEnabled);
-/* could also check if quotas are enabled in kernel
-       as a whole first */
         len -= off;
         *start = page + off;