23 #include <linux/string.h>
24 #include <linux/ctype.h>
25 #include <linux/module.h>
27 #include <asm/uaccess.h>
44 for (i = 0; i <
length; i += 16) {
46 for (j = 0; (j < 4) && (i + j * 4 < length); j++) {
47 sprintf(buf,
" %08x", intptr[i / 4 + j]);
52 for (j = 0; (j < 16) && (i + j < length); j++) {
53 buf[1] =
isprint(charptr[i + j]) ? charptr[i +
j] :
'.';
62 #ifdef CONFIG_CIFS_DEBUG2
65 cERROR(1,
"Cmd: %d Err: 0x%x Flags: 0x%x Flgs2: 0x%x Mid: %d Pid: %d",
74 #ifdef CONFIG_CIFS_DEBUG2
81 cERROR(1,
"Dump pending requests:");
85 cERROR(1,
"State: %d Cmd: %d Pid: %d Cbdata: %p Mid %llu",
91 #ifdef CONFIG_CIFS_STATS2
92 cERROR(1,
"IsLarge: %d buf: %p time rcv: %ld now: %ld",
95 mid_entry->when_received,
110 #ifdef CONFIG_PROC_FS
111 static int cifs_debug_data_proc_show(
struct seq_file *
m,
void *
v)
122 "Display Internal CIFS Data Structures for Debugging\n"
123 "---------------------------------------------------\n");
126 #ifdef CONFIG_CIFS_DFS_UPCALL
129 #ifdef CONFIG_CIFS_FSCACHE
132 #ifdef CONFIG_CIFS_WEAK_PW_HASH
135 #ifdef CONFIG_CIFS_POSIX
138 #ifdef CONFIG_CIFS_UPCALL
141 #ifdef CONFIG_CIFS_XATTR
144 #ifdef CONFIG_CIFS_ACL
167 "\n%d) Name: %s Domain: %s Uses: %d OS:"
168 " %s\n\tNOS: %s\tCapability: 0x%x\n\tSMB"
169 " session status: %d\t",
174 seq_printf(m,
"TCP status: %d\n\tLocal Users To "
175 "Server: %d SecMode: 0x%x Req On Wire: %d",
177 server->
sec_mode, in_flight(server));
179 #ifdef CONFIG_CIFS_STATS2
180 seq_printf(m,
" In Send: %d In MaxReq Wait: %d",
198 seq_printf(m,
"DevInfo: 0x%x Attributes: 0x%x"
199 "\nPathComponentMax: %d Status: 0x%d",
223 " %d cbdata: %p mid %llu\n",
247 .open = cifs_debug_data_proc_open,
253 #ifdef CONFIG_CIFS_STATS
255 const char __user *
buffer,
size_t count, loff_t *ppos)
268 if (c ==
'1' || c ==
'y' || c ==
'Y' || c ==
'0') {
269 #ifdef CONFIG_CIFS_STATS2
285 if (server->
ops->clear_stats)
286 server->
ops->clear_stats(tcon);
296 static int cifs_stats_proc_show(
struct seq_file *m,
void *v)
305 "Resources in use\nCIFS Session: %d\n",
307 seq_printf(m,
"Share (unique mount targets): %d\n",
309 seq_printf(m,
"SMB Request/Response Buffer: %d Pool size: %d\n",
312 seq_printf(m,
"SMB Small Req/Resp Buffer: %d Pool size: %d\n",
314 #ifdef CONFIG_CIFS_STATS2
315 seq_printf(m,
"Total Large %d Small %d Allocations\n",
322 "\n%d session %d share reconnects\n",
326 "Total vfs operations: %d maximum at one time: %d\n",
347 if (server->
ops->print_stats)
348 server->
ops->print_stats(m, tcon);
358 static int cifs_stats_proc_open(
struct inode *
inode,
struct file *file)
365 .open = cifs_stats_proc_open,
369 .write = cifs_stats_proc_write,
384 if (proc_fs_cifs ==
NULL)
387 proc_create(
"DebugData", 0, proc_fs_cifs, &cifs_debug_data_proc_fops);
389 #ifdef CONFIG_CIFS_STATS
390 proc_create(
"Stats", 0, proc_fs_cifs, &cifs_stats_proc_fops);
392 proc_create(
"cifsFYI", 0, proc_fs_cifs, &cifsFYI_proc_fops);
393 proc_create(
"traceSMB", 0, proc_fs_cifs, &traceSMB_proc_fops);
394 proc_create(
"LinuxExtensionsEnabled", 0, proc_fs_cifs,
395 &cifs_linux_ext_proc_fops);
396 proc_create(
"SecurityFlags", 0, proc_fs_cifs,
397 &cifs_security_flags_proc_fops);
398 proc_create(
"LookupCacheEnabled", 0, proc_fs_cifs,
399 &cifs_lookup_cache_proc_fops);
405 if (proc_fs_cifs ==
NULL)
411 #ifdef CONFIG_CIFS_STATS
420 static int cifsFYI_proc_show(
struct seq_file *m,
void *v)
426 static int cifsFYI_proc_open(
struct inode *
inode,
struct file *file)
431 static ssize_t cifsFYI_proc_write(
struct file *file,
const char __user *buffer,
432 size_t count, loff_t *ppos)
440 if (c ==
'0' || c ==
'n' || c ==
'N')
442 else if (c ==
'1' || c ==
'y' || c ==
'Y')
444 else if ((c >
'1') && (c <=
'9'))
452 .open = cifsFYI_proc_open,
456 .write = cifsFYI_proc_write,
459 static int cifs_linux_ext_proc_show(
struct seq_file *m,
void *v)
465 static int cifs_linux_ext_proc_open(
struct inode *
inode,
struct file *file)
470 static ssize_t cifs_linux_ext_proc_write(
struct file *file,
471 const char __user *buffer,
size_t count, loff_t *ppos)
479 if (c ==
'0' || c ==
'n' || c ==
'N')
481 else if (c ==
'1' || c ==
'y' || c ==
'Y')
489 .open = cifs_linux_ext_proc_open,
493 .write = cifs_linux_ext_proc_write,
496 static int cifs_lookup_cache_proc_show(
struct seq_file *m,
void *v)
502 static int cifs_lookup_cache_proc_open(
struct inode *
inode,
struct file *file)
507 static ssize_t cifs_lookup_cache_proc_write(
struct file *file,
508 const char __user *buffer,
size_t count, loff_t *ppos)
516 if (c ==
'0' || c ==
'n' || c ==
'N')
518 else if (c ==
'1' || c ==
'y' || c ==
'Y')
526 .open = cifs_lookup_cache_proc_open,
530 .write = cifs_lookup_cache_proc_write,
533 static int traceSMB_proc_show(
struct seq_file *m,
void *v)
539 static int traceSMB_proc_open(
struct inode *
inode,
struct file *file)
544 static ssize_t traceSMB_proc_write(
struct file *file,
const char __user *buffer,
545 size_t count, loff_t *ppos)
553 if (c ==
'0' || c ==
'n' || c ==
'N')
555 else if (c ==
'1' || c ==
'y' || c ==
'Y')
563 .open = traceSMB_proc_open,
567 .write = traceSMB_proc_write,
570 static int cifs_security_flags_proc_show(
struct seq_file *m,
void *v)
576 static int cifs_security_flags_proc_open(
struct inode *
inode,
struct file *file)
581 static ssize_t cifs_security_flags_proc_write(
struct file *file,
582 const char __user *buffer,
size_t count, loff_t *ppos)
585 char flags_string[12];
588 if ((count < 1) || (count > 11))
591 memset(flags_string, 0, 12);
599 if (c ==
'0' || c ==
'n' || c ==
'N') {
602 }
else if (c ==
'1' || c ==
'y' || c ==
'Y') {
606 cERROR(1,
"invalid flag %c", c);
614 cFYI(1,
"sec flags 0x%x", flags);
617 cERROR(1,
"invalid security flags %s", flags_string);
622 cERROR(1,
"attempt to set unsupported security flags 0x%x",
631 cFYI(1,
"packet signing now required");
633 cFYI(1,
"packet signing disabled");
641 .open = cifs_security_flags_proc_open,
645 .write = cifs_security_flags_proc_write,