blob: 8381713280769679464e2609c035653e7111bc6d [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
2 * fs/cifs_debug.c
3 *
Steve Frenchb8643e12005-04-28 22:41:07 -07004 * Copyright (C) International Business Machines Corp., 2000,2005
Linus Torvalds1da177e2005-04-16 15:20:36 -07005 *
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"
Steve French6c91d362005-04-28 22:41:06 -070032#include "cifsfs.h"
Linus Torvalds1da177e2005-04-16 15:20:36 -070033
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;
Steve French6c91d362005-04-28 22:41:06 -070082 length = sprintf(buf,"CIFS Version %s\n",CIFS_VERSION);
83 buf += length;
84 length = sprintf(buf, "Servers:");
Linus Torvalds1da177e2005-04-16 15:20:36 -070085 buf += length;
86
87 i = 0;
88 read_lock(&GlobalSMBSeslock);
89 list_for_each(tmp, &GlobalSMBSessionList) {
90 i++;
91 ses = list_entry(tmp, struct cifsSesInfo, cifsSessionList);
Steve French433dc242005-04-28 22:41:08 -070092 if((ses->serverDomain == NULL) || (ses->serverOS == NULL) ||
93 (ses->serverNOS == NULL)) {
94 buf += sprintf("\nentry for %s not fully displayed\n\t",
95 ses->serverName);
96
97 } else {
98 length =
99 sprintf(buf,
100 "\n%d) Name: %s Domain: %s Mounts: %d ServerOS: %s \n\tServerNOS: %s\tCapabilities: 0x%x\n\tSMB session status: %d\t",
Steve Frenchb8643e12005-04-28 22:41:07 -0700101 i, ses->serverName, ses->serverDomain,
102 atomic_read(&ses->inUse),
103 ses->serverOS, ses->serverNOS,
104 ses->capabilities,ses->status);
Steve French433dc242005-04-28 22:41:08 -0700105 buf += length;
106 }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700107 if(ses->server) {
108 buf += sprintf(buf, "TCP status: %d\n\tLocal Users To Server: %d SecMode: 0x%x Req Active: %d",
109 ses->server->tcpStatus,
110 atomic_read(&ses->server->socketUseCount),
111 ses->server->secMode,
112 atomic_read(&ses->server->inFlight));
113
Steve French6c91d362005-04-28 22:41:06 -0700114 length = sprintf(buf, "\nMIDs:\n");
Linus Torvalds1da177e2005-04-16 15:20:36 -0700115 buf += length;
116
117 spin_lock(&GlobalMid_Lock);
118 list_for_each(tmp1, &ses->server->pending_mid_q) {
119 mid_entry = list_entry(tmp1, struct
120 mid_q_entry,
121 qhead);
122 if(mid_entry) {
Steve French848f3fc2005-04-28 22:41:07 -0700123 length = sprintf(buf,"State: %d com: %d pid: %d tsk: %p mid %d\n",
124 mid_entry->midState,
125 (int)mid_entry->command,
126 mid_entry->pid,
127 mid_entry->tsk,
128 mid_entry->mid);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700129 buf += length;
130 }
131 }
132 spin_unlock(&GlobalMid_Lock);
133 }
134
135 }
136 read_unlock(&GlobalSMBSeslock);
137 sprintf(buf, "\n");
138 buf++;
139
Steve French6c91d362005-04-28 22:41:06 -0700140 length = sprintf(buf, "Shares:");
Linus Torvalds1da177e2005-04-16 15:20:36 -0700141 buf += length;
142
143 i = 0;
144 read_lock(&GlobalSMBSeslock);
145 list_for_each(tmp, &GlobalTreeConnectionList) {
146 __u32 dev_type;
147 i++;
148 tcon = list_entry(tmp, struct cifsTconInfo, cifsConnectionList);
149 dev_type = le32_to_cpu(tcon->fsDevInfo.DeviceType);
150 length =
151 sprintf(buf,
152 "\n%d) %s Uses: %d Type: %s Characteristics: 0x%x Attributes: 0x%x\nPathComponentMax: %d Status: %d",
153 i, tcon->treeName,
154 atomic_read(&tcon->useCount),
155 tcon->nativeFileSystem,
156 le32_to_cpu(tcon->fsDevInfo.DeviceCharacteristics),
157 le32_to_cpu(tcon->fsAttrInfo.Attributes),
158 le32_to_cpu(tcon->fsAttrInfo.MaxPathNameComponentLength),
159 tcon->tidStatus);
160 buf += length;
161 if (dev_type == FILE_DEVICE_DISK)
162 length = sprintf(buf, " type: DISK ");
163 else if (dev_type == FILE_DEVICE_CD_ROM)
164 length = sprintf(buf, " type: CDROM ");
165 else
166 length =
167 sprintf(buf, " type: %d ", dev_type);
168 buf += length;
169 if(tcon->tidStatus == CifsNeedReconnect) {
170 buf += sprintf(buf, "\tDISCONNECTED ");
171 length += 14;
172 }
173 }
174 read_unlock(&GlobalSMBSeslock);
175
176 length = sprintf(buf, "\n");
177 buf += length;
178
179 /* BB add code to dump additional info such as TCP session info now */
180 /* Now calculate total size of returned data */
181 length = buf - original_buf;
182
183 if(offset + count >= length)
184 *eof = 1;
185 if(length < offset) {
186 *eof = 1;
187 return 0;
188 } else {
189 length = length - offset;
190 }
191 if (length > count)
192 length = count;
193
194 return length;
195}
196
197#ifdef CONFIG_CIFS_STATS
198static int
199cifs_stats_read(char *buf, char **beginBuffer, off_t offset,
200 int count, int *eof, void *data)
201{
202 int item_length,i,length;
203 struct list_head *tmp;
204 struct cifsTconInfo *tcon;
205
206 *beginBuffer = buf + offset;
207
208 length = sprintf(buf,
209 "Resources in use\nCIFS Session: %d\n",
210 sesInfoAllocCount.counter);
211 buf += length;
212 item_length =
213 sprintf(buf,"Share (unique mount targets): %d\n",
214 tconInfoAllocCount.counter);
215 length += item_length;
216 buf += item_length;
217 item_length =
218 sprintf(buf,"SMB Request/Response Buffer: %d Pool size: %d\n",
Steve Frenchb8643e12005-04-28 22:41:07 -0700219 bufAllocCount.counter,
220 cifs_min_rcv + tcpSesAllocCount.counter);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700221 length += item_length;
222 buf += item_length;
223 item_length =
224 sprintf(buf,"SMB Small Req/Resp Buffer: %d Pool size: %d\n",
225 smBufAllocCount.counter,cifs_min_small);
226 length += item_length;
227 buf += item_length;
228 item_length =
229 sprintf(buf,"Operations (MIDs): %d\n",
230 midCount.counter);
231 length += item_length;
232 buf += item_length;
233 item_length = sprintf(buf,
234 "\n%d session %d share reconnects\n",
235 tcpSesReconnectCount.counter,tconInfoReconnectCount.counter);
236 length += item_length;
237 buf += item_length;
238
239 item_length = sprintf(buf,
240 "Total vfs operations: %d maximum at one time: %d\n",
241 GlobalCurrentXid,GlobalMaxActiveXid);
242 length += item_length;
243 buf += item_length;
244
245 i = 0;
246 read_lock(&GlobalSMBSeslock);
247 list_for_each(tmp, &GlobalTreeConnectionList) {
248 i++;
249 tcon = list_entry(tmp, struct cifsTconInfo, cifsConnectionList);
250 item_length = sprintf(buf,"\n%d) %s",i, tcon->treeName);
251 buf += item_length;
252 length += item_length;
253 if(tcon->tidStatus == CifsNeedReconnect) {
254 buf += sprintf(buf, "\tDISCONNECTED ");
255 length += 14;
256 }
257 item_length = sprintf(buf,"\nSMBs: %d Oplock Breaks: %d",
258 atomic_read(&tcon->num_smbs_sent),
259 atomic_read(&tcon->num_oplock_brks));
260 buf += item_length;
261 length += item_length;
262 item_length = sprintf(buf,"\nReads: %d Bytes %lld",
263 atomic_read(&tcon->num_reads),
264 (long long)(tcon->bytes_read));
265 buf += item_length;
266 length += item_length;
267 item_length = sprintf(buf,"\nWrites: %d Bytes: %lld",
268 atomic_read(&tcon->num_writes),
269 (long long)(tcon->bytes_written));
270 buf += item_length;
271 length += item_length;
272 item_length = sprintf(buf,
273 "\nOpens: %d Deletes: %d\nMkdirs: %d Rmdirs: %d",
274 atomic_read(&tcon->num_opens),
275 atomic_read(&tcon->num_deletes),
276 atomic_read(&tcon->num_mkdirs),
277 atomic_read(&tcon->num_rmdirs));
278 buf += item_length;
279 length += item_length;
280 item_length = sprintf(buf,
281 "\nRenames: %d T2 Renames %d",
282 atomic_read(&tcon->num_renames),
283 atomic_read(&tcon->num_t2renames));
284 buf += item_length;
285 length += item_length;
Steve French0c0ff092005-06-23 19:31:17 -0500286 item_length = sprintf(buf,"\nFindFirst: %d FNext %d FClose %d",
287 atomic_read(&tcon->num_ffirst),
288 atomic_read(&tcon->num_fnext),
289 atomic_read(&tcon->num_fclose));
290 buf += item_length;
291 length += item_length;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700292 }
293 read_unlock(&GlobalSMBSeslock);
294
295 buf += sprintf(buf,"\n");
296 length++;
297
298 if(offset + count >= length)
299 *eof = 1;
300 if(length < offset) {
301 *eof = 1;
302 return 0;
303 } else {
304 length = length - offset;
305 }
306 if (length > count)
307 length = count;
308
309 return length;
310}
311#endif
312
313static struct proc_dir_entry *proc_fs_cifs;
314read_proc_t cifs_txanchor_read;
315static read_proc_t cifsFYI_read;
316static write_proc_t cifsFYI_write;
317static read_proc_t oplockEnabled_read;
318static write_proc_t oplockEnabled_write;
319static read_proc_t lookupFlag_read;
320static write_proc_t lookupFlag_write;
321static read_proc_t traceSMB_read;
322static write_proc_t traceSMB_write;
323static read_proc_t multiuser_mount_read;
324static write_proc_t multiuser_mount_write;
325static read_proc_t extended_security_read;
326static write_proc_t extended_security_write;
327static read_proc_t ntlmv2_enabled_read;
328static write_proc_t ntlmv2_enabled_write;
329static read_proc_t packet_signing_enabled_read;
330static write_proc_t packet_signing_enabled_write;
331static read_proc_t quotaEnabled_read;
332static write_proc_t quotaEnabled_write;
333static read_proc_t linuxExtensionsEnabled_read;
334static write_proc_t linuxExtensionsEnabled_write;
335
336void
337cifs_proc_init(void)
338{
339 struct proc_dir_entry *pde;
340
341 proc_fs_cifs = proc_mkdir("cifs", proc_root_fs);
342 if (proc_fs_cifs == NULL)
343 return;
344
345 proc_fs_cifs->owner = THIS_MODULE;
346 create_proc_read_entry("DebugData", 0, proc_fs_cifs,
347 cifs_debug_data_read, NULL);
348
349#ifdef CONFIG_CIFS_STATS
350 create_proc_read_entry("Stats", 0, proc_fs_cifs,
351 cifs_stats_read, NULL);
352#endif
353 pde = create_proc_read_entry("cifsFYI", 0, proc_fs_cifs,
354 cifsFYI_read, NULL);
355 if (pde)
356 pde->write_proc = cifsFYI_write;
357
358 pde =
359 create_proc_read_entry("traceSMB", 0, proc_fs_cifs,
360 traceSMB_read, NULL);
361 if (pde)
362 pde->write_proc = traceSMB_write;
363
364 pde = create_proc_read_entry("OplockEnabled", 0, proc_fs_cifs,
365 oplockEnabled_read, NULL);
366 if (pde)
367 pde->write_proc = oplockEnabled_write;
368
Steve French0c0ff092005-06-23 19:31:17 -0500369 pde = create_proc_read_entry("Experimental", 0, proc_fs_cifs,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700370 quotaEnabled_read, NULL);
371 if (pde)
372 pde->write_proc = quotaEnabled_write;
373
374 pde = create_proc_read_entry("LinuxExtensionsEnabled", 0, proc_fs_cifs,
375 linuxExtensionsEnabled_read, NULL);
376 if (pde)
377 pde->write_proc = linuxExtensionsEnabled_write;
378
379 pde =
380 create_proc_read_entry("MultiuserMount", 0, proc_fs_cifs,
381 multiuser_mount_read, NULL);
382 if (pde)
383 pde->write_proc = multiuser_mount_write;
384
385 pde =
386 create_proc_read_entry("ExtendedSecurity", 0, proc_fs_cifs,
387 extended_security_read, NULL);
388 if (pde)
389 pde->write_proc = extended_security_write;
390
391 pde =
392 create_proc_read_entry("LookupCacheEnabled", 0, proc_fs_cifs,
393 lookupFlag_read, NULL);
394 if (pde)
395 pde->write_proc = lookupFlag_write;
396
397 pde =
398 create_proc_read_entry("NTLMV2Enabled", 0, proc_fs_cifs,
399 ntlmv2_enabled_read, NULL);
400 if (pde)
401 pde->write_proc = ntlmv2_enabled_write;
402
403 pde =
404 create_proc_read_entry("PacketSigningEnabled", 0, proc_fs_cifs,
405 packet_signing_enabled_read, NULL);
406 if (pde)
407 pde->write_proc = packet_signing_enabled_write;
408}
409
410void
411cifs_proc_clean(void)
412{
413 if (proc_fs_cifs == NULL)
414 return;
415
416 remove_proc_entry("DebugData", proc_fs_cifs);
417 remove_proc_entry("cifsFYI", proc_fs_cifs);
418 remove_proc_entry("traceSMB", proc_fs_cifs);
419#ifdef CONFIG_CIFS_STATS
420 remove_proc_entry("Stats", proc_fs_cifs);
421#endif
422 remove_proc_entry("MultiuserMount", proc_fs_cifs);
423 remove_proc_entry("OplockEnabled", proc_fs_cifs);
424 remove_proc_entry("NTLMV2Enabled",proc_fs_cifs);
425 remove_proc_entry("ExtendedSecurity",proc_fs_cifs);
426 remove_proc_entry("PacketSigningEnabled",proc_fs_cifs);
427 remove_proc_entry("LinuxExtensionsEnabled",proc_fs_cifs);
Steve French0c0ff092005-06-23 19:31:17 -0500428 remove_proc_entry("Experimental",proc_fs_cifs);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700429 remove_proc_entry("LookupCacheEnabled",proc_fs_cifs);
430 remove_proc_entry("cifs", proc_root_fs);
431}
432
433static int
434cifsFYI_read(char *page, char **start, off_t off, int count,
435 int *eof, void *data)
436{
437 int len;
438
439 len = sprintf(page, "%d\n", cifsFYI);
440
441 len -= off;
442 *start = page + off;
443
444 if (len > count)
445 len = count;
446 else
447 *eof = 1;
448
449 if (len < 0)
450 len = 0;
451
452 return len;
453}
454static int
455cifsFYI_write(struct file *file, const char __user *buffer,
456 unsigned long count, void *data)
457{
458 char c;
459 int rc;
460
461 rc = get_user(c, buffer);
462 if (rc)
463 return rc;
464 if (c == '0' || c == 'n' || c == 'N')
465 cifsFYI = 0;
466 else if (c == '1' || c == 'y' || c == 'Y')
467 cifsFYI = 1;
468
469 return count;
470}
471
472static int
473oplockEnabled_read(char *page, char **start, off_t off,
474 int count, int *eof, void *data)
475{
476 int len;
477
478 len = sprintf(page, "%d\n", oplockEnabled);
479
480 len -= off;
481 *start = page + off;
482
483 if (len > count)
484 len = count;
485 else
486 *eof = 1;
487
488 if (len < 0)
489 len = 0;
490
491 return len;
492}
493static int
494oplockEnabled_write(struct file *file, const char __user *buffer,
495 unsigned long count, void *data)
496{
497 char c;
498 int rc;
499
500 rc = get_user(c, buffer);
501 if (rc)
502 return rc;
503 if (c == '0' || c == 'n' || c == 'N')
504 oplockEnabled = 0;
505 else if (c == '1' || c == 'y' || c == 'Y')
506 oplockEnabled = 1;
507
508 return count;
509}
510
511static int
512quotaEnabled_read(char *page, char **start, off_t off,
513 int count, int *eof, void *data)
514{
515 int len;
516
517 len = sprintf(page, "%d\n", experimEnabled);
518/* could also check if quotas are enabled in kernel
519 as a whole first */
520 len -= off;
521 *start = page + off;
522
523 if (len > count)
524 len = count;
525 else
526 *eof = 1;
527
528 if (len < 0)
529 len = 0;
530
531 return len;
532}
533static int
534quotaEnabled_write(struct file *file, const char __user *buffer,
535 unsigned long count, void *data)
536{
537 char c;
538 int rc;
539
540 rc = get_user(c, buffer);
541 if (rc)
542 return rc;
543 if (c == '0' || c == 'n' || c == 'N')
544 experimEnabled = 0;
545 else if (c == '1' || c == 'y' || c == 'Y')
546 experimEnabled = 1;
547
548 return count;
549}
550
551static int
552linuxExtensionsEnabled_read(char *page, char **start, off_t off,
553 int count, int *eof, void *data)
554{
555 int len;
556
557 len = sprintf(page, "%d\n", linuxExtEnabled);
558/* could also check if quotas are enabled in kernel
559 as a whole first */
560 len -= off;
561 *start = page + off;
562
563 if (len > count)
564 len = count;
565 else
566 *eof = 1;
567
568 if (len < 0)
569 len = 0;
570
571 return len;
572}
573static int
574linuxExtensionsEnabled_write(struct file *file, const char __user *buffer,
575 unsigned long count, void *data)
576{
577 char c;
578 int rc;
579
580 rc = get_user(c, buffer);
581 if (rc)
582 return rc;
583 if (c == '0' || c == 'n' || c == 'N')
584 linuxExtEnabled = 0;
585 else if (c == '1' || c == 'y' || c == 'Y')
586 linuxExtEnabled = 1;
587
588 return count;
589}
590
591
592static int
593lookupFlag_read(char *page, char **start, off_t off,
594 int count, int *eof, void *data)
595{
596 int len;
597
598 len = sprintf(page, "%d\n", lookupCacheEnabled);
599
600 len -= off;
601 *start = page + off;
602
603 if (len > count)
604 len = count;
605 else
606 *eof = 1;
607
608 if (len < 0)
609 len = 0;
610
611 return len;
612}
613static int
614lookupFlag_write(struct file *file, const char __user *buffer,
615 unsigned long count, void *data)
616{
617 char c;
618 int rc;
619
620 rc = get_user(c, buffer);
621 if (rc)
622 return rc;
623 if (c == '0' || c == 'n' || c == 'N')
624 lookupCacheEnabled = 0;
625 else if (c == '1' || c == 'y' || c == 'Y')
626 lookupCacheEnabled = 1;
627
628 return count;
629}
630static int
631traceSMB_read(char *page, char **start, off_t off, int count,
632 int *eof, void *data)
633{
634 int len;
635
636 len = sprintf(page, "%d\n", traceSMB);
637
638 len -= off;
639 *start = page + off;
640
641 if (len > count)
642 len = count;
643 else
644 *eof = 1;
645
646 if (len < 0)
647 len = 0;
648
649 return len;
650}
651static int
652traceSMB_write(struct file *file, const char __user *buffer,
653 unsigned long count, void *data)
654{
655 char c;
656 int rc;
657
658 rc = get_user(c, buffer);
659 if (rc)
660 return rc;
661 if (c == '0' || c == 'n' || c == 'N')
662 traceSMB = 0;
663 else if (c == '1' || c == 'y' || c == 'Y')
664 traceSMB = 1;
665
666 return count;
667}
668
669static int
670multiuser_mount_read(char *page, char **start, off_t off,
671 int count, int *eof, void *data)
672{
673 int len;
674
675 len = sprintf(page, "%d\n", multiuser_mount);
676
677 len -= off;
678 *start = page + off;
679
680 if (len > count)
681 len = count;
682 else
683 *eof = 1;
684
685 if (len < 0)
686 len = 0;
687
688 return len;
689}
690static int
691multiuser_mount_write(struct file *file, const char __user *buffer,
692 unsigned long count, void *data)
693{
694 char c;
695 int rc;
696
697 rc = get_user(c, buffer);
698 if (rc)
699 return rc;
700 if (c == '0' || c == 'n' || c == 'N')
701 multiuser_mount = 0;
702 else if (c == '1' || c == 'y' || c == 'Y')
703 multiuser_mount = 1;
704
705 return count;
706}
707
708static int
709extended_security_read(char *page, char **start, off_t off,
710 int count, int *eof, void *data)
711{
712 int len;
713
714 len = sprintf(page, "%d\n", extended_security);
715
716 len -= off;
717 *start = page + off;
718
719 if (len > count)
720 len = count;
721 else
722 *eof = 1;
723
724 if (len < 0)
725 len = 0;
726
727 return len;
728}
729static int
730extended_security_write(struct file *file, const char __user *buffer,
731 unsigned long count, void *data)
732{
733 char c;
734 int rc;
735
736 rc = get_user(c, buffer);
737 if (rc)
738 return rc;
739 if (c == '0' || c == 'n' || c == 'N')
740 extended_security = 0;
741 else if (c == '1' || c == 'y' || c == 'Y')
742 extended_security = 1;
743
744 return count;
745}
746
747static int
748ntlmv2_enabled_read(char *page, char **start, off_t off,
749 int count, int *eof, void *data)
750{
751 int len;
752
753 len = sprintf(page, "%d\n", ntlmv2_support);
754
755 len -= off;
756 *start = page + off;
757
758 if (len > count)
759 len = count;
760 else
761 *eof = 1;
762
763 if (len < 0)
764 len = 0;
765
766 return len;
767}
768static int
769ntlmv2_enabled_write(struct file *file, const char __user *buffer,
770 unsigned long count, void *data)
771{
772 char c;
773 int rc;
774
775 rc = get_user(c, buffer);
776 if (rc)
777 return rc;
778 if (c == '0' || c == 'n' || c == 'N')
779 ntlmv2_support = 0;
780 else if (c == '1' || c == 'y' || c == 'Y')
781 ntlmv2_support = 1;
782
783 return count;
784}
785
786static int
787packet_signing_enabled_read(char *page, char **start, off_t off,
788 int count, int *eof, void *data)
789{
790 int len;
791
792 len = sprintf(page, "%d\n", sign_CIFS_PDUs);
793
794 len -= off;
795 *start = page + off;
796
797 if (len > count)
798 len = count;
799 else
800 *eof = 1;
801
802 if (len < 0)
803 len = 0;
804
805 return len;
806}
807static int
808packet_signing_enabled_write(struct file *file, const char __user *buffer,
809 unsigned long count, void *data)
810{
811 char c;
812 int rc;
813
814 rc = get_user(c, buffer);
815 if (rc)
816 return rc;
817 if (c == '0' || c == 'n' || c == 'N')
818 sign_CIFS_PDUs = 0;
819 else if (c == '1' || c == 'y' || c == 'Y')
820 sign_CIFS_PDUs = 1;
821 else if (c == '2')
822 sign_CIFS_PDUs = 2;
823
824 return count;
825}
826
827
828#endif