[PATCH] I2O: Bugfixes to get I2O working again
[linux/fpc-iii.git] / fs / cifs / cifs_debug.c
blobf4124a32bef8974edd3f02111f8e382a63f02199
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 #ifdef CONFIG_CIFS_STATS2
223 atomic_set(&totBufAllocCount, 0);
224 atomic_set(&totSmBufAllocCount, 0);
225 #endif /* CONFIG_CIFS_STATS2 */
226 list_for_each(tmp, &GlobalTreeConnectionList) {
227 tcon = list_entry(tmp, struct cifsTconInfo,
228 cifsConnectionList);
229 atomic_set(&tcon->num_smbs_sent, 0);
230 atomic_set(&tcon->num_writes, 0);
231 atomic_set(&tcon->num_reads, 0);
232 atomic_set(&tcon->num_oplock_brks, 0);
233 atomic_set(&tcon->num_opens, 0);
234 atomic_set(&tcon->num_closes, 0);
235 atomic_set(&tcon->num_deletes, 0);
236 atomic_set(&tcon->num_mkdirs, 0);
237 atomic_set(&tcon->num_rmdirs, 0);
238 atomic_set(&tcon->num_renames, 0);
239 atomic_set(&tcon->num_t2renames, 0);
240 atomic_set(&tcon->num_ffirst, 0);
241 atomic_set(&tcon->num_fnext, 0);
242 atomic_set(&tcon->num_fclose, 0);
243 atomic_set(&tcon->num_hardlinks, 0);
244 atomic_set(&tcon->num_symlinks, 0);
245 atomic_set(&tcon->num_locks, 0);
247 read_unlock(&GlobalSMBSeslock);
250 return count;
253 static int
254 cifs_stats_read(char *buf, char **beginBuffer, off_t offset,
255 int count, int *eof, void *data)
257 int item_length,i,length;
258 struct list_head *tmp;
259 struct cifsTconInfo *tcon;
261 *beginBuffer = buf + offset;
263 length = sprintf(buf,
264 "Resources in use\nCIFS Session: %d\n",
265 sesInfoAllocCount.counter);
266 buf += length;
267 item_length =
268 sprintf(buf,"Share (unique mount targets): %d\n",
269 tconInfoAllocCount.counter);
270 length += item_length;
271 buf += item_length;
272 item_length =
273 sprintf(buf,"SMB Request/Response Buffer: %d Pool size: %d\n",
274 bufAllocCount.counter,
275 cifs_min_rcv + tcpSesAllocCount.counter);
276 length += item_length;
277 buf += item_length;
278 item_length =
279 sprintf(buf,"SMB Small Req/Resp Buffer: %d Pool size: %d\n",
280 smBufAllocCount.counter,cifs_min_small);
281 length += item_length;
282 buf += item_length;
283 #ifdef CONFIG_CIFS_STATS2
284 item_length = sprintf(buf, "Total Large %d Small %d Allocations\n",
285 atomic_read(&totBufAllocCount),
286 atomic_read(&totSmBufAllocCount));
287 length += item_length;
288 buf += item_length;
289 #endif /* CONFIG_CIFS_STATS2 */
291 item_length =
292 sprintf(buf,"Operations (MIDs): %d\n",
293 midCount.counter);
294 length += item_length;
295 buf += item_length;
296 item_length = sprintf(buf,
297 "\n%d session %d share reconnects\n",
298 tcpSesReconnectCount.counter,tconInfoReconnectCount.counter);
299 length += item_length;
300 buf += item_length;
302 item_length = sprintf(buf,
303 "Total vfs operations: %d maximum at one time: %d\n",
304 GlobalCurrentXid,GlobalMaxActiveXid);
305 length += item_length;
306 buf += item_length;
308 i = 0;
309 read_lock(&GlobalSMBSeslock);
310 list_for_each(tmp, &GlobalTreeConnectionList) {
311 i++;
312 tcon = list_entry(tmp, struct cifsTconInfo, cifsConnectionList);
313 item_length = sprintf(buf,"\n%d) %s",i, tcon->treeName);
314 buf += item_length;
315 length += item_length;
316 if(tcon->tidStatus == CifsNeedReconnect) {
317 buf += sprintf(buf, "\tDISCONNECTED ");
318 length += 14;
320 item_length = sprintf(buf, "\nSMBs: %d Oplock Breaks: %d",
321 atomic_read(&tcon->num_smbs_sent),
322 atomic_read(&tcon->num_oplock_brks));
323 buf += item_length;
324 length += item_length;
325 item_length = sprintf(buf, "\nReads: %d Bytes: %lld",
326 atomic_read(&tcon->num_reads),
327 (long long)(tcon->bytes_read));
328 buf += item_length;
329 length += item_length;
330 item_length = sprintf(buf, "\nWrites: %d Bytes: %lld",
331 atomic_read(&tcon->num_writes),
332 (long long)(tcon->bytes_written));
333 buf += item_length;
334 length += item_length;
335 item_length = sprintf(buf,
336 "\nLocks: %d HardLinks: %d Symlinks: %d",
337 atomic_read(&tcon->num_locks),
338 atomic_read(&tcon->num_hardlinks),
339 atomic_read(&tcon->num_symlinks));
340 buf += item_length;
341 length += item_length;
343 item_length = sprintf(buf, "\nOpens: %d Closes: %d Deletes: %d",
344 atomic_read(&tcon->num_opens),
345 atomic_read(&tcon->num_closes),
346 atomic_read(&tcon->num_deletes));
347 buf += item_length;
348 length += item_length;
349 item_length = sprintf(buf, "\nMkdirs: %d Rmdirs: %d",
350 atomic_read(&tcon->num_mkdirs),
351 atomic_read(&tcon->num_rmdirs));
352 buf += item_length;
353 length += item_length;
354 item_length = sprintf(buf, "\nRenames: %d T2 Renames %d",
355 atomic_read(&tcon->num_renames),
356 atomic_read(&tcon->num_t2renames));
357 buf += item_length;
358 length += item_length;
359 item_length = sprintf(buf, "\nFindFirst: %d FNext %d FClose %d",
360 atomic_read(&tcon->num_ffirst),
361 atomic_read(&tcon->num_fnext),
362 atomic_read(&tcon->num_fclose));
363 buf += item_length;
364 length += item_length;
366 read_unlock(&GlobalSMBSeslock);
368 buf += sprintf(buf,"\n");
369 length++;
371 if(offset + count >= length)
372 *eof = 1;
373 if(length < offset) {
374 *eof = 1;
375 return 0;
376 } else {
377 length = length - offset;
379 if (length > count)
380 length = count;
382 return length;
384 #endif
386 static struct proc_dir_entry *proc_fs_cifs;
387 read_proc_t cifs_txanchor_read;
388 static read_proc_t cifsFYI_read;
389 static write_proc_t cifsFYI_write;
390 static read_proc_t oplockEnabled_read;
391 static write_proc_t oplockEnabled_write;
392 static read_proc_t lookupFlag_read;
393 static write_proc_t lookupFlag_write;
394 static read_proc_t traceSMB_read;
395 static write_proc_t traceSMB_write;
396 static read_proc_t multiuser_mount_read;
397 static write_proc_t multiuser_mount_write;
398 static read_proc_t extended_security_read;
399 static write_proc_t extended_security_write;
400 static read_proc_t ntlmv2_enabled_read;
401 static write_proc_t ntlmv2_enabled_write;
402 static read_proc_t packet_signing_enabled_read;
403 static write_proc_t packet_signing_enabled_write;
404 static read_proc_t experimEnabled_read;
405 static write_proc_t experimEnabled_write;
406 static read_proc_t linuxExtensionsEnabled_read;
407 static write_proc_t linuxExtensionsEnabled_write;
409 void
410 cifs_proc_init(void)
412 struct proc_dir_entry *pde;
414 proc_fs_cifs = proc_mkdir("cifs", proc_root_fs);
415 if (proc_fs_cifs == NULL)
416 return;
418 proc_fs_cifs->owner = THIS_MODULE;
419 create_proc_read_entry("DebugData", 0, proc_fs_cifs,
420 cifs_debug_data_read, NULL);
422 #ifdef CONFIG_CIFS_STATS
423 pde = create_proc_read_entry("Stats", 0, proc_fs_cifs,
424 cifs_stats_read, NULL);
425 if (pde)
426 pde->write_proc = cifs_stats_write;
427 #endif
428 pde = create_proc_read_entry("cifsFYI", 0, proc_fs_cifs,
429 cifsFYI_read, NULL);
430 if (pde)
431 pde->write_proc = cifsFYI_write;
433 pde =
434 create_proc_read_entry("traceSMB", 0, proc_fs_cifs,
435 traceSMB_read, NULL);
436 if (pde)
437 pde->write_proc = traceSMB_write;
439 pde = create_proc_read_entry("OplockEnabled", 0, proc_fs_cifs,
440 oplockEnabled_read, NULL);
441 if (pde)
442 pde->write_proc = oplockEnabled_write;
444 pde = create_proc_read_entry("Experimental", 0, proc_fs_cifs,
445 experimEnabled_read, NULL);
446 if (pde)
447 pde->write_proc = experimEnabled_write;
449 pde = create_proc_read_entry("LinuxExtensionsEnabled", 0, proc_fs_cifs,
450 linuxExtensionsEnabled_read, NULL);
451 if (pde)
452 pde->write_proc = linuxExtensionsEnabled_write;
454 pde =
455 create_proc_read_entry("MultiuserMount", 0, proc_fs_cifs,
456 multiuser_mount_read, NULL);
457 if (pde)
458 pde->write_proc = multiuser_mount_write;
460 pde =
461 create_proc_read_entry("ExtendedSecurity", 0, proc_fs_cifs,
462 extended_security_read, NULL);
463 if (pde)
464 pde->write_proc = extended_security_write;
466 pde =
467 create_proc_read_entry("LookupCacheEnabled", 0, proc_fs_cifs,
468 lookupFlag_read, NULL);
469 if (pde)
470 pde->write_proc = lookupFlag_write;
472 pde =
473 create_proc_read_entry("NTLMV2Enabled", 0, proc_fs_cifs,
474 ntlmv2_enabled_read, NULL);
475 if (pde)
476 pde->write_proc = ntlmv2_enabled_write;
478 pde =
479 create_proc_read_entry("PacketSigningEnabled", 0, proc_fs_cifs,
480 packet_signing_enabled_read, NULL);
481 if (pde)
482 pde->write_proc = packet_signing_enabled_write;
485 void
486 cifs_proc_clean(void)
488 if (proc_fs_cifs == NULL)
489 return;
491 remove_proc_entry("DebugData", proc_fs_cifs);
492 remove_proc_entry("cifsFYI", proc_fs_cifs);
493 remove_proc_entry("traceSMB", proc_fs_cifs);
494 #ifdef CONFIG_CIFS_STATS
495 remove_proc_entry("Stats", proc_fs_cifs);
496 #endif
497 remove_proc_entry("MultiuserMount", proc_fs_cifs);
498 remove_proc_entry("OplockEnabled", proc_fs_cifs);
499 remove_proc_entry("NTLMV2Enabled",proc_fs_cifs);
500 remove_proc_entry("ExtendedSecurity",proc_fs_cifs);
501 remove_proc_entry("PacketSigningEnabled",proc_fs_cifs);
502 remove_proc_entry("LinuxExtensionsEnabled",proc_fs_cifs);
503 remove_proc_entry("Experimental",proc_fs_cifs);
504 remove_proc_entry("LookupCacheEnabled",proc_fs_cifs);
505 remove_proc_entry("cifs", proc_root_fs);
508 static int
509 cifsFYI_read(char *page, char **start, off_t off, int count,
510 int *eof, void *data)
512 int len;
514 len = sprintf(page, "%d\n", cifsFYI);
516 len -= off;
517 *start = page + off;
519 if (len > count)
520 len = count;
521 else
522 *eof = 1;
524 if (len < 0)
525 len = 0;
527 return len;
529 static int
530 cifsFYI_write(struct file *file, const char __user *buffer,
531 unsigned long count, void *data)
533 char c;
534 int rc;
536 rc = get_user(c, buffer);
537 if (rc)
538 return rc;
539 if (c == '0' || c == 'n' || c == 'N')
540 cifsFYI = 0;
541 else if (c == '1' || c == 'y' || c == 'Y')
542 cifsFYI = 1;
543 else if((c > '1') && (c <= '9'))
544 cifsFYI = (int) (c - '0'); /* see cifs_debug.h for meanings */
546 return count;
549 static int
550 oplockEnabled_read(char *page, char **start, off_t off,
551 int count, int *eof, void *data)
553 int len;
555 len = sprintf(page, "%d\n", oplockEnabled);
557 len -= off;
558 *start = page + off;
560 if (len > count)
561 len = count;
562 else
563 *eof = 1;
565 if (len < 0)
566 len = 0;
568 return len;
570 static int
571 oplockEnabled_write(struct file *file, const char __user *buffer,
572 unsigned long count, void *data)
574 char c;
575 int rc;
577 rc = get_user(c, buffer);
578 if (rc)
579 return rc;
580 if (c == '0' || c == 'n' || c == 'N')
581 oplockEnabled = 0;
582 else if (c == '1' || c == 'y' || c == 'Y')
583 oplockEnabled = 1;
585 return count;
588 static int
589 experimEnabled_read(char *page, char **start, off_t off,
590 int count, int *eof, void *data)
592 int len;
594 len = sprintf(page, "%d\n", experimEnabled);
596 len -= off;
597 *start = page + off;
599 if (len > count)
600 len = count;
601 else
602 *eof = 1;
604 if (len < 0)
605 len = 0;
607 return len;
609 static int
610 experimEnabled_write(struct file *file, const char __user *buffer,
611 unsigned long count, void *data)
613 char c;
614 int rc;
616 rc = get_user(c, buffer);
617 if (rc)
618 return rc;
619 if (c == '0' || c == 'n' || c == 'N')
620 experimEnabled = 0;
621 else if (c == '1' || c == 'y' || c == 'Y')
622 experimEnabled = 1;
623 else if (c == '2')
624 experimEnabled = 2;
626 return count;
629 static int
630 linuxExtensionsEnabled_read(char *page, char **start, off_t off,
631 int count, int *eof, void *data)
633 int len;
635 len = sprintf(page, "%d\n", linuxExtEnabled);
636 len -= off;
637 *start = page + off;
639 if (len > count)
640 len = count;
641 else
642 *eof = 1;
644 if (len < 0)
645 len = 0;
647 return len;
649 static int
650 linuxExtensionsEnabled_write(struct file *file, const char __user *buffer,
651 unsigned long count, void *data)
653 char c;
654 int rc;
656 rc = get_user(c, buffer);
657 if (rc)
658 return rc;
659 if (c == '0' || c == 'n' || c == 'N')
660 linuxExtEnabled = 0;
661 else if (c == '1' || c == 'y' || c == 'Y')
662 linuxExtEnabled = 1;
664 return count;
668 static int
669 lookupFlag_read(char *page, char **start, off_t off,
670 int count, int *eof, void *data)
672 int len;
674 len = sprintf(page, "%d\n", lookupCacheEnabled);
676 len -= off;
677 *start = page + off;
679 if (len > count)
680 len = count;
681 else
682 *eof = 1;
684 if (len < 0)
685 len = 0;
687 return len;
689 static int
690 lookupFlag_write(struct file *file, const char __user *buffer,
691 unsigned long count, void *data)
693 char c;
694 int rc;
696 rc = get_user(c, buffer);
697 if (rc)
698 return rc;
699 if (c == '0' || c == 'n' || c == 'N')
700 lookupCacheEnabled = 0;
701 else if (c == '1' || c == 'y' || c == 'Y')
702 lookupCacheEnabled = 1;
704 return count;
706 static int
707 traceSMB_read(char *page, char **start, off_t off, int count,
708 int *eof, void *data)
710 int len;
712 len = sprintf(page, "%d\n", traceSMB);
714 len -= off;
715 *start = page + off;
717 if (len > count)
718 len = count;
719 else
720 *eof = 1;
722 if (len < 0)
723 len = 0;
725 return len;
727 static int
728 traceSMB_write(struct file *file, const char __user *buffer,
729 unsigned long count, void *data)
731 char c;
732 int rc;
734 rc = get_user(c, buffer);
735 if (rc)
736 return rc;
737 if (c == '0' || c == 'n' || c == 'N')
738 traceSMB = 0;
739 else if (c == '1' || c == 'y' || c == 'Y')
740 traceSMB = 1;
742 return count;
745 static int
746 multiuser_mount_read(char *page, char **start, off_t off,
747 int count, int *eof, void *data)
749 int len;
751 len = sprintf(page, "%d\n", multiuser_mount);
753 len -= off;
754 *start = page + off;
756 if (len > count)
757 len = count;
758 else
759 *eof = 1;
761 if (len < 0)
762 len = 0;
764 return len;
766 static int
767 multiuser_mount_write(struct file *file, const char __user *buffer,
768 unsigned long count, void *data)
770 char c;
771 int rc;
773 rc = get_user(c, buffer);
774 if (rc)
775 return rc;
776 if (c == '0' || c == 'n' || c == 'N')
777 multiuser_mount = 0;
778 else if (c == '1' || c == 'y' || c == 'Y')
779 multiuser_mount = 1;
781 return count;
784 static int
785 extended_security_read(char *page, char **start, off_t off,
786 int count, int *eof, void *data)
788 int len;
790 len = sprintf(page, "%d\n", extended_security);
792 len -= off;
793 *start = page + off;
795 if (len > count)
796 len = count;
797 else
798 *eof = 1;
800 if (len < 0)
801 len = 0;
803 return len;
805 static int
806 extended_security_write(struct file *file, const char __user *buffer,
807 unsigned long count, void *data)
809 char c;
810 int rc;
812 rc = get_user(c, buffer);
813 if (rc)
814 return rc;
815 if (c == '0' || c == 'n' || c == 'N')
816 extended_security = 0;
817 else if (c == '1' || c == 'y' || c == 'Y')
818 extended_security = 1;
820 return count;
823 static int
824 ntlmv2_enabled_read(char *page, char **start, off_t off,
825 int count, int *eof, void *data)
827 int len;
829 len = sprintf(page, "%d\n", ntlmv2_support);
831 len -= off;
832 *start = page + off;
834 if (len > count)
835 len = count;
836 else
837 *eof = 1;
839 if (len < 0)
840 len = 0;
842 return len;
844 static int
845 ntlmv2_enabled_write(struct file *file, const char __user *buffer,
846 unsigned long count, void *data)
848 char c;
849 int rc;
851 rc = get_user(c, buffer);
852 if (rc)
853 return rc;
854 if (c == '0' || c == 'n' || c == 'N')
855 ntlmv2_support = 0;
856 else if (c == '1' || c == 'y' || c == 'Y')
857 ntlmv2_support = 1;
859 return count;
862 static int
863 packet_signing_enabled_read(char *page, char **start, off_t off,
864 int count, int *eof, void *data)
866 int len;
868 len = sprintf(page, "%d\n", sign_CIFS_PDUs);
870 len -= off;
871 *start = page + off;
873 if (len > count)
874 len = count;
875 else
876 *eof = 1;
878 if (len < 0)
879 len = 0;
881 return len;
883 static int
884 packet_signing_enabled_write(struct file *file, const char __user *buffer,
885 unsigned long count, void *data)
887 char c;
888 int rc;
890 rc = get_user(c, buffer);
891 if (rc)
892 return rc;
893 if (c == '0' || c == 'n' || c == 'N')
894 sign_CIFS_PDUs = 0;
895 else if (c == '1' || c == 'y' || c == 'Y')
896 sign_CIFS_PDUs = 1;
897 else if (c == '2')
898 sign_CIFS_PDUs = 2;
900 return count;
904 #endif