[CIFS] cleanup sparse and compile errors in previous fix
[deliverable/linux.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;
84 length = sprintf(buf, "Servers:");
1da177e4
LT
85 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);
433dc24f
SF
92 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",
b8643e1b
SF
101 i, ses->serverName, ses->serverDomain,
102 atomic_read(&ses->inUse),
103 ses->serverOS, ses->serverNOS,
104 ses->capabilities,ses->status);
433dc24f
SF
105 buf += length;
106 }
1da177e4
LT
107 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
6c91d362 114 length = sprintf(buf, "\nMIDs:\n");
1da177e4
LT
115 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) {
848f3fce
SF
123 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);
1da177e4
LT
129 buf += length;
130 }
131 }
132 spin_unlock(&GlobalMid_Lock);
133 }
134
135 }
136 read_unlock(&GlobalSMBSeslock);
137 sprintf(buf, "\n");
138 buf++;
139
6c91d362 140 length = sprintf(buf, "Shares:");
1da177e4
LT
141 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",
b8643e1b
SF
219 bufAllocCount.counter,
220 cifs_min_rcv + tcpSesAllocCount.counter);
1da177e4
LT
221 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 }
a5a2b489 257 item_length = sprintf(buf, "\nSMBs: %d Oplock Breaks: %d",
1da177e4
LT
258 atomic_read(&tcon->num_smbs_sent),
259 atomic_read(&tcon->num_oplock_brks));
260 buf += item_length;
261 length += item_length;
a5a2b489 262 item_length = sprintf(buf, "\nReads: %d Bytes %lld",
1da177e4
LT
263 atomic_read(&tcon->num_reads),
264 (long long)(tcon->bytes_read));
265 buf += item_length;
266 length += item_length;
a5a2b489 267 item_length = sprintf(buf, "\nWrites: %d Bytes: %lld",
1da177e4
LT
268 atomic_read(&tcon->num_writes),
269 (long long)(tcon->bytes_written));
a5a2b489
SF
270 buf += item_length;
271 length += item_length;
272 item_length = sprintf(buf,
273 "\nLocks: %d HardLinks: %d Symlinks: %d",
274 atomic_read(&tcon->num_locks),
275 atomic_read(&tcon->num_hardlinks),
276 atomic_read(&tcon->num_symlinks));
277 buf += item_length;
278 length += item_length;
279
280 item_length = sprintf(buf, "\nOpens: %d Closes: %d Deletes: %d",
281 atomic_read(&tcon->num_opens),
282 atomic_read(&tcon->num_closes),
283 atomic_read(&tcon->num_deletes));
1da177e4
LT
284 buf += item_length;
285 length += item_length;
a5a2b489 286 item_length = sprintf(buf, "\nMkdirs: %d Rmdirs: %d",
1da177e4
LT
287 atomic_read(&tcon->num_mkdirs),
288 atomic_read(&tcon->num_rmdirs));
289 buf += item_length;
290 length += item_length;
a5a2b489 291 item_length = sprintf(buf, "\nRenames: %d T2 Renames %d",
1da177e4
LT
292 atomic_read(&tcon->num_renames),
293 atomic_read(&tcon->num_t2renames));
294 buf += item_length;
295 length += item_length;
a5a2b489 296 item_length = sprintf(buf, "\nFindFirst: %d FNext %d FClose %d",
0c0ff093
SF
297 atomic_read(&tcon->num_ffirst),
298 atomic_read(&tcon->num_fnext),
299 atomic_read(&tcon->num_fclose));
300 buf += item_length;
301 length += item_length;
1da177e4
LT
302 }
303 read_unlock(&GlobalSMBSeslock);
304
305 buf += sprintf(buf,"\n");
306 length++;
307
308 if(offset + count >= length)
309 *eof = 1;
310 if(length < offset) {
311 *eof = 1;
312 return 0;
313 } else {
314 length = length - offset;
315 }
316 if (length > count)
317 length = count;
318
319 return length;
320}
321#endif
322
323static struct proc_dir_entry *proc_fs_cifs;
324read_proc_t cifs_txanchor_read;
325static read_proc_t cifsFYI_read;
326static write_proc_t cifsFYI_write;
327static read_proc_t oplockEnabled_read;
328static write_proc_t oplockEnabled_write;
329static read_proc_t lookupFlag_read;
330static write_proc_t lookupFlag_write;
331static read_proc_t traceSMB_read;
332static write_proc_t traceSMB_write;
333static read_proc_t multiuser_mount_read;
334static write_proc_t multiuser_mount_write;
335static read_proc_t extended_security_read;
336static write_proc_t extended_security_write;
337static read_proc_t ntlmv2_enabled_read;
338static write_proc_t ntlmv2_enabled_write;
339static read_proc_t packet_signing_enabled_read;
340static write_proc_t packet_signing_enabled_write;
341static read_proc_t quotaEnabled_read;
342static write_proc_t quotaEnabled_write;
343static read_proc_t linuxExtensionsEnabled_read;
344static write_proc_t linuxExtensionsEnabled_write;
345
346void
347cifs_proc_init(void)
348{
349 struct proc_dir_entry *pde;
350
351 proc_fs_cifs = proc_mkdir("cifs", proc_root_fs);
352 if (proc_fs_cifs == NULL)
353 return;
354
355 proc_fs_cifs->owner = THIS_MODULE;
356 create_proc_read_entry("DebugData", 0, proc_fs_cifs,
357 cifs_debug_data_read, NULL);
358
359#ifdef CONFIG_CIFS_STATS
360 create_proc_read_entry("Stats", 0, proc_fs_cifs,
361 cifs_stats_read, NULL);
362#endif
363 pde = create_proc_read_entry("cifsFYI", 0, proc_fs_cifs,
364 cifsFYI_read, NULL);
365 if (pde)
366 pde->write_proc = cifsFYI_write;
367
368 pde =
369 create_proc_read_entry("traceSMB", 0, proc_fs_cifs,
370 traceSMB_read, NULL);
371 if (pde)
372 pde->write_proc = traceSMB_write;
373
374 pde = create_proc_read_entry("OplockEnabled", 0, proc_fs_cifs,
375 oplockEnabled_read, NULL);
376 if (pde)
377 pde->write_proc = oplockEnabled_write;
378
0c0ff093 379 pde = create_proc_read_entry("Experimental", 0, proc_fs_cifs,
1da177e4
LT
380 quotaEnabled_read, NULL);
381 if (pde)
382 pde->write_proc = quotaEnabled_write;
383
384 pde = create_proc_read_entry("LinuxExtensionsEnabled", 0, proc_fs_cifs,
385 linuxExtensionsEnabled_read, NULL);
386 if (pde)
387 pde->write_proc = linuxExtensionsEnabled_write;
388
389 pde =
390 create_proc_read_entry("MultiuserMount", 0, proc_fs_cifs,
391 multiuser_mount_read, NULL);
392 if (pde)
393 pde->write_proc = multiuser_mount_write;
394
395 pde =
396 create_proc_read_entry("ExtendedSecurity", 0, proc_fs_cifs,
397 extended_security_read, NULL);
398 if (pde)
399 pde->write_proc = extended_security_write;
400
401 pde =
402 create_proc_read_entry("LookupCacheEnabled", 0, proc_fs_cifs,
403 lookupFlag_read, NULL);
404 if (pde)
405 pde->write_proc = lookupFlag_write;
406
407 pde =
408 create_proc_read_entry("NTLMV2Enabled", 0, proc_fs_cifs,
409 ntlmv2_enabled_read, NULL);
410 if (pde)
411 pde->write_proc = ntlmv2_enabled_write;
412
413 pde =
414 create_proc_read_entry("PacketSigningEnabled", 0, proc_fs_cifs,
415 packet_signing_enabled_read, NULL);
416 if (pde)
417 pde->write_proc = packet_signing_enabled_write;
418}
419
420void
421cifs_proc_clean(void)
422{
423 if (proc_fs_cifs == NULL)
424 return;
425
426 remove_proc_entry("DebugData", proc_fs_cifs);
427 remove_proc_entry("cifsFYI", proc_fs_cifs);
428 remove_proc_entry("traceSMB", proc_fs_cifs);
429#ifdef CONFIG_CIFS_STATS
430 remove_proc_entry("Stats", proc_fs_cifs);
431#endif
432 remove_proc_entry("MultiuserMount", proc_fs_cifs);
433 remove_proc_entry("OplockEnabled", proc_fs_cifs);
434 remove_proc_entry("NTLMV2Enabled",proc_fs_cifs);
435 remove_proc_entry("ExtendedSecurity",proc_fs_cifs);
436 remove_proc_entry("PacketSigningEnabled",proc_fs_cifs);
437 remove_proc_entry("LinuxExtensionsEnabled",proc_fs_cifs);
0c0ff093 438 remove_proc_entry("Experimental",proc_fs_cifs);
1da177e4
LT
439 remove_proc_entry("LookupCacheEnabled",proc_fs_cifs);
440 remove_proc_entry("cifs", proc_root_fs);
441}
442
443static int
444cifsFYI_read(char *page, char **start, off_t off, int count,
445 int *eof, void *data)
446{
447 int len;
448
449 len = sprintf(page, "%d\n", cifsFYI);
450
451 len -= off;
452 *start = page + off;
453
454 if (len > count)
455 len = count;
456 else
457 *eof = 1;
458
459 if (len < 0)
460 len = 0;
461
462 return len;
463}
464static int
465cifsFYI_write(struct file *file, const char __user *buffer,
466 unsigned long count, void *data)
467{
468 char c;
469 int rc;
470
471 rc = get_user(c, buffer);
472 if (rc)
473 return rc;
474 if (c == '0' || c == 'n' || c == 'N')
475 cifsFYI = 0;
476 else if (c == '1' || c == 'y' || c == 'Y')
477 cifsFYI = 1;
478
479 return count;
480}
481
482static int
483oplockEnabled_read(char *page, char **start, off_t off,
484 int count, int *eof, void *data)
485{
486 int len;
487
488 len = sprintf(page, "%d\n", oplockEnabled);
489
490 len -= off;
491 *start = page + off;
492
493 if (len > count)
494 len = count;
495 else
496 *eof = 1;
497
498 if (len < 0)
499 len = 0;
500
501 return len;
502}
503static int
504oplockEnabled_write(struct file *file, const char __user *buffer,
505 unsigned long count, void *data)
506{
507 char c;
508 int rc;
509
510 rc = get_user(c, buffer);
511 if (rc)
512 return rc;
513 if (c == '0' || c == 'n' || c == 'N')
514 oplockEnabled = 0;
515 else if (c == '1' || c == 'y' || c == 'Y')
516 oplockEnabled = 1;
517
518 return count;
519}
520
521static int
522quotaEnabled_read(char *page, char **start, off_t off,
523 int count, int *eof, void *data)
524{
525 int len;
526
527 len = sprintf(page, "%d\n", experimEnabled);
528/* could also check if quotas are enabled in kernel
529 as a whole first */
530 len -= off;
531 *start = page + off;
532
533 if (len > count)
534 len = count;
535 else
536 *eof = 1;
537
538 if (len < 0)
539 len = 0;
540
541 return len;
542}
543static int
544quotaEnabled_write(struct file *file, const char __user *buffer,
545 unsigned long count, void *data)
546{
547 char c;
548 int rc;
549
550 rc = get_user(c, buffer);
551 if (rc)
552 return rc;
553 if (c == '0' || c == 'n' || c == 'N')
554 experimEnabled = 0;
555 else if (c == '1' || c == 'y' || c == 'Y')
556 experimEnabled = 1;
557
558 return count;
559}
560
561static int
562linuxExtensionsEnabled_read(char *page, char **start, off_t off,
563 int count, int *eof, void *data)
564{
565 int len;
566
567 len = sprintf(page, "%d\n", linuxExtEnabled);
568/* could also check if quotas are enabled in kernel
569 as a whole first */
570 len -= off;
571 *start = page + off;
572
573 if (len > count)
574 len = count;
575 else
576 *eof = 1;
577
578 if (len < 0)
579 len = 0;
580
581 return len;
582}
583static int
584linuxExtensionsEnabled_write(struct file *file, const char __user *buffer,
585 unsigned long count, void *data)
586{
587 char c;
588 int rc;
589
590 rc = get_user(c, buffer);
591 if (rc)
592 return rc;
593 if (c == '0' || c == 'n' || c == 'N')
594 linuxExtEnabled = 0;
595 else if (c == '1' || c == 'y' || c == 'Y')
596 linuxExtEnabled = 1;
597
598 return count;
599}
600
601
602static int
603lookupFlag_read(char *page, char **start, off_t off,
604 int count, int *eof, void *data)
605{
606 int len;
607
608 len = sprintf(page, "%d\n", lookupCacheEnabled);
609
610 len -= off;
611 *start = page + off;
612
613 if (len > count)
614 len = count;
615 else
616 *eof = 1;
617
618 if (len < 0)
619 len = 0;
620
621 return len;
622}
623static int
624lookupFlag_write(struct file *file, const char __user *buffer,
625 unsigned long count, void *data)
626{
627 char c;
628 int rc;
629
630 rc = get_user(c, buffer);
631 if (rc)
632 return rc;
633 if (c == '0' || c == 'n' || c == 'N')
634 lookupCacheEnabled = 0;
635 else if (c == '1' || c == 'y' || c == 'Y')
636 lookupCacheEnabled = 1;
637
638 return count;
639}
640static int
641traceSMB_read(char *page, char **start, off_t off, int count,
642 int *eof, void *data)
643{
644 int len;
645
646 len = sprintf(page, "%d\n", traceSMB);
647
648 len -= off;
649 *start = page + off;
650
651 if (len > count)
652 len = count;
653 else
654 *eof = 1;
655
656 if (len < 0)
657 len = 0;
658
659 return len;
660}
661static int
662traceSMB_write(struct file *file, const char __user *buffer,
663 unsigned long count, void *data)
664{
665 char c;
666 int rc;
667
668 rc = get_user(c, buffer);
669 if (rc)
670 return rc;
671 if (c == '0' || c == 'n' || c == 'N')
672 traceSMB = 0;
673 else if (c == '1' || c == 'y' || c == 'Y')
674 traceSMB = 1;
675
676 return count;
677}
678
679static int
680multiuser_mount_read(char *page, char **start, off_t off,
681 int count, int *eof, void *data)
682{
683 int len;
684
685 len = sprintf(page, "%d\n", multiuser_mount);
686
687 len -= off;
688 *start = page + off;
689
690 if (len > count)
691 len = count;
692 else
693 *eof = 1;
694
695 if (len < 0)
696 len = 0;
697
698 return len;
699}
700static int
701multiuser_mount_write(struct file *file, const char __user *buffer,
702 unsigned long count, void *data)
703{
704 char c;
705 int rc;
706
707 rc = get_user(c, buffer);
708 if (rc)
709 return rc;
710 if (c == '0' || c == 'n' || c == 'N')
711 multiuser_mount = 0;
712 else if (c == '1' || c == 'y' || c == 'Y')
713 multiuser_mount = 1;
714
715 return count;
716}
717
718static int
719extended_security_read(char *page, char **start, off_t off,
720 int count, int *eof, void *data)
721{
722 int len;
723
724 len = sprintf(page, "%d\n", extended_security);
725
726 len -= off;
727 *start = page + off;
728
729 if (len > count)
730 len = count;
731 else
732 *eof = 1;
733
734 if (len < 0)
735 len = 0;
736
737 return len;
738}
739static int
740extended_security_write(struct file *file, const char __user *buffer,
741 unsigned long count, void *data)
742{
743 char c;
744 int rc;
745
746 rc = get_user(c, buffer);
747 if (rc)
748 return rc;
749 if (c == '0' || c == 'n' || c == 'N')
750 extended_security = 0;
751 else if (c == '1' || c == 'y' || c == 'Y')
752 extended_security = 1;
753
754 return count;
755}
756
757static int
758ntlmv2_enabled_read(char *page, char **start, off_t off,
759 int count, int *eof, void *data)
760{
761 int len;
762
763 len = sprintf(page, "%d\n", ntlmv2_support);
764
765 len -= off;
766 *start = page + off;
767
768 if (len > count)
769 len = count;
770 else
771 *eof = 1;
772
773 if (len < 0)
774 len = 0;
775
776 return len;
777}
778static int
779ntlmv2_enabled_write(struct file *file, const char __user *buffer,
780 unsigned long count, void *data)
781{
782 char c;
783 int rc;
784
785 rc = get_user(c, buffer);
786 if (rc)
787 return rc;
788 if (c == '0' || c == 'n' || c == 'N')
789 ntlmv2_support = 0;
790 else if (c == '1' || c == 'y' || c == 'Y')
791 ntlmv2_support = 1;
792
793 return count;
794}
795
796static int
797packet_signing_enabled_read(char *page, char **start, off_t off,
798 int count, int *eof, void *data)
799{
800 int len;
801
802 len = sprintf(page, "%d\n", sign_CIFS_PDUs);
803
804 len -= off;
805 *start = page + off;
806
807 if (len > count)
808 len = count;
809 else
810 *eof = 1;
811
812 if (len < 0)
813 len = 0;
814
815 return len;
816}
817static int
818packet_signing_enabled_write(struct file *file, const char __user *buffer,
819 unsigned long count, void *data)
820{
821 char c;
822 int rc;
823
824 rc = get_user(c, buffer);
825 if (rc)
826 return rc;
827 if (c == '0' || c == 'n' || c == 'N')
828 sign_CIFS_PDUs = 0;
829 else if (c == '1' || c == 'y' || c == 'Y')
830 sign_CIFS_PDUs = 1;
831 else if (c == '2')
832 sign_CIFS_PDUs = 2;
833
834 return count;
835}
836
837
838#endif
This page took 0.070382 seconds and 5 git commands to generate.