Blame view
fs/cifs/cifs_debug.c
21.5 KB
1da177e4c
|
1 2 3 |
/* * fs/cifs_debug.c * |
b8643e1b5
|
4 |
* Copyright (C) International Business Machines Corp., 2000,2005 |
1da177e4c
|
5 6 7 8 9 |
* * Modified by Steve French (sfrench@us.ibm.com) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by |
221601c3d
|
10 |
* the Free Software Foundation; either version 2 of the License, or |
1da177e4c
|
11 |
* (at your option) any later version. |
221601c3d
|
12 |
* |
1da177e4c
|
13 14 15 16 17 18 |
* This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See * the GNU General Public License for more details. * * You should have received a copy of the GNU General Public License |
221601c3d
|
19 |
* along with this program; if not, write to the Free Software |
1da177e4c
|
20 21 22 23 24 25 26 27 28 29 30 31 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include <linux/fs.h> #include <linux/string.h> #include <linux/ctype.h> #include <linux/module.h> #include <linux/proc_fs.h> #include <asm/uaccess.h> #include "cifspdu.h" #include "cifsglob.h" #include "cifsproto.h" #include "cifs_debug.h" |
6c91d362f
|
32 |
#include "cifsfs.h" |
1da177e4c
|
33 34 35 36 37 38 39 40 |
void cifs_dump_mem(char *label, void *data, int length) { int i, j; int *intptr = data; char *charptr = data; char buf[10], line[80]; |
221601c3d
|
41 42 |
printk(KERN_DEBUG "%s: dump of %d bytes of data at 0x%p ", |
1da177e4c
|
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
label, length, data); for (i = 0; i < length; i += 16) { line[0] = 0; for (j = 0; (j < 4) && (i + j * 4 < length); j++) { sprintf(buf, " %08x", intptr[i / 4 + j]); strcat(line, buf); } buf[0] = ' '; buf[2] = 0; for (j = 0; (j < 16) && (i + j < length); j++) { buf[1] = isprint(charptr[i + j]) ? charptr[i + j] : '.'; strcat(line, buf); } printk(KERN_DEBUG "%s ", line); } } |
3979877e5
|
60 |
#ifdef CONFIG_CIFS_DEBUG2 |
ffdd6e4d1
|
61 |
void cifs_dump_detail(struct smb_hdr *smb) |
3979877e5
|
62 |
{ |
221601c3d
|
63 |
cERROR(1, ("Cmd: %d Err: 0x%x Flags: 0x%x Flgs2: 0x%x Mid: %d Pid: %d", |
3979877e5
|
64 65 |
smb->Command, smb->Status.CifsError, smb->Flags, smb->Flags2, smb->Mid, smb->Pid)); |
221601c3d
|
66 |
cERROR(1, ("smb buf %p len %d", smb, smbCalcSize_LE(smb))); |
3979877e5
|
67 |
} |
ffdd6e4d1
|
68 |
void cifs_dump_mids(struct TCP_Server_Info *server) |
3979877e5
|
69 70 |
{ struct list_head *tmp; |
ffdd6e4d1
|
71 |
struct mid_q_entry *mid_entry; |
3979877e5
|
72 |
|
221601c3d
|
73 |
if (server == NULL) |
3979877e5
|
74 |
return; |
221601c3d
|
75 |
cERROR(1, ("Dump pending requests:")); |
3979877e5
|
76 77 78 |
spin_lock(&GlobalMid_Lock); list_for_each(tmp, &server->pending_mid_q) { mid_entry = list_entry(tmp, struct mid_q_entry, qhead); |
221601c3d
|
79 80 |
if (mid_entry) { cERROR(1, ("State: %d Cmd: %d Pid: %d Tsk: %p Mid %d", |
3979877e5
|
81 82 83 84 85 86 |
mid_entry->midState, (int)mid_entry->command, mid_entry->pid, mid_entry->tsk, mid_entry->mid)); #ifdef CONFIG_CIFS_STATS2 |
221601c3d
|
87 |
cERROR(1, ("IsLarge: %d buf: %p time rcv: %ld now: %ld", |
3979877e5
|
88 89 90 91 92 |
mid_entry->largeBuf, mid_entry->resp_buf, mid_entry->when_received, jiffies)); #endif /* STATS2 */ |
221601c3d
|
93 |
cERROR(1, ("IsMult: %d IsEnd: %d", mid_entry->multiRsp, |
3979877e5
|
94 |
mid_entry->multiEnd)); |
221601c3d
|
95 |
if (mid_entry->resp_buf) { |
3979877e5
|
96 97 98 99 100 |
cifs_dump_detail(mid_entry->resp_buf); cifs_dump_mem("existing buf: ", mid_entry->resp_buf, 62 /* fixme */); } |
3979877e5
|
101 102 103 104 105 |
} } spin_unlock(&GlobalMid_Lock); } #endif /* CONFIG_CIFS_DEBUG2 */ |
1da177e4c
|
106 107 108 109 110 111 112 |
#ifdef CONFIG_PROC_FS static int cifs_debug_data_read(char *buf, char **beginBuffer, off_t offset, int count, int *eof, void *data) { struct list_head *tmp; struct list_head *tmp1; |
ffdd6e4d1
|
113 |
struct mid_q_entry *mid_entry; |
1da177e4c
|
114 115 116 117 |
struct cifsSesInfo *ses; struct cifsTconInfo *tcon; int i; int length = 0; |
ffdd6e4d1
|
118 |
char *original_buf = buf; |
1da177e4c
|
119 120 |
*beginBuffer = buf + offset; |
1da177e4c
|
121 122 123 124 125 126 127 |
length = sprintf(buf, "Display Internal CIFS Data Structures for Debugging " "--------------------------------------------------- "); buf += length; |
221601c3d
|
128 129 |
length = sprintf(buf, "CIFS Version %s ", CIFS_VERSION); |
6c91d362f
|
130 |
buf += length; |
221601c3d
|
131 132 133 |
length = sprintf(buf, "Active VFS Requests: %d ", GlobalTotalActiveXid); |
131afd0b7
|
134 |
buf += length; |
6c91d362f
|
135 |
length = sprintf(buf, "Servers:"); |
1da177e4c
|
136 137 138 139 140 141 142 |
buf += length; i = 0; read_lock(&GlobalSMBSeslock); list_for_each(tmp, &GlobalSMBSessionList) { i++; ses = list_entry(tmp, struct cifsSesInfo, cifsSessionList); |
221601c3d
|
143 |
if ((ses->serverDomain == NULL) || (ses->serverOS == NULL) || |
433dc24f2
|
144 |
(ses->serverNOS == NULL)) { |
bd2abf177
|
145 146 147 148 |
buf += sprintf(buf, " entry for %s not fully " "displayed \t", ses->serverName); |
433dc24f2
|
149 150 151 |
} else { length = sprintf(buf, |
221601c3d
|
152 153 154 155 156 157 |
" %d) Name: %s Domain: %s Mounts: %d OS:" " %s \tNOS: %s\tCapability: 0x%x \tSMB" " session status: %d\t", |
b8643e1b5
|
158 159 160 |
i, ses->serverName, ses->serverDomain, atomic_read(&ses->inUse), ses->serverOS, ses->serverNOS, |
221601c3d
|
161 |
ses->capabilities, ses->status); |
433dc24f2
|
162 163 |
buf += length; } |
221601c3d
|
164 165 166 167 |
if (ses->server) { buf += sprintf(buf, "TCP status: %d \tLocal Users To " "Server: %d SecMode: 0x%x Req On Wire: %d", |
1da177e4c
|
168 169 170 171 |
ses->server->tcpStatus, atomic_read(&ses->server->socketUseCount), ses->server->secMode, atomic_read(&ses->server->inFlight)); |
131afd0b7
|
172 173 |
#ifdef CONFIG_CIFS_STATS2 |
68058e757
|
174 |
buf += sprintf(buf, " In Send: %d In MaxReq Wait: %d", |
221601c3d
|
175 |
atomic_read(&ses->server->inSend), |
131afd0b7
|
176 177 |
atomic_read(&ses->server->num_waiters)); #endif |
6c91d362f
|
178 179 180 |
length = sprintf(buf, " MIDs: "); |
1da177e4c
|
181 182 183 184 185 186 187 |
buf += length; spin_lock(&GlobalMid_Lock); list_for_each(tmp1, &ses->server->pending_mid_q) { mid_entry = list_entry(tmp1, struct mid_q_entry, qhead); |
221601c3d
|
188 189 190 191 192 193 194 195 196 197 |
if (mid_entry) { length = sprintf(buf, "State: %d com: %d pid:" " %d tsk: %p mid %d ", mid_entry->midState, (int)mid_entry->command, mid_entry->pid, mid_entry->tsk, mid_entry->mid); |
1da177e4c
|
198 199 200 |
buf += length; } } |
221601c3d
|
201 |
spin_unlock(&GlobalMid_Lock); |
1da177e4c
|
202 203 204 205 206 207 208 |
} } read_unlock(&GlobalSMBSeslock); sprintf(buf, " "); buf++; |
6c91d362f
|
209 |
length = sprintf(buf, "Shares:"); |
1da177e4c
|
210 211 212 213 214 215 216 217 218 219 220 |
buf += length; i = 0; read_lock(&GlobalSMBSeslock); list_for_each(tmp, &GlobalTreeConnectionList) { __u32 dev_type; i++; tcon = list_entry(tmp, struct cifsTconInfo, cifsConnectionList); dev_type = le32_to_cpu(tcon->fsDevInfo.DeviceType); length = sprintf(buf, |
221601c3d
|
221 222 223 224 |
" %d) %s Uses: %d Type: %s DevInfo: 0x%x " "Attributes: 0x%x PathComponentMax: %d Status: %d", |
1da177e4c
|
225 226 227 228 229 230 231 |
i, tcon->treeName, atomic_read(&tcon->useCount), tcon->nativeFileSystem, le32_to_cpu(tcon->fsDevInfo.DeviceCharacteristics), le32_to_cpu(tcon->fsAttrInfo.Attributes), le32_to_cpu(tcon->fsAttrInfo.MaxPathNameComponentLength), tcon->tidStatus); |
221601c3d
|
232 |
buf += length; |
1da177e4c
|
233 234 235 236 237 238 239 240 |
if (dev_type == FILE_DEVICE_DISK) length = sprintf(buf, " type: DISK "); else if (dev_type == FILE_DEVICE_CD_ROM) length = sprintf(buf, " type: CDROM "); else length = sprintf(buf, " type: %d ", dev_type); buf += length; |
221601c3d
|
241 |
if (tcon->tidStatus == CifsNeedReconnect) { |
1da177e4c
|
242 243 244 245 246 247 248 249 250 251 252 253 254 |
buf += sprintf(buf, "\tDISCONNECTED "); length += 14; } } read_unlock(&GlobalSMBSeslock); length = sprintf(buf, " "); buf += length; /* BB add code to dump additional info such as TCP session info now */ /* Now calculate total size of returned data */ length = buf - original_buf; |
221601c3d
|
255 |
if (offset + count >= length) |
1da177e4c
|
256 |
*eof = 1; |
221601c3d
|
257 |
if (length < offset) { |
1da177e4c
|
258 259 260 261 262 263 264 265 266 267 268 269 |
*eof = 1; return 0; } else { length = length - offset; } if (length > count) length = count; return length; } #ifdef CONFIG_CIFS_STATS |
1047abc15
|
270 271 272 |
static int cifs_stats_write(struct file *file, const char __user *buffer, |
221601c3d
|
273 |
unsigned long count, void *data) |
1047abc15
|
274 |
{ |
221601c3d
|
275 276 |
char c; int rc; |
1047abc15
|
277 278 |
struct list_head *tmp; struct cifsTconInfo *tcon; |
221601c3d
|
279 280 281 |
rc = get_user(c, buffer); if (rc) return rc; |
1047abc15
|
282 |
|
221601c3d
|
283 |
if (c == '1' || c == 'y' || c == 'Y' || c == '0') { |
1047abc15
|
284 |
read_lock(&GlobalSMBSeslock); |
4498eed50
|
285 286 287 288 |
#ifdef CONFIG_CIFS_STATS2 atomic_set(&totBufAllocCount, 0); atomic_set(&totSmBufAllocCount, 0); #endif /* CONFIG_CIFS_STATS2 */ |
1047abc15
|
289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 |
list_for_each(tmp, &GlobalTreeConnectionList) { tcon = list_entry(tmp, struct cifsTconInfo, cifsConnectionList); atomic_set(&tcon->num_smbs_sent, 0); atomic_set(&tcon->num_writes, 0); atomic_set(&tcon->num_reads, 0); atomic_set(&tcon->num_oplock_brks, 0); atomic_set(&tcon->num_opens, 0); atomic_set(&tcon->num_closes, 0); atomic_set(&tcon->num_deletes, 0); atomic_set(&tcon->num_mkdirs, 0); atomic_set(&tcon->num_rmdirs, 0); atomic_set(&tcon->num_renames, 0); atomic_set(&tcon->num_t2renames, 0); atomic_set(&tcon->num_ffirst, 0); atomic_set(&tcon->num_fnext, 0); atomic_set(&tcon->num_fclose, 0); atomic_set(&tcon->num_hardlinks, 0); atomic_set(&tcon->num_symlinks, 0); atomic_set(&tcon->num_locks, 0); } read_unlock(&GlobalSMBSeslock); } |
221601c3d
|
312 |
return count; |
1047abc15
|
313 |
} |
1da177e4c
|
314 315 316 317 |
static int cifs_stats_read(char *buf, char **beginBuffer, off_t offset, int count, int *eof, void *data) { |
221601c3d
|
318 |
int item_length, i, length; |
1da177e4c
|
319 320 321 322 323 324 325 326 327 328 329 |
struct list_head *tmp; struct cifsTconInfo *tcon; *beginBuffer = buf + offset; length = sprintf(buf, "Resources in use CIFS Session: %d ", sesInfoAllocCount.counter); buf += length; |
221601c3d
|
330 331 332 |
item_length = sprintf(buf, "Share (unique mount targets): %d ", |
1da177e4c
|
333 334 |
tconInfoAllocCount.counter); length += item_length; |
221601c3d
|
335 336 337 338 |
buf += item_length; item_length = sprintf(buf, "SMB Request/Response Buffer: %d Pool size: %d ", |
b8643e1b5
|
339 340 |
bufAllocCount.counter, cifs_min_rcv + tcpSesAllocCount.counter); |
1da177e4c
|
341 342 |
length += item_length; buf += item_length; |
221601c3d
|
343 344 345 346 |
item_length = sprintf(buf, "SMB Small Req/Resp Buffer: %d Pool size: %d ", smBufAllocCount.counter, cifs_min_small); |
1da177e4c
|
347 348 |
length += item_length; buf += item_length; |
07475ffba
|
349 |
#ifdef CONFIG_CIFS_STATS2 |
221601c3d
|
350 351 |
item_length = sprintf(buf, "Total Large %d Small %d Allocations ", |
07475ffba
|
352 |
atomic_read(&totBufAllocCount), |
221601c3d
|
353 |
atomic_read(&totSmBufAllocCount)); |
07475ffba
|
354 355 356 |
length += item_length; buf += item_length; #endif /* CONFIG_CIFS_STATS2 */ |
221601c3d
|
357 358 359 |
item_length = sprintf(buf, "Operations (MIDs): %d ", |
1da177e4c
|
360 361 362 363 364 365 366 |
midCount.counter); length += item_length; buf += item_length; item_length = sprintf(buf, " %d session %d share reconnects ", |
221601c3d
|
367 |
tcpSesReconnectCount.counter, tconInfoReconnectCount.counter); |
1da177e4c
|
368 369 370 371 372 373 |
length += item_length; buf += item_length; item_length = sprintf(buf, "Total vfs operations: %d maximum at one time: %d ", |
221601c3d
|
374 |
GlobalCurrentXid, GlobalMaxActiveXid); |
1da177e4c
|
375 376 377 378 379 380 381 382 |
length += item_length; buf += item_length; i = 0; read_lock(&GlobalSMBSeslock); list_for_each(tmp, &GlobalTreeConnectionList) { i++; tcon = list_entry(tmp, struct cifsTconInfo, cifsConnectionList); |
221601c3d
|
383 384 |
item_length = sprintf(buf, " %d) %s", i, tcon->treeName); |
1da177e4c
|
385 386 |
buf += item_length; length += item_length; |
221601c3d
|
387 |
if (tcon->tidStatus == CifsNeedReconnect) { |
1da177e4c
|
388 389 390 |
buf += sprintf(buf, "\tDISCONNECTED "); length += 14; } |
a5a2b489b
|
391 392 |
item_length = sprintf(buf, " SMBs: %d Oplock Breaks: %d", |
1da177e4c
|
393 394 395 396 |
atomic_read(&tcon->num_smbs_sent), atomic_read(&tcon->num_oplock_brks)); buf += item_length; length += item_length; |
0ae0efada
|
397 398 |
item_length = sprintf(buf, " Reads: %d Bytes: %lld", |
1da177e4c
|
399 400 401 402 |
atomic_read(&tcon->num_reads), (long long)(tcon->bytes_read)); buf += item_length; length += item_length; |
a5a2b489b
|
403 404 |
item_length = sprintf(buf, " Writes: %d Bytes: %lld", |
1da177e4c
|
405 406 |
atomic_read(&tcon->num_writes), (long long)(tcon->bytes_written)); |
221601c3d
|
407 408 409 |
buf += item_length; length += item_length; item_length = sprintf(buf, |
a5a2b489b
|
410 411 |
" Locks: %d HardLinks: %d Symlinks: %d", |
221601c3d
|
412 |
atomic_read(&tcon->num_locks), |
a5a2b489b
|
413 414 |
atomic_read(&tcon->num_hardlinks), atomic_read(&tcon->num_symlinks)); |
221601c3d
|
415 416 |
buf += item_length; length += item_length; |
a5a2b489b
|
417 418 419 420 421 422 |
item_length = sprintf(buf, " Opens: %d Closes: %d Deletes: %d", atomic_read(&tcon->num_opens), atomic_read(&tcon->num_closes), atomic_read(&tcon->num_deletes)); |
1da177e4c
|
423 424 |
buf += item_length; length += item_length; |
a5a2b489b
|
425 426 |
item_length = sprintf(buf, " Mkdirs: %d Rmdirs: %d", |
1da177e4c
|
427 428 429 430 |
atomic_read(&tcon->num_mkdirs), atomic_read(&tcon->num_rmdirs)); buf += item_length; length += item_length; |
a5a2b489b
|
431 432 |
item_length = sprintf(buf, " Renames: %d T2 Renames %d", |
1da177e4c
|
433 434 435 436 |
atomic_read(&tcon->num_renames), atomic_read(&tcon->num_t2renames)); buf += item_length; length += item_length; |
a5a2b489b
|
437 438 |
item_length = sprintf(buf, " FindFirst: %d FNext %d FClose %d", |
0c0ff0932
|
439 440 441 442 443 |
atomic_read(&tcon->num_ffirst), atomic_read(&tcon->num_fnext), atomic_read(&tcon->num_fclose)); buf += item_length; length += item_length; |
1da177e4c
|
444 445 |
} read_unlock(&GlobalSMBSeslock); |
221601c3d
|
446 447 |
buf += sprintf(buf, " "); |
1da177e4c
|
448 |
length++; |
221601c3d
|
449 |
if (offset + count >= length) |
1da177e4c
|
450 |
*eof = 1; |
221601c3d
|
451 |
if (length < offset) { |
1da177e4c
|
452 453 454 455 456 457 458 |
*eof = 1; return 0; } else { length = length - offset; } if (length > count) length = count; |
221601c3d
|
459 |
|
1da177e4c
|
460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 |
return length; } #endif static struct proc_dir_entry *proc_fs_cifs; read_proc_t cifs_txanchor_read; static read_proc_t cifsFYI_read; static write_proc_t cifsFYI_write; static read_proc_t oplockEnabled_read; static write_proc_t oplockEnabled_write; static read_proc_t lookupFlag_read; static write_proc_t lookupFlag_write; static read_proc_t traceSMB_read; static write_proc_t traceSMB_write; static read_proc_t multiuser_mount_read; static write_proc_t multiuser_mount_write; |
bdc4bf6e8
|
476 477 |
static read_proc_t security_flags_read; static write_proc_t security_flags_write; |
3979877e5
|
478 |
/* static read_proc_t ntlmv2_enabled_read; |
1da177e4c
|
479 480 |
static write_proc_t ntlmv2_enabled_write; static read_proc_t packet_signing_enabled_read; |
3979877e5
|
481 |
static write_proc_t packet_signing_enabled_write;*/ |
ec637e3ff
|
482 483 |
static read_proc_t experimEnabled_read; static write_proc_t experimEnabled_write; |
1da177e4c
|
484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 |
static read_proc_t linuxExtensionsEnabled_read; static write_proc_t linuxExtensionsEnabled_write; void cifs_proc_init(void) { struct proc_dir_entry *pde; proc_fs_cifs = proc_mkdir("cifs", proc_root_fs); if (proc_fs_cifs == NULL) return; proc_fs_cifs->owner = THIS_MODULE; create_proc_read_entry("DebugData", 0, proc_fs_cifs, cifs_debug_data_read, NULL); #ifdef CONFIG_CIFS_STATS |
1047abc15
|
501 |
pde = create_proc_read_entry("Stats", 0, proc_fs_cifs, |
1da177e4c
|
502 |
cifs_stats_read, NULL); |
1047abc15
|
503 504 |
if (pde) pde->write_proc = cifs_stats_write; |
1da177e4c
|
505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 |
#endif pde = create_proc_read_entry("cifsFYI", 0, proc_fs_cifs, cifsFYI_read, NULL); if (pde) pde->write_proc = cifsFYI_write; pde = create_proc_read_entry("traceSMB", 0, proc_fs_cifs, traceSMB_read, NULL); if (pde) pde->write_proc = traceSMB_write; pde = create_proc_read_entry("OplockEnabled", 0, proc_fs_cifs, oplockEnabled_read, NULL); if (pde) pde->write_proc = oplockEnabled_write; |
0c0ff0932
|
521 |
pde = create_proc_read_entry("Experimental", 0, proc_fs_cifs, |
ec637e3ff
|
522 |
experimEnabled_read, NULL); |
1da177e4c
|
523 |
if (pde) |
ec637e3ff
|
524 |
pde->write_proc = experimEnabled_write; |
1da177e4c
|
525 526 527 528 529 530 531 532 533 534 535 536 537 |
pde = create_proc_read_entry("LinuxExtensionsEnabled", 0, proc_fs_cifs, linuxExtensionsEnabled_read, NULL); if (pde) pde->write_proc = linuxExtensionsEnabled_write; pde = create_proc_read_entry("MultiuserMount", 0, proc_fs_cifs, multiuser_mount_read, NULL); if (pde) pde->write_proc = multiuser_mount_write; pde = |
7c7b25bc8
|
538 |
create_proc_read_entry("SecurityFlags", 0, proc_fs_cifs, |
bdc4bf6e8
|
539 |
security_flags_read, NULL); |
1da177e4c
|
540 |
if (pde) |
bdc4bf6e8
|
541 |
pde->write_proc = security_flags_write; |
1da177e4c
|
542 543 544 545 546 547 |
pde = create_proc_read_entry("LookupCacheEnabled", 0, proc_fs_cifs, lookupFlag_read, NULL); if (pde) pde->write_proc = lookupFlag_write; |
3979877e5
|
548 |
/* pde = |
1da177e4c
|
549 550 551 552 553 554 555 556 557 |
create_proc_read_entry("NTLMV2Enabled", 0, proc_fs_cifs, ntlmv2_enabled_read, NULL); if (pde) pde->write_proc = ntlmv2_enabled_write; pde = create_proc_read_entry("PacketSigningEnabled", 0, proc_fs_cifs, packet_signing_enabled_read, NULL); if (pde) |
3979877e5
|
558 |
pde->write_proc = packet_signing_enabled_write;*/ |
1da177e4c
|
559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 |
} void cifs_proc_clean(void) { if (proc_fs_cifs == NULL) return; remove_proc_entry("DebugData", proc_fs_cifs); remove_proc_entry("cifsFYI", proc_fs_cifs); remove_proc_entry("traceSMB", proc_fs_cifs); #ifdef CONFIG_CIFS_STATS remove_proc_entry("Stats", proc_fs_cifs); #endif remove_proc_entry("MultiuserMount", proc_fs_cifs); remove_proc_entry("OplockEnabled", proc_fs_cifs); |
3979877e5
|
575 |
/* remove_proc_entry("NTLMV2Enabled",proc_fs_cifs); */ |
221601c3d
|
576 577 578 579 580 |
remove_proc_entry("SecurityFlags", proc_fs_cifs); /* remove_proc_entry("PacketSigningEnabled", proc_fs_cifs); */ remove_proc_entry("LinuxExtensionsEnabled", proc_fs_cifs); remove_proc_entry("Experimental", proc_fs_cifs); remove_proc_entry("LookupCacheEnabled", proc_fs_cifs); |
1da177e4c
|
581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 |
remove_proc_entry("cifs", proc_root_fs); } static int cifsFYI_read(char *page, char **start, off_t off, int count, int *eof, void *data) { int len; len = sprintf(page, "%d ", cifsFYI); len -= off; *start = page + off; if (len > count) len = count; else *eof = 1; if (len < 0) len = 0; return len; } static int cifsFYI_write(struct file *file, const char __user *buffer, unsigned long count, void *data) { char c; int rc; rc = get_user(c, buffer); if (rc) return rc; if (c == '0' || c == 'n' || c == 'N') cifsFYI = 0; else if (c == '1' || c == 'y' || c == 'Y') cifsFYI = 1; |
221601c3d
|
620 |
else if ((c > '1') && (c <= '9')) |
1047abc15
|
621 |
cifsFYI = (int) (c - '0'); /* see cifs_debug.h for meanings */ |
1da177e4c
|
622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 |
return count; } static int oplockEnabled_read(char *page, char **start, off_t off, int count, int *eof, void *data) { int len; len = sprintf(page, "%d ", oplockEnabled); len -= off; *start = page + off; if (len > count) len = count; else *eof = 1; if (len < 0) len = 0; return len; } static int oplockEnabled_write(struct file *file, const char __user *buffer, unsigned long count, void *data) { char c; int rc; rc = get_user(c, buffer); if (rc) return rc; if (c == '0' || c == 'n' || c == 'N') oplockEnabled = 0; else if (c == '1' || c == 'y' || c == 'Y') oplockEnabled = 1; return count; } static int |
ec637e3ff
|
667 |
experimEnabled_read(char *page, char **start, off_t off, |
221601c3d
|
668 |
int count, int *eof, void *data) |
1da177e4c
|
669 |
{ |
221601c3d
|
670 |
int len; |
1da177e4c
|
671 |
|
221601c3d
|
672 673 |
len = sprintf(page, "%d ", experimEnabled); |
ec637e3ff
|
674 |
|
221601c3d
|
675 676 |
len -= off; *start = page + off; |
1da177e4c
|
677 |
|
221601c3d
|
678 679 680 681 |
if (len > count) len = count; else *eof = 1; |
1da177e4c
|
682 |
|
221601c3d
|
683 684 |
if (len < 0) len = 0; |
1da177e4c
|
685 |
|
221601c3d
|
686 |
return len; |
1da177e4c
|
687 688 |
} static int |
ec637e3ff
|
689 |
experimEnabled_write(struct file *file, const char __user *buffer, |
221601c3d
|
690 |
unsigned long count, void *data) |
1da177e4c
|
691 |
{ |
ec637e3ff
|
692 693 |
char c; int rc; |
1da177e4c
|
694 |
|
ec637e3ff
|
695 696 697 698 699 700 701 702 703 |
rc = get_user(c, buffer); if (rc) return rc; if (c == '0' || c == 'n' || c == 'N') experimEnabled = 0; else if (c == '1' || c == 'y' || c == 'Y') experimEnabled = 1; else if (c == '2') experimEnabled = 2; |
1da177e4c
|
704 |
|
ec637e3ff
|
705 |
return count; |
1da177e4c
|
706 707 708 709 |
} static int linuxExtensionsEnabled_read(char *page, char **start, off_t off, |
221601c3d
|
710 |
int count, int *eof, void *data) |
1da177e4c
|
711 |
{ |
221601c3d
|
712 |
int len; |
1da177e4c
|
713 |
|
221601c3d
|
714 715 716 717 |
len = sprintf(page, "%d ", linuxExtEnabled); len -= off; *start = page + off; |
1da177e4c
|
718 |
|
221601c3d
|
719 720 721 722 |
if (len > count) len = count; else *eof = 1; |
1da177e4c
|
723 |
|
221601c3d
|
724 725 |
if (len < 0) len = 0; |
1da177e4c
|
726 |
|
221601c3d
|
727 |
return len; |
1da177e4c
|
728 729 730 |
} static int linuxExtensionsEnabled_write(struct file *file, const char __user *buffer, |
221601c3d
|
731 |
unsigned long count, void *data) |
1da177e4c
|
732 |
{ |
221601c3d
|
733 734 735 736 737 738 739 740 741 742 743 744 |
char c; int rc; rc = get_user(c, buffer); if (rc) return rc; if (c == '0' || c == 'n' || c == 'N') linuxExtEnabled = 0; else if (c == '1' || c == 'y' || c == 'Y') linuxExtEnabled = 1; return count; |
1da177e4c
|
745 746 747 748 749 |
} static int lookupFlag_read(char *page, char **start, off_t off, |
221601c3d
|
750 |
int count, int *eof, void *data) |
1da177e4c
|
751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 |
{ int len; len = sprintf(page, "%d ", lookupCacheEnabled); len -= off; *start = page + off; if (len > count) len = count; else *eof = 1; if (len < 0) len = 0; return len; } static int lookupFlag_write(struct file *file, const char __user *buffer, unsigned long count, void *data) { char c; int rc; rc = get_user(c, buffer); if (rc) return rc; if (c == '0' || c == 'n' || c == 'N') lookupCacheEnabled = 0; else if (c == '1' || c == 'y' || c == 'Y') lookupCacheEnabled = 1; return count; } static int traceSMB_read(char *page, char **start, off_t off, int count, int *eof, void *data) { int len; len = sprintf(page, "%d ", traceSMB); len -= off; *start = page + off; if (len > count) len = count; else *eof = 1; if (len < 0) len = 0; return len; } static int traceSMB_write(struct file *file, const char __user *buffer, unsigned long count, void *data) { char c; int rc; rc = get_user(c, buffer); if (rc) return rc; if (c == '0' || c == 'n' || c == 'N') traceSMB = 0; else if (c == '1' || c == 'y' || c == 'Y') traceSMB = 1; return count; } static int multiuser_mount_read(char *page, char **start, off_t off, int count, int *eof, void *data) { int len; len = sprintf(page, "%d ", multiuser_mount); len -= off; *start = page + off; if (len > count) len = count; else *eof = 1; if (len < 0) len = 0; return len; } static int multiuser_mount_write(struct file *file, const char __user *buffer, unsigned long count, void *data) { char c; int rc; rc = get_user(c, buffer); if (rc) return rc; if (c == '0' || c == 'n' || c == 'N') multiuser_mount = 0; else if (c == '1' || c == 'y' || c == 'Y') multiuser_mount = 1; return count; } static int |
bdc4bf6e8
|
868 |
security_flags_read(char *page, char **start, off_t off, |
1da177e4c
|
869 870 871 |
int count, int *eof, void *data) { int len; |
3979877e5
|
872 873 |
len = sprintf(page, "0x%x ", extended_security); |
1da177e4c
|
874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 |
len -= off; *start = page + off; if (len > count) len = count; else *eof = 1; if (len < 0) len = 0; return len; } static int |
bdc4bf6e8
|
889 |
security_flags_write(struct file *file, const char __user *buffer, |
1da177e4c
|
890 891 |
unsigned long count, void *data) { |
bdc4bf6e8
|
892 893 |
unsigned int flags; char flags_string[12]; |
1da177e4c
|
894 |
char c; |
bdc4bf6e8
|
895 |
|
221601c3d
|
896 |
if ((count < 1) || (count > 11)) |
3979877e5
|
897 |
return -EINVAL; |
1da177e4c
|
898 |
|
bdc4bf6e8
|
899 |
memset(flags_string, 0, 12); |
3979877e5
|
900 |
|
221601c3d
|
901 |
if (copy_from_user(flags_string, buffer, count)) |
bdc4bf6e8
|
902 |
return -EFAULT; |
3979877e5
|
903 |
|
221601c3d
|
904 |
if (count < 3) { |
bdc4bf6e8
|
905 906 907 908 909 910 911 912 913 914 915 |
/* single char or single char followed by null */ c = flags_string[0]; if (c == '0' || c == 'n' || c == 'N') extended_security = CIFSSEC_DEF; /* default */ else if (c == '1' || c == 'y' || c == 'Y') extended_security = CIFSSEC_MAX; return count; } /* else we have a number */ flags = simple_strtoul(flags_string, NULL, 0); |
221601c3d
|
916 |
cFYI(1, ("sec flags 0x%x", flags)); |
bdc4bf6e8
|
917 |
|
221601c3d
|
918 919 |
if (flags <= 0) { cERROR(1, ("invalid security flags %s", flags_string)); |
bdc4bf6e8
|
920 921 |
return -EINVAL; } |
1da177e4c
|
922 |
|
221601c3d
|
923 924 |
if (flags & ~CIFSSEC_MASK) { cERROR(1, ("attempt to set unsupported security flags 0x%x", |
bdc4bf6e8
|
925 926 927 928 929 |
flags & ~CIFSSEC_MASK)); return -EINVAL; } /* flags look ok - update the global security flags for cifs module */ extended_security = flags; |
762e5ab77
|
930 931 932 933 934 935 936 937 |
if (extended_security & CIFSSEC_MUST_SIGN) { /* requiring signing implies signing is allowed */ extended_security |= CIFSSEC_MAY_SIGN; cFYI(1, ("packet signing now required")); } else if ((extended_security & CIFSSEC_MAY_SIGN) == 0) { cFYI(1, ("packet signing disabled")); } /* BB should we turn on MAY flags for other MUST options? */ |
1da177e4c
|
938 939 |
return count; } |
1da177e4c
|
940 |
#endif |