[PATCH] sparc64: task_pt_regs()
[linux-2.6/linux-acpi-2.6/ibm-acpi-2.6.git] / fs / cifs / cifs_debug.c
blob22a444a3fe4c2fb9325a0fdaa2e4eb09d3707670
1 /*
2 * fs/cifs_debug.c
4 * Copyright (C) International Business Machines Corp., 2000,2005
6 * Modified by Steve French (sfrench@us.ibm.com)
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
16 * the GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 #include <linux/fs.h>
23 #include <linux/string.h>
24 #include <linux/ctype.h>
25 #include <linux/module.h>
26 #include <linux/proc_fs.h>
27 #include <asm/uaccess.h>
28 #include "cifspdu.h"
29 #include "cifsglob.h"
30 #include "cifsproto.h"
31 #include "cifs_debug.h"
32 #include "cifsfs.h"
34 void
35 cifs_dump_mem(char *label, void *data, int length)
37 int i, j;
38 int *intptr = data;
39 char *charptr = data;
40 char buf[10], line[80];
42 printk(KERN_DEBUG "%s: dump of %d bytes of data at 0x%p\n\n",
43 label, length, data);
44 for (i = 0; i < length; i += 16) {
45 line[0] = 0;
46 for (j = 0; (j < 4) && (i + j * 4 < length); j++) {
47 sprintf(buf, " %08x", intptr[i / 4 + j]);
48 strcat(line, buf);
50 buf[0] = ' ';
51 buf[2] = 0;
52 for (j = 0; (j < 16) && (i + j < length); j++) {
53 buf[1] = isprint(charptr[i + j]) ? charptr[i + j] : '.';
54 strcat(line, buf);
56 printk(KERN_DEBUG "%s\n", line);
60 #ifdef CONFIG_PROC_FS
61 static int
62 cifs_debug_data_read(char *buf, char **beginBuffer, off_t offset,
63 int count, int *eof, void *data)
65 struct list_head *tmp;
66 struct list_head *tmp1;
67 struct mid_q_entry * mid_entry;
68 struct cifsSesInfo *ses;
69 struct cifsTconInfo *tcon;
70 int i;
71 int length = 0;
72 char * original_buf = buf;
74 *beginBuffer = buf + offset;
77 length =
78 sprintf(buf,
79 "Display Internal CIFS Data Structures for Debugging\n"
80 "---------------------------------------------------\n");
81 buf += length;
82 length = sprintf(buf,"CIFS Version %s\n",CIFS_VERSION);
83 buf += length;
84 length = sprintf(buf,"Active VFS Requests: %d\n", GlobalTotalActiveXid);
85 buf += length;
86 length = sprintf(buf, "Servers:");
87 buf += length;
89 i = 0;
90 read_lock(&GlobalSMBSeslock);
91 list_for_each(tmp, &GlobalSMBSessionList) {
92 i++;
93 ses = list_entry(tmp, struct cifsSesInfo, cifsSessionList);
94 if((ses->serverDomain == NULL) || (ses->serverOS == NULL) ||
95 (ses->serverNOS == NULL)) {
96 buf += sprintf("\nentry for %s not fully displayed\n\t",
97 ses->serverName);
99 } else {
100 length =
101 sprintf(buf,
102 "\n%d) Name: %s Domain: %s Mounts: %d OS: %s \n\tNOS: %s\tCapability: 0x%x\n\tSMB session status: %d\t",
103 i, ses->serverName, ses->serverDomain,
104 atomic_read(&ses->inUse),
105 ses->serverOS, ses->serverNOS,
106 ses->capabilities,ses->status);
107 buf += length;
109 if(ses->server) {
110 buf += sprintf(buf, "TCP status: %d\n\tLocal Users To Server: %d SecMode: 0x%x Req On Wire: %d",
111 ses->server->tcpStatus,
112 atomic_read(&ses->server->socketUseCount),
113 ses->server->secMode,
114 atomic_read(&ses->server->inFlight));
116 #ifdef CONFIG_CIFS_STATS2
117 buf += sprintf(buf, " In Send: %d In MaxReq Wait: %d",
118 atomic_read(&ses->server->inSend),
119 atomic_read(&ses->server->num_waiters));
120 #endif
122 length = sprintf(buf, "\nMIDs:\n");
123 buf += length;
125 spin_lock(&GlobalMid_Lock);
126 list_for_each(tmp1, &ses->server->pending_mid_q) {
127 mid_entry = list_entry(tmp1, struct
128 mid_q_entry,
129 qhead);
130 if(mid_entry) {
131 length = sprintf(buf,"State: %d com: %d pid: %d tsk: %p mid %d\n",
132 mid_entry->midState,
133 (int)mid_entry->command,
134 mid_entry->pid,
135 mid_entry->tsk,
136 mid_entry->mid);
137 buf += length;
140 spin_unlock(&GlobalMid_Lock);
144 read_unlock(&GlobalSMBSeslock);
145 sprintf(buf, "\n");
146 buf++;
148 length = sprintf(buf, "Shares:");
149 buf += length;
151 i = 0;
152 read_lock(&GlobalSMBSeslock);
153 list_for_each(tmp, &GlobalTreeConnectionList) {
154 __u32 dev_type;
155 i++;
156 tcon = list_entry(tmp, struct cifsTconInfo, cifsConnectionList);
157 dev_type = le32_to_cpu(tcon->fsDevInfo.DeviceType);
158 length =
159 sprintf(buf,
160 "\n%d) %s Uses: %d Type: %s DevInfo: 0x%x Attributes: 0x%x\nPathComponentMax: %d Status: %d",
161 i, tcon->treeName,
162 atomic_read(&tcon->useCount),
163 tcon->nativeFileSystem,
164 le32_to_cpu(tcon->fsDevInfo.DeviceCharacteristics),
165 le32_to_cpu(tcon->fsAttrInfo.Attributes),
166 le32_to_cpu(tcon->fsAttrInfo.MaxPathNameComponentLength),
167 tcon->tidStatus);
168 buf += length;
169 if (dev_type == FILE_DEVICE_DISK)
170 length = sprintf(buf, " type: DISK ");
171 else if (dev_type == FILE_DEVICE_CD_ROM)
172 length = sprintf(buf, " type: CDROM ");
173 else
174 length =
175 sprintf(buf, " type: %d ", dev_type);
176 buf += length;
177 if(tcon->tidStatus == CifsNeedReconnect) {
178 buf += sprintf(buf, "\tDISCONNECTED ");
179 length += 14;
182 read_unlock(&GlobalSMBSeslock);
184 length = sprintf(buf, "\n");
185 buf += length;
187 /* BB add code to dump additional info such as TCP session info now */
188 /* Now calculate total size of returned data */
189 length = buf - original_buf;
191 if(offset + count >= length)
192 *eof = 1;
193 if(length < offset) {
194 *eof = 1;
195 return 0;
196 } else {
197 length = length - offset;
199 if (length > count)
200 length = count;
202 return length;
205 #ifdef CONFIG_CIFS_STATS
207 static int
208 cifs_stats_write(struct file *file, const char __user *buffer,
209 unsigned long count, void *data)
211 char c;
212 int rc;
213 struct list_head *tmp;
214 struct cifsTconInfo *tcon;
216 rc = get_user(c, buffer);
217 if (rc)
218 return rc;
220 if (c == '1' || c == 'y' || c == 'Y' || c == '0') {
221 read_lock(&GlobalSMBSeslock);
222 list_for_each(tmp, &GlobalTreeConnectionList) {
223 tcon = list_entry(tmp, struct cifsTconInfo,
224 cifsConnectionList);
225 atomic_set(&tcon->num_smbs_sent, 0);
226 atomic_set(&tcon->num_writes, 0);
227 atomic_set(&tcon->num_reads, 0);
228 atomic_set(&tcon->num_oplock_brks, 0);
229 atomic_set(&tcon->num_opens, 0);
230 atomic_set(&tcon->num_closes, 0);
231 atomic_set(&tcon->num_deletes, 0);
232 atomic_set(&tcon->num_mkdirs, 0);
233 atomic_set(&tcon->num_rmdirs, 0);
234 atomic_set(&tcon->num_renames, 0);
235 atomic_set(&tcon->num_t2renames, 0);
236 atomic_set(&tcon->num_ffirst, 0);
237 atomic_set(&tcon->num_fnext, 0);
238 atomic_set(&tcon->num_fclose, 0);
239 atomic_set(&tcon->num_hardlinks, 0);
240 atomic_set(&tcon->num_symlinks, 0);
241 atomic_set(&tcon->num_locks, 0);
243 read_unlock(&GlobalSMBSeslock);
246 return count;
249 static int
250 cifs_stats_read(char *buf, char **beginBuffer, off_t offset,
251 int count, int *eof, void *data)
253 int item_length,i,length;
254 struct list_head *tmp;
255 struct cifsTconInfo *tcon;
257 *beginBuffer = buf + offset;
259 length = sprintf(buf,
260 "Resources in use\nCIFS Session: %d\n",
261 sesInfoAllocCount.counter);
262 buf += length;
263 item_length =
264 sprintf(buf,"Share (unique mount targets): %d\n",
265 tconInfoAllocCount.counter);
266 length += item_length;
267 buf += item_length;
268 item_length =
269 sprintf(buf,"SMB Request/Response Buffer: %d Pool size: %d\n",
270 bufAllocCount.counter,
271 cifs_min_rcv + tcpSesAllocCount.counter);
272 length += item_length;
273 buf += item_length;
274 item_length =
275 sprintf(buf,"SMB Small Req/Resp Buffer: %d Pool size: %d\n",
276 smBufAllocCount.counter,cifs_min_small);
277 length += item_length;
278 buf += item_length;
279 item_length =
280 sprintf(buf,"Operations (MIDs): %d\n",
281 midCount.counter);
282 length += item_length;
283 buf += item_length;
284 item_length = sprintf(buf,
285 "\n%d session %d share reconnects\n",
286 tcpSesReconnectCount.counter,tconInfoReconnectCount.counter);
287 length += item_length;
288 buf += item_length;
290 item_length = sprintf(buf,
291 "Total vfs operations: %d maximum at one time: %d\n",
292 GlobalCurrentXid,GlobalMaxActiveXid);
293 length += item_length;
294 buf += item_length;
296 i = 0;
297 read_lock(&GlobalSMBSeslock);
298 list_for_each(tmp, &GlobalTreeConnectionList) {
299 i++;
300 tcon = list_entry(tmp, struct cifsTconInfo, cifsConnectionList);
301 item_length = sprintf(buf,"\n%d) %s",i, tcon->treeName);
302 buf += item_length;
303 length += item_length;
304 if(tcon->tidStatus == CifsNeedReconnect) {
305 buf += sprintf(buf, "\tDISCONNECTED ");
306 length += 14;
308 item_length = sprintf(buf, "\nSMBs: %d Oplock Breaks: %d",
309 atomic_read(&tcon->num_smbs_sent),
310 atomic_read(&tcon->num_oplock_brks));
311 buf += item_length;
312 length += item_length;
313 item_length = sprintf(buf, "\nReads: %d Bytes: %lld",
314 atomic_read(&tcon->num_reads),
315 (long long)(tcon->bytes_read));
316 buf += item_length;
317 length += item_length;
318 item_length = sprintf(buf, "\nWrites: %d Bytes: %lld",
319 atomic_read(&tcon->num_writes),
320 (long long)(tcon->bytes_written));
321 buf += item_length;
322 length += item_length;
323 item_length = sprintf(buf,
324 "\nLocks: %d HardLinks: %d Symlinks: %d",
325 atomic_read(&tcon->num_locks),
326 atomic_read(&tcon->num_hardlinks),
327 atomic_read(&tcon->num_symlinks));
328 buf += item_length;
329 length += item_length;
331 item_length = sprintf(buf, "\nOpens: %d Closes: %d Deletes: %d",
332 atomic_read(&tcon->num_opens),
333 atomic_read(&tcon->num_closes),
334 atomic_read(&tcon->num_deletes));
335 buf += item_length;
336 length += item_length;
337 item_length = sprintf(buf, "\nMkdirs: %d Rmdirs: %d",
338 atomic_read(&tcon->num_mkdirs),
339 atomic_read(&tcon->num_rmdirs));
340 buf += item_length;
341 length += item_length;
342 item_length = sprintf(buf, "\nRenames: %d T2 Renames %d",
343 atomic_read(&tcon->num_renames),
344 atomic_read(&tcon->num_t2renames));
345 buf += item_length;
346 length += item_length;
347 item_length = sprintf(buf, "\nFindFirst: %d FNext %d FClose %d",
348 atomic_read(&tcon->num_ffirst),
349 atomic_read(&tcon->num_fnext),
350 atomic_read(&tcon->num_fclose));
351 buf += item_length;
352 length += item_length;
354 read_unlock(&GlobalSMBSeslock);
356 buf += sprintf(buf,"\n");
357 length++;
359 if(offset + count >= length)
360 *eof = 1;
361 if(length < offset) {
362 *eof = 1;
363 return 0;
364 } else {
365 length = length - offset;
367 if (length > count)
368 length = count;
370 return length;
372 #endif
374 static struct proc_dir_entry *proc_fs_cifs;
375 read_proc_t cifs_txanchor_read;
376 static read_proc_t cifsFYI_read;
377 static write_proc_t cifsFYI_write;
378 static read_proc_t oplockEnabled_read;
379 static write_proc_t oplockEnabled_write;
380 static read_proc_t lookupFlag_read;
381 static write_proc_t lookupFlag_write;
382 static read_proc_t traceSMB_read;
383 static write_proc_t traceSMB_write;
384 static read_proc_t multiuser_mount_read;
385 static write_proc_t multiuser_mount_write;
386 static read_proc_t extended_security_read;
387 static write_proc_t extended_security_write;
388 static read_proc_t ntlmv2_enabled_read;
389 static write_proc_t ntlmv2_enabled_write;
390 static read_proc_t packet_signing_enabled_read;
391 static write_proc_t packet_signing_enabled_write;
392 static read_proc_t quotaEnabled_read;
393 static write_proc_t quotaEnabled_write;
394 static read_proc_t linuxExtensionsEnabled_read;
395 static write_proc_t linuxExtensionsEnabled_write;
397 void
398 cifs_proc_init(void)
400 struct proc_dir_entry *pde;
402 proc_fs_cifs = proc_mkdir("cifs", proc_root_fs);
403 if (proc_fs_cifs == NULL)
404 return;
406 proc_fs_cifs->owner = THIS_MODULE;
407 create_proc_read_entry("DebugData", 0, proc_fs_cifs,
408 cifs_debug_data_read, NULL);
410 #ifdef CONFIG_CIFS_STATS
411 pde = create_proc_read_entry("Stats", 0, proc_fs_cifs,
412 cifs_stats_read, NULL);
413 if (pde)
414 pde->write_proc = cifs_stats_write;
415 #endif
416 pde = create_proc_read_entry("cifsFYI", 0, proc_fs_cifs,
417 cifsFYI_read, NULL);
418 if (pde)
419 pde->write_proc = cifsFYI_write;
421 pde =
422 create_proc_read_entry("traceSMB", 0, proc_fs_cifs,
423 traceSMB_read, NULL);
424 if (pde)
425 pde->write_proc = traceSMB_write;
427 pde = create_proc_read_entry("OplockEnabled", 0, proc_fs_cifs,
428 oplockEnabled_read, NULL);
429 if (pde)
430 pde->write_proc = oplockEnabled_write;
432 pde = create_proc_read_entry("Experimental", 0, proc_fs_cifs,
433 quotaEnabled_read, NULL);
434 if (pde)
435 pde->write_proc = quotaEnabled_write;
437 pde = create_proc_read_entry("LinuxExtensionsEnabled", 0, proc_fs_cifs,
438 linuxExtensionsEnabled_read, NULL);
439 if (pde)
440 pde->write_proc = linuxExtensionsEnabled_write;
442 pde =
443 create_proc_read_entry("MultiuserMount", 0, proc_fs_cifs,
444 multiuser_mount_read, NULL);
445 if (pde)
446 pde->write_proc = multiuser_mount_write;
448 pde =
449 create_proc_read_entry("ExtendedSecurity", 0, proc_fs_cifs,
450 extended_security_read, NULL);
451 if (pde)
452 pde->write_proc = extended_security_write;
454 pde =
455 create_proc_read_entry("LookupCacheEnabled", 0, proc_fs_cifs,
456 lookupFlag_read, NULL);
457 if (pde)
458 pde->write_proc = lookupFlag_write;
460 pde =
461 create_proc_read_entry("NTLMV2Enabled", 0, proc_fs_cifs,
462 ntlmv2_enabled_read, NULL);
463 if (pde)
464 pde->write_proc = ntlmv2_enabled_write;
466 pde =
467 create_proc_read_entry("PacketSigningEnabled", 0, proc_fs_cifs,
468 packet_signing_enabled_read, NULL);
469 if (pde)
470 pde->write_proc = packet_signing_enabled_write;
473 void
474 cifs_proc_clean(void)
476 if (proc_fs_cifs == NULL)
477 return;
479 remove_proc_entry("DebugData", proc_fs_cifs);
480 remove_proc_entry("cifsFYI", proc_fs_cifs);
481 remove_proc_entry("traceSMB", proc_fs_cifs);
482 #ifdef CONFIG_CIFS_STATS
483 remove_proc_entry("Stats", proc_fs_cifs);
484 #endif
485 remove_proc_entry("MultiuserMount", proc_fs_cifs);
486 remove_proc_entry("OplockEnabled", proc_fs_cifs);
487 remove_proc_entry("NTLMV2Enabled",proc_fs_cifs);
488 remove_proc_entry("ExtendedSecurity",proc_fs_cifs);
489 remove_proc_entry("PacketSigningEnabled",proc_fs_cifs);
490 remove_proc_entry("LinuxExtensionsEnabled",proc_fs_cifs);
491 remove_proc_entry("Experimental",proc_fs_cifs);
492 remove_proc_entry("LookupCacheEnabled",proc_fs_cifs);
493 remove_proc_entry("cifs", proc_root_fs);
496 static int
497 cifsFYI_read(char *page, char **start, off_t off, int count,
498 int *eof, void *data)
500 int len;
502 len = sprintf(page, "%d\n", cifsFYI);
504 len -= off;
505 *start = page + off;
507 if (len > count)
508 len = count;
509 else
510 *eof = 1;
512 if (len < 0)
513 len = 0;
515 return len;
517 static int
518 cifsFYI_write(struct file *file, const char __user *buffer,
519 unsigned long count, void *data)
521 char c;
522 int rc;
524 rc = get_user(c, buffer);
525 if (rc)
526 return rc;
527 if (c == '0' || c == 'n' || c == 'N')
528 cifsFYI = 0;
529 else if (c == '1' || c == 'y' || c == 'Y')
530 cifsFYI = 1;
531 else if((c > '1') && (c <= '9'))
532 cifsFYI = (int) (c - '0'); /* see cifs_debug.h for meanings */
534 return count;
537 static int
538 oplockEnabled_read(char *page, char **start, off_t off,
539 int count, int *eof, void *data)
541 int len;
543 len = sprintf(page, "%d\n", oplockEnabled);
545 len -= off;
546 *start = page + off;
548 if (len > count)
549 len = count;
550 else
551 *eof = 1;
553 if (len < 0)
554 len = 0;
556 return len;
558 static int
559 oplockEnabled_write(struct file *file, const char __user *buffer,
560 unsigned long count, void *data)
562 char c;
563 int rc;
565 rc = get_user(c, buffer);
566 if (rc)
567 return rc;
568 if (c == '0' || c == 'n' || c == 'N')
569 oplockEnabled = 0;
570 else if (c == '1' || c == 'y' || c == 'Y')
571 oplockEnabled = 1;
573 return count;
576 static int
577 quotaEnabled_read(char *page, char **start, off_t off,
578 int count, int *eof, void *data)
580 int len;
582 len = sprintf(page, "%d\n", experimEnabled);
583 /* could also check if quotas are enabled in kernel
584 as a whole first */
585 len -= off;
586 *start = page + off;
588 if (len > count)
589 len = count;
590 else
591 *eof = 1;
593 if (len < 0)
594 len = 0;
596 return len;
598 static int
599 quotaEnabled_write(struct file *file, const char __user *buffer,
600 unsigned long count, void *data)
602 char c;
603 int rc;
605 rc = get_user(c, buffer);
606 if (rc)
607 return rc;
608 if (c == '0' || c == 'n' || c == 'N')
609 experimEnabled = 0;
610 else if (c == '1' || c == 'y' || c == 'Y')
611 experimEnabled = 1;
613 return count;
616 static int
617 linuxExtensionsEnabled_read(char *page, char **start, off_t off,
618 int count, int *eof, void *data)
620 int len;
622 len = sprintf(page, "%d\n", linuxExtEnabled);
623 /* could also check if quotas are enabled in kernel
624 as a whole first */
625 len -= off;
626 *start = page + off;
628 if (len > count)
629 len = count;
630 else
631 *eof = 1;
633 if (len < 0)
634 len = 0;
636 return len;
638 static int
639 linuxExtensionsEnabled_write(struct file *file, const char __user *buffer,
640 unsigned long count, void *data)
642 char c;
643 int rc;
645 rc = get_user(c, buffer);
646 if (rc)
647 return rc;
648 if (c == '0' || c == 'n' || c == 'N')
649 linuxExtEnabled = 0;
650 else if (c == '1' || c == 'y' || c == 'Y')
651 linuxExtEnabled = 1;
653 return count;
657 static int
658 lookupFlag_read(char *page, char **start, off_t off,
659 int count, int *eof, void *data)
661 int len;
663 len = sprintf(page, "%d\n", lookupCacheEnabled);
665 len -= off;
666 *start = page + off;
668 if (len > count)
669 len = count;
670 else
671 *eof = 1;
673 if (len < 0)
674 len = 0;
676 return len;
678 static int
679 lookupFlag_write(struct file *file, const char __user *buffer,
680 unsigned long count, void *data)
682 char c;
683 int rc;
685 rc = get_user(c, buffer);
686 if (rc)
687 return rc;
688 if (c == '0' || c == 'n' || c == 'N')
689 lookupCacheEnabled = 0;
690 else if (c == '1' || c == 'y' || c == 'Y')
691 lookupCacheEnabled = 1;
693 return count;
695 static int
696 traceSMB_read(char *page, char **start, off_t off, int count,
697 int *eof, void *data)
699 int len;
701 len = sprintf(page, "%d\n", traceSMB);
703 len -= off;
704 *start = page + off;
706 if (len > count)
707 len = count;
708 else
709 *eof = 1;
711 if (len < 0)
712 len = 0;
714 return len;
716 static int
717 traceSMB_write(struct file *file, const char __user *buffer,
718 unsigned long count, void *data)
720 char c;
721 int rc;
723 rc = get_user(c, buffer);
724 if (rc)
725 return rc;
726 if (c == '0' || c == 'n' || c == 'N')
727 traceSMB = 0;
728 else if (c == '1' || c == 'y' || c == 'Y')
729 traceSMB = 1;
731 return count;
734 static int
735 multiuser_mount_read(char *page, char **start, off_t off,
736 int count, int *eof, void *data)
738 int len;
740 len = sprintf(page, "%d\n", multiuser_mount);
742 len -= off;
743 *start = page + off;
745 if (len > count)
746 len = count;
747 else
748 *eof = 1;
750 if (len < 0)
751 len = 0;
753 return len;
755 static int
756 multiuser_mount_write(struct file *file, const char __user *buffer,
757 unsigned long count, void *data)
759 char c;
760 int rc;
762 rc = get_user(c, buffer);
763 if (rc)
764 return rc;
765 if (c == '0' || c == 'n' || c == 'N')
766 multiuser_mount = 0;
767 else if (c == '1' || c == 'y' || c == 'Y')
768 multiuser_mount = 1;
770 return count;
773 static int
774 extended_security_read(char *page, char **start, off_t off,
775 int count, int *eof, void *data)
777 int len;
779 len = sprintf(page, "%d\n", extended_security);
781 len -= off;
782 *start = page + off;
784 if (len > count)
785 len = count;
786 else
787 *eof = 1;
789 if (len < 0)
790 len = 0;
792 return len;
794 static int
795 extended_security_write(struct file *file, const char __user *buffer,
796 unsigned long count, void *data)
798 char c;
799 int rc;
801 rc = get_user(c, buffer);
802 if (rc)
803 return rc;
804 if (c == '0' || c == 'n' || c == 'N')
805 extended_security = 0;
806 else if (c == '1' || c == 'y' || c == 'Y')
807 extended_security = 1;
809 return count;
812 static int
813 ntlmv2_enabled_read(char *page, char **start, off_t off,
814 int count, int *eof, void *data)
816 int len;
818 len = sprintf(page, "%d\n", ntlmv2_support);
820 len -= off;
821 *start = page + off;
823 if (len > count)
824 len = count;
825 else
826 *eof = 1;
828 if (len < 0)
829 len = 0;
831 return len;
833 static int
834 ntlmv2_enabled_write(struct file *file, const char __user *buffer,
835 unsigned long count, void *data)
837 char c;
838 int rc;
840 rc = get_user(c, buffer);
841 if (rc)
842 return rc;
843 if (c == '0' || c == 'n' || c == 'N')
844 ntlmv2_support = 0;
845 else if (c == '1' || c == 'y' || c == 'Y')
846 ntlmv2_support = 1;
848 return count;
851 static int
852 packet_signing_enabled_read(char *page, char **start, off_t off,
853 int count, int *eof, void *data)
855 int len;
857 len = sprintf(page, "%d\n", sign_CIFS_PDUs);
859 len -= off;
860 *start = page + off;
862 if (len > count)
863 len = count;
864 else
865 *eof = 1;
867 if (len < 0)
868 len = 0;
870 return len;
872 static int
873 packet_signing_enabled_write(struct file *file, const char __user *buffer,
874 unsigned long count, void *data)
876 char c;
877 int rc;
879 rc = get_user(c, buffer);
880 if (rc)
881 return rc;
882 if (c == '0' || c == 'n' || c == 'N')
883 sign_CIFS_PDUs = 0;
884 else if (c == '1' || c == 'y' || c == 'Y')
885 sign_CIFS_PDUs = 1;
886 else if (c == '2')
887 sign_CIFS_PDUs = 2;
889 return count;
893 #endif