cifs_debug.c 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838
  1. /*
  2. * fs/cifs_debug.c
  3. *
  4. * Copyright (C) International Business Machines Corp., 2000,2005
  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"
  32. #include "cifsfs.h"
  33. void
  34. cifs_dump_mem(char *label, void *data, int length)
  35. {
  36. int i, j;
  37. int *intptr = data;
  38. char *charptr = data;
  39. char buf[10], line[80];
  40. printk(KERN_DEBUG "%s: dump of %d bytes of data at 0x%p\n\n",
  41. label, length, data);
  42. for (i = 0; i < length; i += 16) {
  43. line[0] = 0;
  44. for (j = 0; (j < 4) && (i + j * 4 < length); j++) {
  45. sprintf(buf, " %08x", intptr[i / 4 + j]);
  46. strcat(line, buf);
  47. }
  48. buf[0] = ' ';
  49. buf[2] = 0;
  50. for (j = 0; (j < 16) && (i + j < length); j++) {
  51. buf[1] = isprint(charptr[i + j]) ? charptr[i + j] : '.';
  52. strcat(line, buf);
  53. }
  54. printk(KERN_DEBUG "%s\n", line);
  55. }
  56. }
  57. #ifdef CONFIG_PROC_FS
  58. static int
  59. cifs_debug_data_read(char *buf, char **beginBuffer, off_t offset,
  60. int count, int *eof, void *data)
  61. {
  62. struct list_head *tmp;
  63. struct list_head *tmp1;
  64. struct mid_q_entry * mid_entry;
  65. struct cifsSesInfo *ses;
  66. struct cifsTconInfo *tcon;
  67. int i;
  68. int length = 0;
  69. char * original_buf = buf;
  70. *beginBuffer = buf + offset;
  71. length =
  72. sprintf(buf,
  73. "Display Internal CIFS Data Structures for Debugging\n"
  74. "---------------------------------------------------\n");
  75. buf += length;
  76. length = sprintf(buf,"CIFS Version %s\n",CIFS_VERSION);
  77. buf += length;
  78. length = sprintf(buf, "Servers:");
  79. buf += length;
  80. i = 0;
  81. read_lock(&GlobalSMBSeslock);
  82. list_for_each(tmp, &GlobalSMBSessionList) {
  83. i++;
  84. ses = list_entry(tmp, struct cifsSesInfo, cifsSessionList);
  85. if((ses->serverDomain == NULL) || (ses->serverOS == NULL) ||
  86. (ses->serverNOS == NULL)) {
  87. buf += sprintf("\nentry for %s not fully displayed\n\t",
  88. ses->serverName);
  89. } else {
  90. length =
  91. sprintf(buf,
  92. "\n%d) Name: %s Domain: %s Mounts: %d ServerOS: %s \n\tServerNOS: %s\tCapabilities: 0x%x\n\tSMB session status: %d\t",
  93. i, ses->serverName, ses->serverDomain,
  94. atomic_read(&ses->inUse),
  95. ses->serverOS, ses->serverNOS,
  96. ses->capabilities,ses->status);
  97. buf += length;
  98. }
  99. if(ses->server) {
  100. buf += sprintf(buf, "TCP status: %d\n\tLocal Users To Server: %d SecMode: 0x%x Req Active: %d",
  101. ses->server->tcpStatus,
  102. atomic_read(&ses->server->socketUseCount),
  103. ses->server->secMode,
  104. atomic_read(&ses->server->inFlight));
  105. length = sprintf(buf, "\nMIDs:\n");
  106. buf += length;
  107. spin_lock(&GlobalMid_Lock);
  108. list_for_each(tmp1, &ses->server->pending_mid_q) {
  109. mid_entry = list_entry(tmp1, struct
  110. mid_q_entry,
  111. qhead);
  112. if(mid_entry) {
  113. length = sprintf(buf,"State: %d com: %d pid: %d tsk: %p mid %d\n",
  114. mid_entry->midState,
  115. (int)mid_entry->command,
  116. mid_entry->pid,
  117. mid_entry->tsk,
  118. mid_entry->mid);
  119. buf += length;
  120. }
  121. }
  122. spin_unlock(&GlobalMid_Lock);
  123. }
  124. }
  125. read_unlock(&GlobalSMBSeslock);
  126. sprintf(buf, "\n");
  127. buf++;
  128. length = sprintf(buf, "Shares:");
  129. buf += length;
  130. i = 0;
  131. read_lock(&GlobalSMBSeslock);
  132. list_for_each(tmp, &GlobalTreeConnectionList) {
  133. __u32 dev_type;
  134. i++;
  135. tcon = list_entry(tmp, struct cifsTconInfo, cifsConnectionList);
  136. dev_type = le32_to_cpu(tcon->fsDevInfo.DeviceType);
  137. length =
  138. sprintf(buf,
  139. "\n%d) %s Uses: %d Type: %s Characteristics: 0x%x Attributes: 0x%x\nPathComponentMax: %d Status: %d",
  140. i, tcon->treeName,
  141. atomic_read(&tcon->useCount),
  142. tcon->nativeFileSystem,
  143. le32_to_cpu(tcon->fsDevInfo.DeviceCharacteristics),
  144. le32_to_cpu(tcon->fsAttrInfo.Attributes),
  145. le32_to_cpu(tcon->fsAttrInfo.MaxPathNameComponentLength),
  146. tcon->tidStatus);
  147. buf += length;
  148. if (dev_type == FILE_DEVICE_DISK)
  149. length = sprintf(buf, " type: DISK ");
  150. else if (dev_type == FILE_DEVICE_CD_ROM)
  151. length = sprintf(buf, " type: CDROM ");
  152. else
  153. length =
  154. sprintf(buf, " type: %d ", dev_type);
  155. buf += length;
  156. if(tcon->tidStatus == CifsNeedReconnect) {
  157. buf += sprintf(buf, "\tDISCONNECTED ");
  158. length += 14;
  159. }
  160. }
  161. read_unlock(&GlobalSMBSeslock);
  162. length = sprintf(buf, "\n");
  163. buf += length;
  164. /* BB add code to dump additional info such as TCP session info now */
  165. /* Now calculate total size of returned data */
  166. length = buf - original_buf;
  167. if(offset + count >= length)
  168. *eof = 1;
  169. if(length < offset) {
  170. *eof = 1;
  171. return 0;
  172. } else {
  173. length = length - offset;
  174. }
  175. if (length > count)
  176. length = count;
  177. return length;
  178. }
  179. #ifdef CONFIG_CIFS_STATS
  180. static int
  181. cifs_stats_read(char *buf, char **beginBuffer, off_t offset,
  182. int count, int *eof, void *data)
  183. {
  184. int item_length,i,length;
  185. struct list_head *tmp;
  186. struct cifsTconInfo *tcon;
  187. *beginBuffer = buf + offset;
  188. length = sprintf(buf,
  189. "Resources in use\nCIFS Session: %d\n",
  190. sesInfoAllocCount.counter);
  191. buf += length;
  192. item_length =
  193. sprintf(buf,"Share (unique mount targets): %d\n",
  194. tconInfoAllocCount.counter);
  195. length += item_length;
  196. buf += item_length;
  197. item_length =
  198. sprintf(buf,"SMB Request/Response Buffer: %d Pool size: %d\n",
  199. bufAllocCount.counter,
  200. cifs_min_rcv + tcpSesAllocCount.counter);
  201. length += item_length;
  202. buf += item_length;
  203. item_length =
  204. sprintf(buf,"SMB Small Req/Resp Buffer: %d Pool size: %d\n",
  205. smBufAllocCount.counter,cifs_min_small);
  206. length += item_length;
  207. buf += item_length;
  208. item_length =
  209. sprintf(buf,"Operations (MIDs): %d\n",
  210. midCount.counter);
  211. length += item_length;
  212. buf += item_length;
  213. item_length = sprintf(buf,
  214. "\n%d session %d share reconnects\n",
  215. tcpSesReconnectCount.counter,tconInfoReconnectCount.counter);
  216. length += item_length;
  217. buf += item_length;
  218. item_length = sprintf(buf,
  219. "Total vfs operations: %d maximum at one time: %d\n",
  220. GlobalCurrentXid,GlobalMaxActiveXid);
  221. length += item_length;
  222. buf += item_length;
  223. i = 0;
  224. read_lock(&GlobalSMBSeslock);
  225. list_for_each(tmp, &GlobalTreeConnectionList) {
  226. i++;
  227. tcon = list_entry(tmp, struct cifsTconInfo, cifsConnectionList);
  228. item_length = sprintf(buf,"\n%d) %s",i, tcon->treeName);
  229. buf += item_length;
  230. length += item_length;
  231. if(tcon->tidStatus == CifsNeedReconnect) {
  232. buf += sprintf(buf, "\tDISCONNECTED ");
  233. length += 14;
  234. }
  235. item_length = sprintf(buf, "\nSMBs: %d Oplock Breaks: %d",
  236. atomic_read(&tcon->num_smbs_sent),
  237. atomic_read(&tcon->num_oplock_brks));
  238. buf += item_length;
  239. length += item_length;
  240. item_length = sprintf(buf, "\nReads: %d Bytes %lld",
  241. atomic_read(&tcon->num_reads),
  242. (long long)(tcon->bytes_read));
  243. buf += item_length;
  244. length += item_length;
  245. item_length = sprintf(buf, "\nWrites: %d Bytes: %lld",
  246. atomic_read(&tcon->num_writes),
  247. (long long)(tcon->bytes_written));
  248. buf += item_length;
  249. length += item_length;
  250. item_length = sprintf(buf,
  251. "\nLocks: %d HardLinks: %d Symlinks: %d",
  252. atomic_read(&tcon->num_locks),
  253. atomic_read(&tcon->num_hardlinks),
  254. atomic_read(&tcon->num_symlinks));
  255. buf += item_length;
  256. length += item_length;
  257. item_length = sprintf(buf, "\nOpens: %d Closes: %d Deletes: %d",
  258. atomic_read(&tcon->num_opens),
  259. atomic_read(&tcon->num_closes),
  260. atomic_read(&tcon->num_deletes));
  261. buf += item_length;
  262. length += item_length;
  263. item_length = sprintf(buf, "\nMkdirs: %d Rmdirs: %d",
  264. atomic_read(&tcon->num_mkdirs),
  265. atomic_read(&tcon->num_rmdirs));
  266. buf += item_length;
  267. length += item_length;
  268. item_length = sprintf(buf, "\nRenames: %d T2 Renames %d",
  269. atomic_read(&tcon->num_renames),
  270. atomic_read(&tcon->num_t2renames));
  271. buf += item_length;
  272. length += item_length;
  273. item_length = sprintf(buf, "\nFindFirst: %d FNext %d FClose %d",
  274. atomic_read(&tcon->num_ffirst),
  275. atomic_read(&tcon->num_fnext),
  276. atomic_read(&tcon->num_fclose));
  277. buf += item_length;
  278. length += item_length;
  279. }
  280. read_unlock(&GlobalSMBSeslock);
  281. buf += sprintf(buf,"\n");
  282. length++;
  283. if(offset + count >= length)
  284. *eof = 1;
  285. if(length < offset) {
  286. *eof = 1;
  287. return 0;
  288. } else {
  289. length = length - offset;
  290. }
  291. if (length > count)
  292. length = count;
  293. return length;
  294. }
  295. #endif
  296. static struct proc_dir_entry *proc_fs_cifs;
  297. read_proc_t cifs_txanchor_read;
  298. static read_proc_t cifsFYI_read;
  299. static write_proc_t cifsFYI_write;
  300. static read_proc_t oplockEnabled_read;
  301. static write_proc_t oplockEnabled_write;
  302. static read_proc_t lookupFlag_read;
  303. static write_proc_t lookupFlag_write;
  304. static read_proc_t traceSMB_read;
  305. static write_proc_t traceSMB_write;
  306. static read_proc_t multiuser_mount_read;
  307. static write_proc_t multiuser_mount_write;
  308. static read_proc_t extended_security_read;
  309. static write_proc_t extended_security_write;
  310. static read_proc_t ntlmv2_enabled_read;
  311. static write_proc_t ntlmv2_enabled_write;
  312. static read_proc_t packet_signing_enabled_read;
  313. static write_proc_t packet_signing_enabled_write;
  314. static read_proc_t quotaEnabled_read;
  315. static write_proc_t quotaEnabled_write;
  316. static read_proc_t linuxExtensionsEnabled_read;
  317. static write_proc_t linuxExtensionsEnabled_write;
  318. void
  319. cifs_proc_init(void)
  320. {
  321. struct proc_dir_entry *pde;
  322. proc_fs_cifs = proc_mkdir("cifs", proc_root_fs);
  323. if (proc_fs_cifs == NULL)
  324. return;
  325. proc_fs_cifs->owner = THIS_MODULE;
  326. create_proc_read_entry("DebugData", 0, proc_fs_cifs,
  327. cifs_debug_data_read, NULL);
  328. #ifdef CONFIG_CIFS_STATS
  329. create_proc_read_entry("Stats", 0, proc_fs_cifs,
  330. cifs_stats_read, NULL);
  331. #endif
  332. pde = create_proc_read_entry("cifsFYI", 0, proc_fs_cifs,
  333. cifsFYI_read, NULL);
  334. if (pde)
  335. pde->write_proc = cifsFYI_write;
  336. pde =
  337. create_proc_read_entry("traceSMB", 0, proc_fs_cifs,
  338. traceSMB_read, NULL);
  339. if (pde)
  340. pde->write_proc = traceSMB_write;
  341. pde = create_proc_read_entry("OplockEnabled", 0, proc_fs_cifs,
  342. oplockEnabled_read, NULL);
  343. if (pde)
  344. pde->write_proc = oplockEnabled_write;
  345. pde = create_proc_read_entry("Experimental", 0, proc_fs_cifs,
  346. quotaEnabled_read, NULL);
  347. if (pde)
  348. pde->write_proc = quotaEnabled_write;
  349. pde = create_proc_read_entry("LinuxExtensionsEnabled", 0, proc_fs_cifs,
  350. linuxExtensionsEnabled_read, NULL);
  351. if (pde)
  352. pde->write_proc = linuxExtensionsEnabled_write;
  353. pde =
  354. create_proc_read_entry("MultiuserMount", 0, proc_fs_cifs,
  355. multiuser_mount_read, NULL);
  356. if (pde)
  357. pde->write_proc = multiuser_mount_write;
  358. pde =
  359. create_proc_read_entry("ExtendedSecurity", 0, proc_fs_cifs,
  360. extended_security_read, NULL);
  361. if (pde)
  362. pde->write_proc = extended_security_write;
  363. pde =
  364. create_proc_read_entry("LookupCacheEnabled", 0, proc_fs_cifs,
  365. lookupFlag_read, NULL);
  366. if (pde)
  367. pde->write_proc = lookupFlag_write;
  368. pde =
  369. create_proc_read_entry("NTLMV2Enabled", 0, proc_fs_cifs,
  370. ntlmv2_enabled_read, NULL);
  371. if (pde)
  372. pde->write_proc = ntlmv2_enabled_write;
  373. pde =
  374. create_proc_read_entry("PacketSigningEnabled", 0, proc_fs_cifs,
  375. packet_signing_enabled_read, NULL);
  376. if (pde)
  377. pde->write_proc = packet_signing_enabled_write;
  378. }
  379. void
  380. cifs_proc_clean(void)
  381. {
  382. if (proc_fs_cifs == NULL)
  383. return;
  384. remove_proc_entry("DebugData", proc_fs_cifs);
  385. remove_proc_entry("cifsFYI", proc_fs_cifs);
  386. remove_proc_entry("traceSMB", proc_fs_cifs);
  387. #ifdef CONFIG_CIFS_STATS
  388. remove_proc_entry("Stats", proc_fs_cifs);
  389. #endif
  390. remove_proc_entry("MultiuserMount", proc_fs_cifs);
  391. remove_proc_entry("OplockEnabled", proc_fs_cifs);
  392. remove_proc_entry("NTLMV2Enabled",proc_fs_cifs);
  393. remove_proc_entry("ExtendedSecurity",proc_fs_cifs);
  394. remove_proc_entry("PacketSigningEnabled",proc_fs_cifs);
  395. remove_proc_entry("LinuxExtensionsEnabled",proc_fs_cifs);
  396. remove_proc_entry("Experimental",proc_fs_cifs);
  397. remove_proc_entry("LookupCacheEnabled",proc_fs_cifs);
  398. remove_proc_entry("cifs", proc_root_fs);
  399. }
  400. static int
  401. cifsFYI_read(char *page, char **start, off_t off, int count,
  402. int *eof, void *data)
  403. {
  404. int len;
  405. len = sprintf(page, "%d\n", cifsFYI);
  406. len -= off;
  407. *start = page + off;
  408. if (len > count)
  409. len = count;
  410. else
  411. *eof = 1;
  412. if (len < 0)
  413. len = 0;
  414. return len;
  415. }
  416. static int
  417. cifsFYI_write(struct file *file, const char __user *buffer,
  418. unsigned long count, void *data)
  419. {
  420. char c;
  421. int rc;
  422. rc = get_user(c, buffer);
  423. if (rc)
  424. return rc;
  425. if (c == '0' || c == 'n' || c == 'N')
  426. cifsFYI = 0;
  427. else if (c == '1' || c == 'y' || c == 'Y')
  428. cifsFYI = 1;
  429. return count;
  430. }
  431. static int
  432. oplockEnabled_read(char *page, char **start, off_t off,
  433. int count, int *eof, void *data)
  434. {
  435. int len;
  436. len = sprintf(page, "%d\n", oplockEnabled);
  437. len -= off;
  438. *start = page + off;
  439. if (len > count)
  440. len = count;
  441. else
  442. *eof = 1;
  443. if (len < 0)
  444. len = 0;
  445. return len;
  446. }
  447. static int
  448. oplockEnabled_write(struct file *file, const char __user *buffer,
  449. unsigned long count, void *data)
  450. {
  451. char c;
  452. int rc;
  453. rc = get_user(c, buffer);
  454. if (rc)
  455. return rc;
  456. if (c == '0' || c == 'n' || c == 'N')
  457. oplockEnabled = 0;
  458. else if (c == '1' || c == 'y' || c == 'Y')
  459. oplockEnabled = 1;
  460. return count;
  461. }
  462. static int
  463. quotaEnabled_read(char *page, char **start, off_t off,
  464. int count, int *eof, void *data)
  465. {
  466. int len;
  467. len = sprintf(page, "%d\n", experimEnabled);
  468. /* could also check if quotas are enabled in kernel
  469. as a whole first */
  470. len -= off;
  471. *start = page + off;
  472. if (len > count)
  473. len = count;
  474. else
  475. *eof = 1;
  476. if (len < 0)
  477. len = 0;
  478. return len;
  479. }
  480. static int
  481. quotaEnabled_write(struct file *file, const char __user *buffer,
  482. unsigned long count, void *data)
  483. {
  484. char c;
  485. int rc;
  486. rc = get_user(c, buffer);
  487. if (rc)
  488. return rc;
  489. if (c == '0' || c == 'n' || c == 'N')
  490. experimEnabled = 0;
  491. else if (c == '1' || c == 'y' || c == 'Y')
  492. experimEnabled = 1;
  493. return count;
  494. }
  495. static int
  496. linuxExtensionsEnabled_read(char *page, char **start, off_t off,
  497. int count, int *eof, void *data)
  498. {
  499. int len;
  500. len = sprintf(page, "%d\n", linuxExtEnabled);
  501. /* could also check if quotas are enabled in kernel
  502. as a whole first */
  503. len -= off;
  504. *start = page + off;
  505. if (len > count)
  506. len = count;
  507. else
  508. *eof = 1;
  509. if (len < 0)
  510. len = 0;
  511. return len;
  512. }
  513. static int
  514. linuxExtensionsEnabled_write(struct file *file, const char __user *buffer,
  515. unsigned long count, void *data)
  516. {
  517. char c;
  518. int rc;
  519. rc = get_user(c, buffer);
  520. if (rc)
  521. return rc;
  522. if (c == '0' || c == 'n' || c == 'N')
  523. linuxExtEnabled = 0;
  524. else if (c == '1' || c == 'y' || c == 'Y')
  525. linuxExtEnabled = 1;
  526. return count;
  527. }
  528. static int
  529. lookupFlag_read(char *page, char **start, off_t off,
  530. int count, int *eof, void *data)
  531. {
  532. int len;
  533. len = sprintf(page, "%d\n", lookupCacheEnabled);
  534. len -= off;
  535. *start = page + off;
  536. if (len > count)
  537. len = count;
  538. else
  539. *eof = 1;
  540. if (len < 0)
  541. len = 0;
  542. return len;
  543. }
  544. static int
  545. lookupFlag_write(struct file *file, const char __user *buffer,
  546. unsigned long count, void *data)
  547. {
  548. char c;
  549. int rc;
  550. rc = get_user(c, buffer);
  551. if (rc)
  552. return rc;
  553. if (c == '0' || c == 'n' || c == 'N')
  554. lookupCacheEnabled = 0;
  555. else if (c == '1' || c == 'y' || c == 'Y')
  556. lookupCacheEnabled = 1;
  557. return count;
  558. }
  559. static int
  560. traceSMB_read(char *page, char **start, off_t off, int count,
  561. int *eof, void *data)
  562. {
  563. int len;
  564. len = sprintf(page, "%d\n", traceSMB);
  565. len -= off;
  566. *start = page + off;
  567. if (len > count)
  568. len = count;
  569. else
  570. *eof = 1;
  571. if (len < 0)
  572. len = 0;
  573. return len;
  574. }
  575. static int
  576. traceSMB_write(struct file *file, const char __user *buffer,
  577. unsigned long count, void *data)
  578. {
  579. char c;
  580. int rc;
  581. rc = get_user(c, buffer);
  582. if (rc)
  583. return rc;
  584. if (c == '0' || c == 'n' || c == 'N')
  585. traceSMB = 0;
  586. else if (c == '1' || c == 'y' || c == 'Y')
  587. traceSMB = 1;
  588. return count;
  589. }
  590. static int
  591. multiuser_mount_read(char *page, char **start, off_t off,
  592. int count, int *eof, void *data)
  593. {
  594. int len;
  595. len = sprintf(page, "%d\n", multiuser_mount);
  596. len -= off;
  597. *start = page + off;
  598. if (len > count)
  599. len = count;
  600. else
  601. *eof = 1;
  602. if (len < 0)
  603. len = 0;
  604. return len;
  605. }
  606. static int
  607. multiuser_mount_write(struct file *file, const char __user *buffer,
  608. unsigned long count, void *data)
  609. {
  610. char c;
  611. int rc;
  612. rc = get_user(c, buffer);
  613. if (rc)
  614. return rc;
  615. if (c == '0' || c == 'n' || c == 'N')
  616. multiuser_mount = 0;
  617. else if (c == '1' || c == 'y' || c == 'Y')
  618. multiuser_mount = 1;
  619. return count;
  620. }
  621. static int
  622. extended_security_read(char *page, char **start, off_t off,
  623. int count, int *eof, void *data)
  624. {
  625. int len;
  626. len = sprintf(page, "%d\n", extended_security);
  627. len -= off;
  628. *start = page + off;
  629. if (len > count)
  630. len = count;
  631. else
  632. *eof = 1;
  633. if (len < 0)
  634. len = 0;
  635. return len;
  636. }
  637. static int
  638. extended_security_write(struct file *file, const char __user *buffer,
  639. unsigned long count, void *data)
  640. {
  641. char c;
  642. int rc;
  643. rc = get_user(c, buffer);
  644. if (rc)
  645. return rc;
  646. if (c == '0' || c == 'n' || c == 'N')
  647. extended_security = 0;
  648. else if (c == '1' || c == 'y' || c == 'Y')
  649. extended_security = 1;
  650. return count;
  651. }
  652. static int
  653. ntlmv2_enabled_read(char *page, char **start, off_t off,
  654. int count, int *eof, void *data)
  655. {
  656. int len;
  657. len = sprintf(page, "%d\n", ntlmv2_support);
  658. len -= off;
  659. *start = page + off;
  660. if (len > count)
  661. len = count;
  662. else
  663. *eof = 1;
  664. if (len < 0)
  665. len = 0;
  666. return len;
  667. }
  668. static int
  669. ntlmv2_enabled_write(struct file *file, const char __user *buffer,
  670. unsigned long count, void *data)
  671. {
  672. char c;
  673. int rc;
  674. rc = get_user(c, buffer);
  675. if (rc)
  676. return rc;
  677. if (c == '0' || c == 'n' || c == 'N')
  678. ntlmv2_support = 0;
  679. else if (c == '1' || c == 'y' || c == 'Y')
  680. ntlmv2_support = 1;
  681. return count;
  682. }
  683. static int
  684. packet_signing_enabled_read(char *page, char **start, off_t off,
  685. int count, int *eof, void *data)
  686. {
  687. int len;
  688. len = sprintf(page, "%d\n", sign_CIFS_PDUs);
  689. len -= off;
  690. *start = page + off;
  691. if (len > count)
  692. len = count;
  693. else
  694. *eof = 1;
  695. if (len < 0)
  696. len = 0;
  697. return len;
  698. }
  699. static int
  700. packet_signing_enabled_write(struct file *file, const char __user *buffer,
  701. unsigned long count, void *data)
  702. {
  703. char c;
  704. int rc;
  705. rc = get_user(c, buffer);
  706. if (rc)
  707. return rc;
  708. if (c == '0' || c == 'n' || c == 'N')
  709. sign_CIFS_PDUs = 0;
  710. else if (c == '1' || c == 'y' || c == 'Y')
  711. sign_CIFS_PDUs = 1;
  712. else if (c == '2')
  713. sign_CIFS_PDUs = 2;
  714. return count;
  715. }
  716. #endif