]> bbs.cooldavid.org Git - net-next-2.6.git/blame - fs/cifs/cifs_debug.c
[CIFS] Fix oops in experimental notify code (when CONFIG_CIFS_EXPERIMENTAL
[net-next-2.6.git] / fs / cifs / cifs_debug.c
CommitLineData
1da177e4
LT
1/*
2 * fs/cifs_debug.c
3 *
b8643e1b 4 * Copyright (C) International Business Machines Corp., 2000,2005
1da177e4
LT
5 *
6 * Modified by Steve French (sfrench@us.ibm.com)
7 *
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.
12 *
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.
17 *
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
21 */
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"
6c91d362 32#include "cifsfs.h"
1da177e4
LT
33
34void
35cifs_dump_mem(char *label, void *data, int length)
36{
37 int i, j;
38 int *intptr = data;
39 char *charptr = data;
40 char buf[10], line[80];
41
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);
49 }
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);
55 }
56 printk(KERN_DEBUG "%s\n", line);
57 }
58}
59
60#ifdef CONFIG_PROC_FS
61static int
62cifs_debug_data_read(char *buf, char **beginBuffer, off_t offset,
63 int count, int *eof, void *data)
64{
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;
73
74 *beginBuffer = buf + offset;
75
76
77 length =
78 sprintf(buf,
79 "Display Internal CIFS Data Structures for Debugging\n"
80 "---------------------------------------------------\n");
81 buf += length;
6c91d362
SF
82 length = sprintf(buf,"CIFS Version %s\n",CIFS_VERSION);
83 buf += length;
131afd0b
SF
84 length = sprintf(buf,"Active VFS Requests: %d\n", GlobalTotalActiveXid);
85 buf += length;
6c91d362 86 length = sprintf(buf, "Servers:");
1da177e4
LT
87 buf += length;
88
89 i = 0;
90 read_lock(&GlobalSMBSeslock);
91 list_for_each(tmp, &GlobalSMBSessionList) {
92 i++;
93 ses = list_entry(tmp, struct cifsSesInfo, cifsSessionList);
433dc24f
SF
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);
98
99 } else {
100 length =
101 sprintf(buf,
131afd0b 102 "\n%d) Name: %s Domain: %s Mounts: %d OS: %s \n\tNOS: %s\tCapability: 0x%x\n\tSMB session status: %d\t",
b8643e1b
SF
103 i, ses->serverName, ses->serverDomain,
104 atomic_read(&ses->inUse),
105 ses->serverOS, ses->serverNOS,
106 ses->capabilities,ses->status);
433dc24f
SF
107 buf += length;
108 }
1da177e4 109 if(ses->server) {
131afd0b 110 buf += sprintf(buf, "TCP status: %d\n\tLocal Users To Server: %d SecMode: 0x%x Req On Wire: %d",
1da177e4
LT
111 ses->server->tcpStatus,
112 atomic_read(&ses->server->socketUseCount),
113 ses->server->secMode,
114 atomic_read(&ses->server->inFlight));
131afd0b
SF
115
116#ifdef CONFIG_CIFS_STATS2
68058e75 117 buf += sprintf(buf, " In Send: %d In MaxReq Wait: %d",
131afd0b
SF
118 atomic_read(&ses->server->inSend),
119 atomic_read(&ses->server->num_waiters));
120#endif
121
6c91d362 122 length = sprintf(buf, "\nMIDs:\n");
1da177e4
LT
123 buf += length;
124
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) {
848f3fce
SF
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);
1da177e4
LT
137 buf += length;
138 }
139 }
140 spin_unlock(&GlobalMid_Lock);
141 }
142
143 }
144 read_unlock(&GlobalSMBSeslock);
145 sprintf(buf, "\n");
146 buf++;
147
6c91d362 148 length = sprintf(buf, "Shares:");
1da177e4
LT
149 buf += length;
150
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,
131afd0b 160 "\n%d) %s Uses: %d Type: %s DevInfo: 0x%x Attributes: 0x%x\nPathComponentMax: %d Status: %d",
1da177e4
LT
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;
180 }
181 }
182 read_unlock(&GlobalSMBSeslock);
183
184 length = sprintf(buf, "\n");
185 buf += length;
186
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;
190
191 if(offset + count >= length)
192 *eof = 1;
193 if(length < offset) {
194 *eof = 1;
195 return 0;
196 } else {
197 length = length - offset;
198 }
199 if (length > count)
200 length = count;
201
202 return length;
203}
204
205#ifdef CONFIG_CIFS_STATS
206static int
207cifs_stats_read(char *buf, char **beginBuffer, off_t offset,
208 int count, int *eof, void *data)
209{
210 int item_length,i,length;
211 struct list_head *tmp;
212 struct cifsTconInfo *tcon;
213
214 *beginBuffer = buf + offset;
215
216 length = sprintf(buf,
217 "Resources in use\nCIFS Session: %d\n",
218 sesInfoAllocCount.counter);
219 buf += length;
220 item_length =
221 sprintf(buf,"Share (unique mount targets): %d\n",
222 tconInfoAllocCount.counter);
223 length += item_length;
224 buf += item_length;
225 item_length =
226 sprintf(buf,"SMB Request/Response Buffer: %d Pool size: %d\n",
b8643e1b
SF
227 bufAllocCount.counter,
228 cifs_min_rcv + tcpSesAllocCount.counter);
1da177e4
LT
229 length += item_length;
230 buf += item_length;
231 item_length =
232 sprintf(buf,"SMB Small Req/Resp Buffer: %d Pool size: %d\n",
233 smBufAllocCount.counter,cifs_min_small);
234 length += item_length;
235 buf += item_length;
236 item_length =
237 sprintf(buf,"Operations (MIDs): %d\n",
238 midCount.counter);
239 length += item_length;
240 buf += item_length;
241 item_length = sprintf(buf,
242 "\n%d session %d share reconnects\n",
243 tcpSesReconnectCount.counter,tconInfoReconnectCount.counter);
244 length += item_length;
245 buf += item_length;
246
247 item_length = sprintf(buf,
248 "Total vfs operations: %d maximum at one time: %d\n",
249 GlobalCurrentXid,GlobalMaxActiveXid);
250 length += item_length;
251 buf += item_length;
252
253 i = 0;
254 read_lock(&GlobalSMBSeslock);
255 list_for_each(tmp, &GlobalTreeConnectionList) {
256 i++;
257 tcon = list_entry(tmp, struct cifsTconInfo, cifsConnectionList);
258 item_length = sprintf(buf,"\n%d) %s",i, tcon->treeName);
259 buf += item_length;
260 length += item_length;
261 if(tcon->tidStatus == CifsNeedReconnect) {
262 buf += sprintf(buf, "\tDISCONNECTED ");
263 length += 14;
264 }
a5a2b489 265 item_length = sprintf(buf, "\nSMBs: %d Oplock Breaks: %d",
1da177e4
LT
266 atomic_read(&tcon->num_smbs_sent),
267 atomic_read(&tcon->num_oplock_brks));
268 buf += item_length;
269 length += item_length;
0ae0efad 270 item_length = sprintf(buf, "\nReads: %d Bytes: %lld",
1da177e4
LT
271 atomic_read(&tcon->num_reads),
272 (long long)(tcon->bytes_read));
273 buf += item_length;
274 length += item_length;
a5a2b489 275 item_length = sprintf(buf, "\nWrites: %d Bytes: %lld",
1da177e4
LT
276 atomic_read(&tcon->num_writes),
277 (long long)(tcon->bytes_written));
a5a2b489
SF
278 buf += item_length;
279 length += item_length;
280 item_length = sprintf(buf,
281 "\nLocks: %d HardLinks: %d Symlinks: %d",
282 atomic_read(&tcon->num_locks),
283 atomic_read(&tcon->num_hardlinks),
284 atomic_read(&tcon->num_symlinks));
285 buf += item_length;
286 length += item_length;
287
288 item_length = sprintf(buf, "\nOpens: %d Closes: %d Deletes: %d",
289 atomic_read(&tcon->num_opens),
290 atomic_read(&tcon->num_closes),
291 atomic_read(&tcon->num_deletes));
1da177e4
LT
292 buf += item_length;
293 length += item_length;
a5a2b489 294 item_length = sprintf(buf, "\nMkdirs: %d Rmdirs: %d",
1da177e4
LT
295 atomic_read(&tcon->num_mkdirs),
296 atomic_read(&tcon->num_rmdirs));
297 buf += item_length;
298 length += item_length;
a5a2b489 299 item_length = sprintf(buf, "\nRenames: %d T2 Renames %d",
1da177e4
LT
300 atomic_read(&tcon->num_renames),
301 atomic_read(&tcon->num_t2renames));
302 buf += item_length;
303 length += item_length;
a5a2b489 304 item_length = sprintf(buf, "\nFindFirst: %d FNext %d FClose %d",
0c0ff093
SF
305 atomic_read(&tcon->num_ffirst),
306 atomic_read(&tcon->num_fnext),
307 atomic_read(&tcon->num_fclose));
308 buf += item_length;
309 length += item_length;
1da177e4
LT
310 }
311 read_unlock(&GlobalSMBSeslock);
312
313 buf += sprintf(buf,"\n");
314 length++;
315
316 if(offset + count >= length)
317 *eof = 1;
318 if(length < offset) {
319 *eof = 1;
320 return 0;
321 } else {
322 length = length - offset;
323 }
324 if (length > count)
325 length = count;
326
327 return length;
328}
329#endif
330
331static struct proc_dir_entry *proc_fs_cifs;
332read_proc_t cifs_txanchor_read;
333static read_proc_t cifsFYI_read;
334static write_proc_t cifsFYI_write;
335static read_proc_t oplockEnabled_read;
336static write_proc_t oplockEnabled_write;
337static read_proc_t lookupFlag_read;
338static write_proc_t lookupFlag_write;
339static read_proc_t traceSMB_read;
340static write_proc_t traceSMB_write;
341static read_proc_t multiuser_mount_read;
342static write_proc_t multiuser_mount_write;
343static read_proc_t extended_security_read;
344static write_proc_t extended_security_write;
345static read_proc_t ntlmv2_enabled_read;
346static write_proc_t ntlmv2_enabled_write;
347static read_proc_t packet_signing_enabled_read;
348static write_proc_t packet_signing_enabled_write;
349static read_proc_t quotaEnabled_read;
350static write_proc_t quotaEnabled_write;
351static read_proc_t linuxExtensionsEnabled_read;
352static write_proc_t linuxExtensionsEnabled_write;
353
354void
355cifs_proc_init(void)
356{
357 struct proc_dir_entry *pde;
358
359 proc_fs_cifs = proc_mkdir("cifs", proc_root_fs);
360 if (proc_fs_cifs == NULL)
361 return;
362
363 proc_fs_cifs->owner = THIS_MODULE;
364 create_proc_read_entry("DebugData", 0, proc_fs_cifs,
365 cifs_debug_data_read, NULL);
366
367#ifdef CONFIG_CIFS_STATS
368 create_proc_read_entry("Stats", 0, proc_fs_cifs,
369 cifs_stats_read, NULL);
370#endif
371 pde = create_proc_read_entry("cifsFYI", 0, proc_fs_cifs,
372 cifsFYI_read, NULL);
373 if (pde)
374 pde->write_proc = cifsFYI_write;
375
376 pde =
377 create_proc_read_entry("traceSMB", 0, proc_fs_cifs,
378 traceSMB_read, NULL);
379 if (pde)
380 pde->write_proc = traceSMB_write;
381
382 pde = create_proc_read_entry("OplockEnabled", 0, proc_fs_cifs,
383 oplockEnabled_read, NULL);
384 if (pde)
385 pde->write_proc = oplockEnabled_write;
386
0c0ff093 387 pde = create_proc_read_entry("Experimental", 0, proc_fs_cifs,
1da177e4
LT
388 quotaEnabled_read, NULL);
389 if (pde)
390 pde->write_proc = quotaEnabled_write;
391
392 pde = create_proc_read_entry("LinuxExtensionsEnabled", 0, proc_fs_cifs,
393 linuxExtensionsEnabled_read, NULL);
394 if (pde)
395 pde->write_proc = linuxExtensionsEnabled_write;
396
397 pde =
398 create_proc_read_entry("MultiuserMount", 0, proc_fs_cifs,
399 multiuser_mount_read, NULL);
400 if (pde)
401 pde->write_proc = multiuser_mount_write;
402
403 pde =
404 create_proc_read_entry("ExtendedSecurity", 0, proc_fs_cifs,
405 extended_security_read, NULL);
406 if (pde)
407 pde->write_proc = extended_security_write;
408
409 pde =
410 create_proc_read_entry("LookupCacheEnabled", 0, proc_fs_cifs,
411 lookupFlag_read, NULL);
412 if (pde)
413 pde->write_proc = lookupFlag_write;
414
415 pde =
416 create_proc_read_entry("NTLMV2Enabled", 0, proc_fs_cifs,
417 ntlmv2_enabled_read, NULL);
418 if (pde)
419 pde->write_proc = ntlmv2_enabled_write;
420
421 pde =
422 create_proc_read_entry("PacketSigningEnabled", 0, proc_fs_cifs,
423 packet_signing_enabled_read, NULL);
424 if (pde)
425 pde->write_proc = packet_signing_enabled_write;
426}
427
428void
429cifs_proc_clean(void)
430{
431 if (proc_fs_cifs == NULL)
432 return;
433
434 remove_proc_entry("DebugData", proc_fs_cifs);
435 remove_proc_entry("cifsFYI", proc_fs_cifs);
436 remove_proc_entry("traceSMB", proc_fs_cifs);
437#ifdef CONFIG_CIFS_STATS
438 remove_proc_entry("Stats", proc_fs_cifs);
439#endif
440 remove_proc_entry("MultiuserMount", proc_fs_cifs);
441 remove_proc_entry("OplockEnabled", proc_fs_cifs);
442 remove_proc_entry("NTLMV2Enabled",proc_fs_cifs);
443 remove_proc_entry("ExtendedSecurity",proc_fs_cifs);
444 remove_proc_entry("PacketSigningEnabled",proc_fs_cifs);
445 remove_proc_entry("LinuxExtensionsEnabled",proc_fs_cifs);
0c0ff093 446 remove_proc_entry("Experimental",proc_fs_cifs);
1da177e4
LT
447 remove_proc_entry("LookupCacheEnabled",proc_fs_cifs);
448 remove_proc_entry("cifs", proc_root_fs);
449}
450
451static int
452cifsFYI_read(char *page, char **start, off_t off, int count,
453 int *eof, void *data)
454{
455 int len;
456
457 len = sprintf(page, "%d\n", cifsFYI);
458
459 len -= off;
460 *start = page + off;
461
462 if (len > count)
463 len = count;
464 else
465 *eof = 1;
466
467 if (len < 0)
468 len = 0;
469
470 return len;
471}
472static int
473cifsFYI_write(struct file *file, const char __user *buffer,
474 unsigned long count, void *data)
475{
476 char c;
477 int rc;
478
479 rc = get_user(c, buffer);
480 if (rc)
481 return rc;
482 if (c == '0' || c == 'n' || c == 'N')
483 cifsFYI = 0;
484 else if (c == '1' || c == 'y' || c == 'Y')
485 cifsFYI = 1;
486
487 return count;
488}
489
490static int
491oplockEnabled_read(char *page, char **start, off_t off,
492 int count, int *eof, void *data)
493{
494 int len;
495
496 len = sprintf(page, "%d\n", oplockEnabled);
497
498 len -= off;
499 *start = page + off;
500
501 if (len > count)
502 len = count;
503 else
504 *eof = 1;
505
506 if (len < 0)
507 len = 0;
508
509 return len;
510}
511static int
512oplockEnabled_write(struct file *file, const char __user *buffer,
513 unsigned long count, void *data)
514{
515 char c;
516 int rc;
517
518 rc = get_user(c, buffer);
519 if (rc)
520 return rc;
521 if (c == '0' || c == 'n' || c == 'N')
522 oplockEnabled = 0;
523 else if (c == '1' || c == 'y' || c == 'Y')
524 oplockEnabled = 1;
525
526 return count;
527}
528
529static int
530quotaEnabled_read(char *page, char **start, off_t off,
531 int count, int *eof, void *data)
532{
533 int len;
534
535 len = sprintf(page, "%d\n", experimEnabled);
536/* could also check if quotas are enabled in kernel
537 as a whole first */
538 len -= off;
539 *start = page + off;
540
541 if (len > count)
542 len = count;
543 else
544 *eof = 1;
545
546 if (len < 0)
547 len = 0;
548
549 return len;
550}
551static int
552quotaEnabled_write(struct file *file, const char __user *buffer,
553 unsigned long count, void *data)
554{
555 char c;
556 int rc;
557
558 rc = get_user(c, buffer);
559 if (rc)
560 return rc;
561 if (c == '0' || c == 'n' || c == 'N')
562 experimEnabled = 0;
563 else if (c == '1' || c == 'y' || c == 'Y')
564 experimEnabled = 1;
565
566 return count;
567}
568
569static int
570linuxExtensionsEnabled_read(char *page, char **start, off_t off,
571 int count, int *eof, void *data)
572{
573 int len;
574
575 len = sprintf(page, "%d\n", linuxExtEnabled);
576/* could also check if quotas are enabled in kernel
577 as a whole first */
578 len -= off;
579 *start = page + off;
580
581 if (len > count)
582 len = count;
583 else
584 *eof = 1;
585
586 if (len < 0)
587 len = 0;
588
589 return len;
590}
591static int
592linuxExtensionsEnabled_write(struct file *file, const char __user *buffer,
593 unsigned long count, void *data)
594{
595 char c;
596 int rc;
597
598 rc = get_user(c, buffer);
599 if (rc)
600 return rc;
601 if (c == '0' || c == 'n' || c == 'N')
602 linuxExtEnabled = 0;
603 else if (c == '1' || c == 'y' || c == 'Y')
604 linuxExtEnabled = 1;
605
606 return count;
607}
608
609
610static int
611lookupFlag_read(char *page, char **start, off_t off,
612 int count, int *eof, void *data)
613{
614 int len;
615
616 len = sprintf(page, "%d\n", lookupCacheEnabled);
617
618 len -= off;
619 *start = page + off;
620
621 if (len > count)
622 len = count;
623 else
624 *eof = 1;
625
626 if (len < 0)
627 len = 0;
628
629 return len;
630}
631static int
632lookupFlag_write(struct file *file, const char __user *buffer,
633 unsigned long count, void *data)
634{
635 char c;
636 int rc;
637
638 rc = get_user(c, buffer);
639 if (rc)
640 return rc;
641 if (c == '0' || c == 'n' || c == 'N')
642 lookupCacheEnabled = 0;
643 else if (c == '1' || c == 'y' || c == 'Y')
644 lookupCacheEnabled = 1;
645
646 return count;
647}
648static int
649traceSMB_read(char *page, char **start, off_t off, int count,
650 int *eof, void *data)
651{
652 int len;
653
654 len = sprintf(page, "%d\n", traceSMB);
655
656 len -= off;
657 *start = page + off;
658
659 if (len > count)
660 len = count;
661 else
662 *eof = 1;
663
664 if (len < 0)
665 len = 0;
666
667 return len;
668}
669static int
670traceSMB_write(struct file *file, const char __user *buffer,
671 unsigned long count, void *data)
672{
673 char c;
674 int rc;
675
676 rc = get_user(c, buffer);
677 if (rc)
678 return rc;
679 if (c == '0' || c == 'n' || c == 'N')
680 traceSMB = 0;
681 else if (c == '1' || c == 'y' || c == 'Y')
682 traceSMB = 1;
683
684 return count;
685}
686
687static int
688multiuser_mount_read(char *page, char **start, off_t off,
689 int count, int *eof, void *data)
690{
691 int len;
692
693 len = sprintf(page, "%d\n", multiuser_mount);
694
695 len -= off;
696 *start = page + off;
697
698 if (len > count)
699 len = count;
700 else
701 *eof = 1;
702
703 if (len < 0)
704 len = 0;
705
706 return len;
707}
708static int
709multiuser_mount_write(struct file *file, const char __user *buffer,
710 unsigned long count, void *data)
711{
712 char c;
713 int rc;
714
715 rc = get_user(c, buffer);
716 if (rc)
717 return rc;
718 if (c == '0' || c == 'n' || c == 'N')
719 multiuser_mount = 0;
720 else if (c == '1' || c == 'y' || c == 'Y')
721 multiuser_mount = 1;
722
723 return count;
724}
725
726static int
727extended_security_read(char *page, char **start, off_t off,
728 int count, int *eof, void *data)
729{
730 int len;
731
732 len = sprintf(page, "%d\n", extended_security);
733
734 len -= off;
735 *start = page + off;
736
737 if (len > count)
738 len = count;
739 else
740 *eof = 1;
741
742 if (len < 0)
743 len = 0;
744
745 return len;
746}
747static int
748extended_security_write(struct file *file, const char __user *buffer,
749 unsigned long count, void *data)
750{
751 char c;
752 int rc;
753
754 rc = get_user(c, buffer);
755 if (rc)
756 return rc;
757 if (c == '0' || c == 'n' || c == 'N')
758 extended_security = 0;
759 else if (c == '1' || c == 'y' || c == 'Y')
760 extended_security = 1;
761
762 return count;
763}
764
765static int
766ntlmv2_enabled_read(char *page, char **start, off_t off,
767 int count, int *eof, void *data)
768{
769 int len;
770
771 len = sprintf(page, "%d\n", ntlmv2_support);
772
773 len -= off;
774 *start = page + off;
775
776 if (len > count)
777 len = count;
778 else
779 *eof = 1;
780
781 if (len < 0)
782 len = 0;
783
784 return len;
785}
786static int
787ntlmv2_enabled_write(struct file *file, const char __user *buffer,
788 unsigned long count, void *data)
789{
790 char c;
791 int rc;
792
793 rc = get_user(c, buffer);
794 if (rc)
795 return rc;
796 if (c == '0' || c == 'n' || c == 'N')
797 ntlmv2_support = 0;
798 else if (c == '1' || c == 'y' || c == 'Y')
799 ntlmv2_support = 1;
800
801 return count;
802}
803
804static int
805packet_signing_enabled_read(char *page, char **start, off_t off,
806 int count, int *eof, void *data)
807{
808 int len;
809
810 len = sprintf(page, "%d\n", sign_CIFS_PDUs);
811
812 len -= off;
813 *start = page + off;
814
815 if (len > count)
816 len = count;
817 else
818 *eof = 1;
819
820 if (len < 0)
821 len = 0;
822
823 return len;
824}
825static int
826packet_signing_enabled_write(struct file *file, const char __user *buffer,
827 unsigned long count, void *data)
828{
829 char c;
830 int rc;
831
832 rc = get_user(c, buffer);
833 if (rc)
834 return rc;
835 if (c == '0' || c == 'n' || c == 'N')
836 sign_CIFS_PDUs = 0;
837 else if (c == '1' || c == 'y' || c == 'Y')
838 sign_CIFS_PDUs = 1;
839 else if (c == '2')
840 sign_CIFS_PDUs = 2;
841
842 return count;
843}
844
845
846#endif