Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
[firefly-linux-kernel-4.4.55.git] / fs / cifs / cifs_debug.c
index d9ea6ede6a7a7e5fbd60aae056cfded4b41b6f18..d59748346020f9302be6a5cf66730b9190f0af9d 100644 (file)
@@ -57,15 +57,32 @@ cifs_dump_mem(char *label, void *data, int length)
        }
 }
 
+#ifdef CONFIG_CIFS_DEBUG
+void cifs_vfs_err(const char *fmt, ...)
+{
+       struct va_format vaf;
+       va_list args;
+
+       va_start(args, fmt);
+
+       vaf.fmt = fmt;
+       vaf.va = &args;
+
+       printk(KERN_ERR "CIFS VFS: %pV", &vaf);
+
+       va_end(args);
+}
+#endif
+
 void cifs_dump_detail(void *buf)
 {
 #ifdef CONFIG_CIFS_DEBUG2
        struct smb_hdr *smb = (struct smb_hdr *)buf;
 
-       cERROR(1, "Cmd: %d Err: 0x%x Flags: 0x%x Flgs2: 0x%x Mid: %d Pid: %d",
-                 smb->Command, smb->Status.CifsError,
-                 smb->Flags, smb->Flags2, smb->Mid, smb->Pid);
-       cERROR(1, "smb buf %p len %u", smb, smbCalcSize(smb));
+       cifs_dbg(VFS, "Cmd: %d Err: 0x%x Flags: 0x%x Flgs2: 0x%x Mid: %d Pid: %d\n",
+                smb->Command, smb->Status.CifsError,
+                smb->Flags, smb->Flags2, smb->Mid, smb->Pid);
+       cifs_dbg(VFS, "smb buf %p len %u\n", smb, smbCalcSize(smb));
 #endif /* CONFIG_CIFS_DEBUG2 */
 }
 
@@ -78,25 +95,25 @@ void cifs_dump_mids(struct TCP_Server_Info *server)
        if (server == NULL)
                return;
 
-       cERROR(1, "Dump pending requests:");
+       cifs_dbg(VFS, "Dump pending requests:\n");
        spin_lock(&GlobalMid_Lock);
        list_for_each(tmp, &server->pending_mid_q) {
                mid_entry = list_entry(tmp, struct mid_q_entry, qhead);
-               cERROR(1, "State: %d Cmd: %d Pid: %d Cbdata: %p Mid %llu",
-                       mid_entry->mid_state,
-                       le16_to_cpu(mid_entry->command),
-                       mid_entry->pid,
-                       mid_entry->callback_data,
-                       mid_entry->mid);
+               cifs_dbg(VFS, "State: %d Cmd: %d Pid: %d Cbdata: %p Mid %llu\n",
+                        mid_entry->mid_state,
+                        le16_to_cpu(mid_entry->command),
+                        mid_entry->pid,
+                        mid_entry->callback_data,
+                        mid_entry->mid);
 #ifdef CONFIG_CIFS_STATS2
-               cERROR(1, "IsLarge: %d buf: %p time rcv: %ld now: %ld",
-                       mid_entry->large_buf,
-                       mid_entry->resp_buf,
-                       mid_entry->when_received,
-                       jiffies);
+               cifs_dbg(VFS, "IsLarge: %d buf: %p time rcv: %ld now: %ld\n",
+                        mid_entry->large_buf,
+                        mid_entry->resp_buf,
+                        mid_entry->when_received,
+                        jiffies);
 #endif /* STATS2 */
-               cERROR(1, "IsMult: %d IsEnd: %d", mid_entry->multiRsp,
-                         mid_entry->multiEnd);
+               cifs_dbg(VFS, "IsMult: %d IsEnd: %d\n",
+                        mid_entry->multiRsp, mid_entry->multiEnd);
                if (mid_entry->resp_buf) {
                        cifs_dump_detail(mid_entry->resp_buf);
                        cifs_dump_mem("existing buf: ",
@@ -603,7 +620,7 @@ static ssize_t cifs_security_flags_proc_write(struct file *file,
                        global_secflags = CIFSSEC_MAX;
                        return count;
                } else if (!isdigit(c)) {
-                       cERROR(1, "invalid flag %c", c);
+                       cifs_dbg(VFS, "invalid flag %c\n", c);
                        return -EINVAL;
                }
        }
@@ -611,16 +628,16 @@ static ssize_t cifs_security_flags_proc_write(struct file *file,
 
        flags = simple_strtoul(flags_string, NULL, 0);
 
-       cFYI(1, "sec flags 0x%x", flags);
+       cifs_dbg(FYI, "sec flags 0x%x\n", flags);
 
        if (flags <= 0)  {
-               cERROR(1, "invalid security flags %s", flags_string);
+               cifs_dbg(VFS, "invalid security flags %s\n", flags_string);
                return -EINVAL;
        }
 
        if (flags & ~CIFSSEC_MASK) {
-               cERROR(1, "attempt to set unsupported security flags 0x%x",
-                       flags & ~CIFSSEC_MASK);
+               cifs_dbg(VFS, "attempt to set unsupported security flags 0x%x\n",
+                        flags & ~CIFSSEC_MASK);
                return -EINVAL;
        }
        /* flags look ok - update the global security flags for cifs module */
@@ -628,9 +645,9 @@ static ssize_t cifs_security_flags_proc_write(struct file *file,
        if (global_secflags & CIFSSEC_MUST_SIGN) {
                /* requiring signing implies signing is allowed */
                global_secflags |= CIFSSEC_MAY_SIGN;
-               cFYI(1, "packet signing now required");
+               cifs_dbg(FYI, "packet signing now required\n");
        } else if ((global_secflags & CIFSSEC_MAY_SIGN) == 0) {
-               cFYI(1, "packet signing disabled");
+               cifs_dbg(FYI, "packet signing disabled\n");
        }
        /* BB should we turn on MAY flags for other MUST options? */
        return count;