cifs_debug.c 18 KB

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