aboutsummaryrefslogtreecommitdiffstats
path: root/fs/cifs/cifs_debug.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/cifs/cifs_debug.c')
-rw-r--r--fs/cifs/cifs_debug.c696
1 files changed, 271 insertions, 425 deletions
diff --git a/fs/cifs/cifs_debug.c b/fs/cifs/cifs_debug.c
index cc950f69e51e..69a12aae91d3 100644
--- a/fs/cifs/cifs_debug.c
+++ b/fs/cifs/cifs_debug.c
@@ -79,27 +79,25 @@ void cifs_dump_mids(struct TCP_Server_Info *server)
79 spin_lock(&GlobalMid_Lock); 79 spin_lock(&GlobalMid_Lock);
80 list_for_each(tmp, &server->pending_mid_q) { 80 list_for_each(tmp, &server->pending_mid_q) {
81 mid_entry = list_entry(tmp, struct mid_q_entry, qhead); 81 mid_entry = list_entry(tmp, struct mid_q_entry, qhead);
82 if (mid_entry) { 82 cERROR(1, ("State: %d Cmd: %d Pid: %d Tsk: %p Mid %d",
83 cERROR(1, ("State: %d Cmd: %d Pid: %d Tsk: %p Mid %d", 83 mid_entry->midState,
84 mid_entry->midState, 84 (int)mid_entry->command,
85 (int)mid_entry->command, 85 mid_entry->pid,
86 mid_entry->pid, 86 mid_entry->tsk,
87 mid_entry->tsk, 87 mid_entry->mid));
88 mid_entry->mid));
89#ifdef CONFIG_CIFS_STATS2 88#ifdef CONFIG_CIFS_STATS2
90 cERROR(1, ("IsLarge: %d buf: %p time rcv: %ld now: %ld", 89 cERROR(1, ("IsLarge: %d buf: %p time rcv: %ld now: %ld",
91 mid_entry->largeBuf, 90 mid_entry->largeBuf,
92 mid_entry->resp_buf, 91 mid_entry->resp_buf,
93 mid_entry->when_received, 92 mid_entry->when_received,
94 jiffies)); 93 jiffies));
95#endif /* STATS2 */ 94#endif /* STATS2 */
96 cERROR(1, ("IsMult: %d IsEnd: %d", mid_entry->multiRsp, 95 cERROR(1, ("IsMult: %d IsEnd: %d", mid_entry->multiRsp,
97 mid_entry->multiEnd)); 96 mid_entry->multiEnd));
98 if (mid_entry->resp_buf) { 97 if (mid_entry->resp_buf) {
99 cifs_dump_detail(mid_entry->resp_buf); 98 cifs_dump_detail(mid_entry->resp_buf);
100 cifs_dump_mem("existing buf: ", 99 cifs_dump_mem("existing buf: ",
101 mid_entry->resp_buf, 62); 100 mid_entry->resp_buf, 62);
102 }
103 } 101 }
104 } 102 }
105 spin_unlock(&GlobalMid_Lock); 103 spin_unlock(&GlobalMid_Lock);
@@ -107,9 +105,7 @@ void cifs_dump_mids(struct TCP_Server_Info *server)
107#endif /* CONFIG_CIFS_DEBUG2 */ 105#endif /* CONFIG_CIFS_DEBUG2 */
108 106
109#ifdef CONFIG_PROC_FS 107#ifdef CONFIG_PROC_FS
110static int 108static int cifs_debug_data_proc_show(struct seq_file *m, void *v)
111cifs_debug_data_read(char *buf, char **beginBuffer, off_t offset,
112 int count, int *eof, void *data)
113{ 109{
114 struct list_head *tmp; 110 struct list_head *tmp;
115 struct list_head *tmp1; 111 struct list_head *tmp1;
@@ -117,23 +113,13 @@ cifs_debug_data_read(char *buf, char **beginBuffer, off_t offset,
117 struct cifsSesInfo *ses; 113 struct cifsSesInfo *ses;
118 struct cifsTconInfo *tcon; 114 struct cifsTconInfo *tcon;
119 int i; 115 int i;
120 int length = 0;
121 char *original_buf = buf;
122
123 *beginBuffer = buf + offset;
124 116
125 length = 117 seq_puts(m,
126 sprintf(buf,
127 "Display Internal CIFS Data Structures for Debugging\n" 118 "Display Internal CIFS Data Structures for Debugging\n"
128 "---------------------------------------------------\n"); 119 "---------------------------------------------------\n");
129 buf += length; 120 seq_printf(m, "CIFS Version %s\n", CIFS_VERSION);
130 length = sprintf(buf, "CIFS Version %s\n", CIFS_VERSION); 121 seq_printf(m, "Active VFS Requests: %d\n", GlobalTotalActiveXid);
131 buf += length; 122 seq_printf(m, "Servers:");
132 length = sprintf(buf,
133 "Active VFS Requests: %d\n", GlobalTotalActiveXid);
134 buf += length;
135 length = sprintf(buf, "Servers:");
136 buf += length;
137 123
138 i = 0; 124 i = 0;
139 read_lock(&GlobalSMBSeslock); 125 read_lock(&GlobalSMBSeslock);
@@ -142,11 +128,10 @@ cifs_debug_data_read(char *buf, char **beginBuffer, off_t offset,
142 ses = list_entry(tmp, struct cifsSesInfo, cifsSessionList); 128 ses = list_entry(tmp, struct cifsSesInfo, cifsSessionList);
143 if ((ses->serverDomain == NULL) || (ses->serverOS == NULL) || 129 if ((ses->serverDomain == NULL) || (ses->serverOS == NULL) ||
144 (ses->serverNOS == NULL)) { 130 (ses->serverNOS == NULL)) {
145 buf += sprintf(buf, "\nentry for %s not fully " 131 seq_printf(m, "\nentry for %s not fully "
146 "displayed\n\t", ses->serverName); 132 "displayed\n\t", ses->serverName);
147 } else { 133 } else {
148 length = 134 seq_printf(m,
149 sprintf(buf,
150 "\n%d) Name: %s Domain: %s Mounts: %d OS:" 135 "\n%d) Name: %s Domain: %s Mounts: %d OS:"
151 " %s \n\tNOS: %s\tCapability: 0x%x\n\tSMB" 136 " %s \n\tNOS: %s\tCapability: 0x%x\n\tSMB"
152 " session status: %d\t", 137 " session status: %d\t",
@@ -154,10 +139,9 @@ cifs_debug_data_read(char *buf, char **beginBuffer, off_t offset,
154 atomic_read(&ses->inUse), 139 atomic_read(&ses->inUse),
155 ses->serverOS, ses->serverNOS, 140 ses->serverOS, ses->serverNOS,
156 ses->capabilities, ses->status); 141 ses->capabilities, ses->status);
157 buf += length;
158 } 142 }
159 if (ses->server) { 143 if (ses->server) {
160 buf += sprintf(buf, "TCP status: %d\n\tLocal Users To " 144 seq_printf(m, "TCP status: %d\n\tLocal Users To "
161 "Server: %d SecMode: 0x%x Req On Wire: %d", 145 "Server: %d SecMode: 0x%x Req On Wire: %d",
162 ses->server->tcpStatus, 146 ses->server->tcpStatus,
163 atomic_read(&ses->server->socketUseCount), 147 atomic_read(&ses->server->socketUseCount),
@@ -165,41 +149,34 @@ cifs_debug_data_read(char *buf, char **beginBuffer, off_t offset,
165 atomic_read(&ses->server->inFlight)); 149 atomic_read(&ses->server->inFlight));
166 150
167#ifdef CONFIG_CIFS_STATS2 151#ifdef CONFIG_CIFS_STATS2
168 buf += sprintf(buf, " In Send: %d In MaxReq Wait: %d", 152 seq_printf(m, " In Send: %d In MaxReq Wait: %d",
169 atomic_read(&ses->server->inSend), 153 atomic_read(&ses->server->inSend),
170 atomic_read(&ses->server->num_waiters)); 154 atomic_read(&ses->server->num_waiters));
171#endif 155#endif
172 156
173 length = sprintf(buf, "\nMIDs:\n"); 157 seq_puts(m, "\nMIDs:\n");
174 buf += length;
175 158
176 spin_lock(&GlobalMid_Lock); 159 spin_lock(&GlobalMid_Lock);
177 list_for_each(tmp1, &ses->server->pending_mid_q) { 160 list_for_each(tmp1, &ses->server->pending_mid_q) {
178 mid_entry = list_entry(tmp1, struct 161 mid_entry = list_entry(tmp1, struct
179 mid_q_entry, 162 mid_q_entry,
180 qhead); 163 qhead);
181 if (mid_entry) { 164 seq_printf(m, "State: %d com: %d pid:"
182 length = sprintf(buf, 165 " %d tsk: %p mid %d\n",
183 "State: %d com: %d pid:" 166 mid_entry->midState,
184 " %d tsk: %p mid %d\n", 167 (int)mid_entry->command,
185 mid_entry->midState, 168 mid_entry->pid,
186 (int)mid_entry->command, 169 mid_entry->tsk,
187 mid_entry->pid, 170 mid_entry->mid);
188 mid_entry->tsk,
189 mid_entry->mid);
190 buf += length;
191 }
192 } 171 }
193 spin_unlock(&GlobalMid_Lock); 172 spin_unlock(&GlobalMid_Lock);
194 } 173 }
195 174
196 } 175 }
197 read_unlock(&GlobalSMBSeslock); 176 read_unlock(&GlobalSMBSeslock);
198 sprintf(buf, "\n"); 177 seq_putc(m, '\n');
199 buf++;
200 178
201 length = sprintf(buf, "Shares:"); 179 seq_puts(m, "Shares:");
202 buf += length;
203 180
204 i = 0; 181 i = 0;
205 read_lock(&GlobalSMBSeslock); 182 read_lock(&GlobalSMBSeslock);
@@ -208,62 +185,52 @@ cifs_debug_data_read(char *buf, char **beginBuffer, off_t offset,
208 i++; 185 i++;
209 tcon = list_entry(tmp, struct cifsTconInfo, cifsConnectionList); 186 tcon = list_entry(tmp, struct cifsTconInfo, cifsConnectionList);
210 dev_type = le32_to_cpu(tcon->fsDevInfo.DeviceType); 187 dev_type = le32_to_cpu(tcon->fsDevInfo.DeviceType);
211 length = sprintf(buf, "\n%d) %s Uses: %d ", i, 188 seq_printf(m, "\n%d) %s Uses: %d ", i,
212 tcon->treeName, atomic_read(&tcon->useCount)); 189 tcon->treeName, atomic_read(&tcon->useCount));
213 buf += length;
214 if (tcon->nativeFileSystem) { 190 if (tcon->nativeFileSystem) {
215 length = sprintf(buf, "Type: %s ", 191 seq_printf(m, "Type: %s ",
216 tcon->nativeFileSystem); 192 tcon->nativeFileSystem);
217 buf += length;
218 } 193 }
219 length = sprintf(buf, "DevInfo: 0x%x Attributes: 0x%x" 194 seq_printf(m, "DevInfo: 0x%x Attributes: 0x%x"
220 "\nPathComponentMax: %d Status: %d", 195 "\nPathComponentMax: %d Status: %d",
221 le32_to_cpu(tcon->fsDevInfo.DeviceCharacteristics), 196 le32_to_cpu(tcon->fsDevInfo.DeviceCharacteristics),
222 le32_to_cpu(tcon->fsAttrInfo.Attributes), 197 le32_to_cpu(tcon->fsAttrInfo.Attributes),
223 le32_to_cpu(tcon->fsAttrInfo.MaxPathNameComponentLength), 198 le32_to_cpu(tcon->fsAttrInfo.MaxPathNameComponentLength),
224 tcon->tidStatus); 199 tcon->tidStatus);
225 buf += length;
226 if (dev_type == FILE_DEVICE_DISK) 200 if (dev_type == FILE_DEVICE_DISK)
227 length = sprintf(buf, " type: DISK "); 201 seq_puts(m, " type: DISK ");
228 else if (dev_type == FILE_DEVICE_CD_ROM) 202 else if (dev_type == FILE_DEVICE_CD_ROM)
229 length = sprintf(buf, " type: CDROM "); 203 seq_puts(m, " type: CDROM ");
230 else 204 else
231 length = 205 seq_printf(m, " type: %d ", dev_type);
232 sprintf(buf, " type: %d ", dev_type); 206
233 buf += length; 207 if (tcon->tidStatus == CifsNeedReconnect)
234 if (tcon->tidStatus == CifsNeedReconnect) { 208 seq_puts(m, "\tDISCONNECTED ");
235 buf += sprintf(buf, "\tDISCONNECTED ");
236 length += 14;
237 }
238 } 209 }
239 read_unlock(&GlobalSMBSeslock); 210 read_unlock(&GlobalSMBSeslock);
240 211
241 length = sprintf(buf, "\n"); 212 seq_putc(m, '\n');
242 buf += length;
243 213
244 /* BB add code to dump additional info such as TCP session info now */ 214 /* BB add code to dump additional info such as TCP session info now */
245 /* Now calculate total size of returned data */ 215 return 0;
246 length = buf - original_buf; 216}
247
248 if (offset + count >= length)
249 *eof = 1;
250 if (length < offset) {
251 *eof = 1;
252 return 0;
253 } else {
254 length = length - offset;
255 }
256 if (length > count)
257 length = count;
258 217
259 return length; 218static int cifs_debug_data_proc_open(struct inode *inode, struct file *file)
219{
220 return single_open(file, cifs_debug_data_proc_show, NULL);
260} 221}
261 222
262#ifdef CONFIG_CIFS_STATS 223static const struct file_operations cifs_debug_data_proc_fops = {
224 .owner = THIS_MODULE,
225 .open = cifs_debug_data_proc_open,
226 .read = seq_read,
227 .llseek = seq_lseek,
228 .release = single_release,
229};
263 230
264static int 231#ifdef CONFIG_CIFS_STATS
265cifs_stats_write(struct file *file, const char __user *buffer, 232static ssize_t cifs_stats_proc_write(struct file *file,
266 unsigned long count, void *data) 233 const char __user *buffer, size_t count, loff_t *ppos)
267{ 234{
268 char c; 235 char c;
269 int rc; 236 int rc;
@@ -307,236 +274,132 @@ cifs_stats_write(struct file *file, const char __user *buffer,
307 return count; 274 return count;
308} 275}
309 276
310static int 277static int cifs_stats_proc_show(struct seq_file *m, void *v)
311cifs_stats_read(char *buf, char **beginBuffer, off_t offset,
312 int count, int *eof, void *data)
313{ 278{
314 int item_length, i, length; 279 int i;
315 struct list_head *tmp; 280 struct list_head *tmp;
316 struct cifsTconInfo *tcon; 281 struct cifsTconInfo *tcon;
317 282
318 *beginBuffer = buf + offset; 283 seq_printf(m,
319
320 length = sprintf(buf,
321 "Resources in use\nCIFS Session: %d\n", 284 "Resources in use\nCIFS Session: %d\n",
322 sesInfoAllocCount.counter); 285 sesInfoAllocCount.counter);
323 buf += length; 286 seq_printf(m, "Share (unique mount targets): %d\n",
324 item_length =
325 sprintf(buf, "Share (unique mount targets): %d\n",
326 tconInfoAllocCount.counter); 287 tconInfoAllocCount.counter);
327 length += item_length; 288 seq_printf(m, "SMB Request/Response Buffer: %d Pool size: %d\n",
328 buf += item_length;
329 item_length =
330 sprintf(buf, "SMB Request/Response Buffer: %d Pool size: %d\n",
331 bufAllocCount.counter, 289 bufAllocCount.counter,
332 cifs_min_rcv + tcpSesAllocCount.counter); 290 cifs_min_rcv + tcpSesAllocCount.counter);
333 length += item_length; 291 seq_printf(m, "SMB Small Req/Resp Buffer: %d Pool size: %d\n",
334 buf += item_length;
335 item_length =
336 sprintf(buf, "SMB Small Req/Resp Buffer: %d Pool size: %d\n",
337 smBufAllocCount.counter, cifs_min_small); 292 smBufAllocCount.counter, cifs_min_small);
338 length += item_length;
339 buf += item_length;
340#ifdef CONFIG_CIFS_STATS2 293#ifdef CONFIG_CIFS_STATS2
341 item_length = sprintf(buf, "Total Large %d Small %d Allocations\n", 294 seq_printf(m, "Total Large %d Small %d Allocations\n",
342 atomic_read(&totBufAllocCount), 295 atomic_read(&totBufAllocCount),
343 atomic_read(&totSmBufAllocCount)); 296 atomic_read(&totSmBufAllocCount));
344 length += item_length;
345 buf += item_length;
346#endif /* CONFIG_CIFS_STATS2 */ 297#endif /* CONFIG_CIFS_STATS2 */
347 298
348 item_length = 299 seq_printf(m, "Operations (MIDs): %d\n", midCount.counter);
349 sprintf(buf, "Operations (MIDs): %d\n", 300 seq_printf(m,
350 midCount.counter);
351 length += item_length;
352 buf += item_length;
353 item_length = sprintf(buf,
354 "\n%d session %d share reconnects\n", 301 "\n%d session %d share reconnects\n",
355 tcpSesReconnectCount.counter, tconInfoReconnectCount.counter); 302 tcpSesReconnectCount.counter, tconInfoReconnectCount.counter);
356 length += item_length;
357 buf += item_length;
358 303
359 item_length = sprintf(buf, 304 seq_printf(m,
360 "Total vfs operations: %d maximum at one time: %d\n", 305 "Total vfs operations: %d maximum at one time: %d\n",
361 GlobalCurrentXid, GlobalMaxActiveXid); 306 GlobalCurrentXid, GlobalMaxActiveXid);
362 length += item_length;
363 buf += item_length;
364 307
365 i = 0; 308 i = 0;
366 read_lock(&GlobalSMBSeslock); 309 read_lock(&GlobalSMBSeslock);
367 list_for_each(tmp, &GlobalTreeConnectionList) { 310 list_for_each(tmp, &GlobalTreeConnectionList) {
368 i++; 311 i++;
369 tcon = list_entry(tmp, struct cifsTconInfo, cifsConnectionList); 312 tcon = list_entry(tmp, struct cifsTconInfo, cifsConnectionList);
370 item_length = sprintf(buf, "\n%d) %s", i, tcon->treeName); 313 seq_printf(m, "\n%d) %s", i, tcon->treeName);
371 buf += item_length; 314 if (tcon->tidStatus == CifsNeedReconnect)
372 length += item_length; 315 seq_puts(m, "\tDISCONNECTED ");
373 if (tcon->tidStatus == CifsNeedReconnect) { 316 seq_printf(m, "\nSMBs: %d Oplock Breaks: %d",
374 buf += sprintf(buf, "\tDISCONNECTED ");
375 length += 14;
376 }
377 item_length = sprintf(buf, "\nSMBs: %d Oplock Breaks: %d",
378 atomic_read(&tcon->num_smbs_sent), 317 atomic_read(&tcon->num_smbs_sent),
379 atomic_read(&tcon->num_oplock_brks)); 318 atomic_read(&tcon->num_oplock_brks));
380 buf += item_length; 319 seq_printf(m, "\nReads: %d Bytes: %lld",
381 length += item_length;
382 item_length = sprintf(buf, "\nReads: %d Bytes: %lld",
383 atomic_read(&tcon->num_reads), 320 atomic_read(&tcon->num_reads),
384 (long long)(tcon->bytes_read)); 321 (long long)(tcon->bytes_read));
385 buf += item_length; 322 seq_printf(m, "\nWrites: %d Bytes: %lld",
386 length += item_length;
387 item_length = sprintf(buf, "\nWrites: %d Bytes: %lld",
388 atomic_read(&tcon->num_writes), 323 atomic_read(&tcon->num_writes),
389 (long long)(tcon->bytes_written)); 324 (long long)(tcon->bytes_written));
390 buf += item_length; 325 seq_printf(m,
391 length += item_length;
392 item_length = sprintf(buf,
393 "\nLocks: %d HardLinks: %d Symlinks: %d", 326 "\nLocks: %d HardLinks: %d Symlinks: %d",
394 atomic_read(&tcon->num_locks), 327 atomic_read(&tcon->num_locks),
395 atomic_read(&tcon->num_hardlinks), 328 atomic_read(&tcon->num_hardlinks),
396 atomic_read(&tcon->num_symlinks)); 329 atomic_read(&tcon->num_symlinks));
397 buf += item_length;
398 length += item_length;
399 330
400 item_length = sprintf(buf, "\nOpens: %d Closes: %d Deletes: %d", 331 seq_printf(m, "\nOpens: %d Closes: %d Deletes: %d",
401 atomic_read(&tcon->num_opens), 332 atomic_read(&tcon->num_opens),
402 atomic_read(&tcon->num_closes), 333 atomic_read(&tcon->num_closes),
403 atomic_read(&tcon->num_deletes)); 334 atomic_read(&tcon->num_deletes));
404 buf += item_length; 335 seq_printf(m, "\nMkdirs: %d Rmdirs: %d",
405 length += item_length;
406 item_length = sprintf(buf, "\nMkdirs: %d Rmdirs: %d",
407 atomic_read(&tcon->num_mkdirs), 336 atomic_read(&tcon->num_mkdirs),
408 atomic_read(&tcon->num_rmdirs)); 337 atomic_read(&tcon->num_rmdirs));
409 buf += item_length; 338 seq_printf(m, "\nRenames: %d T2 Renames %d",
410 length += item_length;
411 item_length = sprintf(buf, "\nRenames: %d T2 Renames %d",
412 atomic_read(&tcon->num_renames), 339 atomic_read(&tcon->num_renames),
413 atomic_read(&tcon->num_t2renames)); 340 atomic_read(&tcon->num_t2renames));
414 buf += item_length; 341 seq_printf(m, "\nFindFirst: %d FNext %d FClose %d",
415 length += item_length;
416 item_length = sprintf(buf, "\nFindFirst: %d FNext %d FClose %d",
417 atomic_read(&tcon->num_ffirst), 342 atomic_read(&tcon->num_ffirst),
418 atomic_read(&tcon->num_fnext), 343 atomic_read(&tcon->num_fnext),
419 atomic_read(&tcon->num_fclose)); 344 atomic_read(&tcon->num_fclose));
420 buf += item_length;
421 length += item_length;
422 } 345 }
423 read_unlock(&GlobalSMBSeslock); 346 read_unlock(&GlobalSMBSeslock);
424 347
425 buf += sprintf(buf, "\n"); 348 seq_putc(m, '\n');
426 length++; 349 return 0;
427 350}
428 if (offset + count >= length)
429 *eof = 1;
430 if (length < offset) {
431 *eof = 1;
432 return 0;
433 } else {
434 length = length - offset;
435 }
436 if (length > count)
437 length = count;
438 351
439 return length; 352static int cifs_stats_proc_open(struct inode *inode, struct file *file)
353{
354 return single_open(file, cifs_stats_proc_show, NULL);
440} 355}
356
357static const struct file_operations cifs_stats_proc_fops = {
358 .owner = THIS_MODULE,
359 .open = cifs_stats_proc_open,
360 .read = seq_read,
361 .llseek = seq_lseek,
362 .release = single_release,
363 .write = cifs_stats_proc_write,
364};
441#endif /* STATS */ 365#endif /* STATS */
442 366
443static struct proc_dir_entry *proc_fs_cifs; 367static struct proc_dir_entry *proc_fs_cifs;
444read_proc_t cifs_txanchor_read; 368static const struct file_operations cifsFYI_proc_fops;
445static read_proc_t cifsFYI_read; 369static const struct file_operations cifs_oplock_proc_fops;
446static write_proc_t cifsFYI_write; 370static const struct file_operations cifs_lookup_cache_proc_fops;
447static read_proc_t oplockEnabled_read; 371static const struct file_operations traceSMB_proc_fops;
448static write_proc_t oplockEnabled_write; 372static const struct file_operations cifs_multiuser_mount_proc_fops;
449static read_proc_t lookupFlag_read; 373static const struct file_operations cifs_security_flags_proc_fops;
450static write_proc_t lookupFlag_write; 374static const struct file_operations cifs_experimental_proc_fops;
451static read_proc_t traceSMB_read; 375static const struct file_operations cifs_linux_ext_proc_fops;
452static write_proc_t traceSMB_write;
453static read_proc_t multiuser_mount_read;
454static write_proc_t multiuser_mount_write;
455static read_proc_t security_flags_read;
456static write_proc_t security_flags_write;
457/* static read_proc_t ntlmv2_enabled_read;
458static write_proc_t ntlmv2_enabled_write;
459static read_proc_t packet_signing_enabled_read;
460static write_proc_t packet_signing_enabled_write;*/
461static read_proc_t experimEnabled_read;
462static write_proc_t experimEnabled_write;
463static read_proc_t linuxExtensionsEnabled_read;
464static write_proc_t linuxExtensionsEnabled_write;
465 376
466void 377void
467cifs_proc_init(void) 378cifs_proc_init(void)
468{ 379{
469 struct proc_dir_entry *pde;
470
471 proc_fs_cifs = proc_mkdir("fs/cifs", NULL); 380 proc_fs_cifs = proc_mkdir("fs/cifs", NULL);
472 if (proc_fs_cifs == NULL) 381 if (proc_fs_cifs == NULL)
473 return; 382 return;
474 383
475 proc_fs_cifs->owner = THIS_MODULE; 384 proc_fs_cifs->owner = THIS_MODULE;
476 create_proc_read_entry("DebugData", 0, proc_fs_cifs, 385 proc_create("DebugData", 0, proc_fs_cifs, &cifs_debug_data_proc_fops);
477 cifs_debug_data_read, NULL);
478 386
479#ifdef CONFIG_CIFS_STATS 387#ifdef CONFIG_CIFS_STATS
480 pde = create_proc_read_entry("Stats", 0, proc_fs_cifs, 388 proc_create("Stats", 0, proc_fs_cifs, &cifs_stats_proc_fops);
481 cifs_stats_read, NULL);
482 if (pde)
483 pde->write_proc = cifs_stats_write;
484#endif /* STATS */ 389#endif /* STATS */
485 pde = create_proc_read_entry("cifsFYI", 0, proc_fs_cifs, 390 proc_create("cifsFYI", 0, proc_fs_cifs, &cifsFYI_proc_fops);
486 cifsFYI_read, NULL); 391 proc_create("traceSMB", 0, proc_fs_cifs, &traceSMB_proc_fops);
487 if (pde) 392 proc_create("OplockEnabled", 0, proc_fs_cifs, &cifs_oplock_proc_fops);
488 pde->write_proc = cifsFYI_write; 393 proc_create("Experimental", 0, proc_fs_cifs,
489 394 &cifs_experimental_proc_fops);
490 pde = 395 proc_create("LinuxExtensionsEnabled", 0, proc_fs_cifs,
491 create_proc_read_entry("traceSMB", 0, proc_fs_cifs, 396 &cifs_linux_ext_proc_fops);
492 traceSMB_read, NULL); 397 proc_create("MultiuserMount", 0, proc_fs_cifs,
493 if (pde) 398 &cifs_multiuser_mount_proc_fops);
494 pde->write_proc = traceSMB_write; 399 proc_create("SecurityFlags", 0, proc_fs_cifs,
495 400 &cifs_security_flags_proc_fops);
496 pde = create_proc_read_entry("OplockEnabled", 0, proc_fs_cifs, 401 proc_create("LookupCacheEnabled", 0, proc_fs_cifs,
497 oplockEnabled_read, NULL); 402 &cifs_lookup_cache_proc_fops);
498 if (pde)
499 pde->write_proc = oplockEnabled_write;
500
501 pde = create_proc_read_entry("Experimental", 0, proc_fs_cifs,
502 experimEnabled_read, NULL);
503 if (pde)
504 pde->write_proc = experimEnabled_write;
505
506 pde = create_proc_read_entry("LinuxExtensionsEnabled", 0, proc_fs_cifs,
507 linuxExtensionsEnabled_read, NULL);
508 if (pde)
509 pde->write_proc = linuxExtensionsEnabled_write;
510
511 pde =
512 create_proc_read_entry("MultiuserMount", 0, proc_fs_cifs,
513 multiuser_mount_read, NULL);
514 if (pde)
515 pde->write_proc = multiuser_mount_write;
516
517 pde =
518 create_proc_read_entry("SecurityFlags", 0, proc_fs_cifs,
519 security_flags_read, NULL);
520 if (pde)
521 pde->write_proc = security_flags_write;
522
523 pde =
524 create_proc_read_entry("LookupCacheEnabled", 0, proc_fs_cifs,
525 lookupFlag_read, NULL);
526 if (pde)
527 pde->write_proc = lookupFlag_write;
528
529/* pde =
530 create_proc_read_entry("NTLMV2Enabled", 0, proc_fs_cifs,
531 ntlmv2_enabled_read, NULL);
532 if (pde)
533 pde->write_proc = ntlmv2_enabled_write;
534
535 pde =
536 create_proc_read_entry("PacketSigningEnabled", 0, proc_fs_cifs,
537 packet_signing_enabled_read, NULL);
538 if (pde)
539 pde->write_proc = packet_signing_enabled_write;*/
540} 403}
541 404
542void 405void
@@ -553,39 +416,26 @@ cifs_proc_clean(void)
553#endif 416#endif
554 remove_proc_entry("MultiuserMount", proc_fs_cifs); 417 remove_proc_entry("MultiuserMount", proc_fs_cifs);
555 remove_proc_entry("OplockEnabled", proc_fs_cifs); 418 remove_proc_entry("OplockEnabled", proc_fs_cifs);
556/* remove_proc_entry("NTLMV2Enabled",proc_fs_cifs); */
557 remove_proc_entry("SecurityFlags", proc_fs_cifs); 419 remove_proc_entry("SecurityFlags", proc_fs_cifs);
558/* remove_proc_entry("PacketSigningEnabled", proc_fs_cifs); */
559 remove_proc_entry("LinuxExtensionsEnabled", proc_fs_cifs); 420 remove_proc_entry("LinuxExtensionsEnabled", proc_fs_cifs);
560 remove_proc_entry("Experimental", proc_fs_cifs); 421 remove_proc_entry("Experimental", proc_fs_cifs);
561 remove_proc_entry("LookupCacheEnabled", proc_fs_cifs); 422 remove_proc_entry("LookupCacheEnabled", proc_fs_cifs);
562 remove_proc_entry("fs/cifs", NULL); 423 remove_proc_entry("fs/cifs", NULL);
563} 424}
564 425
565static int 426static int cifsFYI_proc_show(struct seq_file *m, void *v)
566cifsFYI_read(char *page, char **start, off_t off, int count,
567 int *eof, void *data)
568{ 427{
569 int len; 428 seq_printf(m, "%d\n", cifsFYI);
570 429 return 0;
571 len = sprintf(page, "%d\n", cifsFYI); 430}
572
573 len -= off;
574 *start = page + off;
575
576 if (len > count)
577 len = count;
578 else
579 *eof = 1;
580
581 if (len < 0)
582 len = 0;
583 431
584 return len; 432static int cifsFYI_proc_open(struct inode *inode, struct file *file)
433{
434 return single_open(file, cifsFYI_proc_show, NULL);
585} 435}
586static int 436
587cifsFYI_write(struct file *file, const char __user *buffer, 437static ssize_t cifsFYI_proc_write(struct file *file, const char __user *buffer,
588 unsigned long count, void *data) 438 size_t count, loff_t *ppos)
589{ 439{
590 char c; 440 char c;
591 int rc; 441 int rc;
@@ -603,30 +453,28 @@ cifsFYI_write(struct file *file, const char __user *buffer,
603 return count; 453 return count;
604} 454}
605 455
606static int 456static const struct file_operations cifsFYI_proc_fops = {
607oplockEnabled_read(char *page, char **start, off_t off, 457 .owner = THIS_MODULE,
608 int count, int *eof, void *data) 458 .open = cifsFYI_proc_open,
609{ 459 .read = seq_read,
610 int len; 460 .llseek = seq_lseek,
611 461 .release = single_release,
612 len = sprintf(page, "%d\n", oplockEnabled); 462 .write = cifsFYI_proc_write,
613 463};
614 len -= off;
615 *start = page + off;
616 464
617 if (len > count) 465static int cifs_oplock_proc_show(struct seq_file *m, void *v)
618 len = count; 466{
619 else 467 seq_printf(m, "%d\n", oplockEnabled);
620 *eof = 1; 468 return 0;
621 469}
622 if (len < 0)
623 len = 0;
624 470
625 return len; 471static int cifs_oplock_proc_open(struct inode *inode, struct file *file)
472{
473 return single_open(file, cifs_oplock_proc_show, NULL);
626} 474}
627static int 475
628oplockEnabled_write(struct file *file, const char __user *buffer, 476static ssize_t cifs_oplock_proc_write(struct file *file,
629 unsigned long count, void *data) 477 const char __user *buffer, size_t count, loff_t *ppos)
630{ 478{
631 char c; 479 char c;
632 int rc; 480 int rc;
@@ -642,30 +490,28 @@ oplockEnabled_write(struct file *file, const char __user *buffer,
642 return count; 490 return count;
643} 491}
644 492
645static int 493static const struct file_operations cifs_oplock_proc_fops = {
646experimEnabled_read(char *page, char **start, off_t off, 494 .owner = THIS_MODULE,
647 int count, int *eof, void *data) 495 .open = cifs_oplock_proc_open,
648{ 496 .read = seq_read,
649 int len; 497 .llseek = seq_lseek,
650 498 .release = single_release,
651 len = sprintf(page, "%d\n", experimEnabled); 499 .write = cifs_oplock_proc_write,
500};
652 501
653 len -= off; 502static int cifs_experimental_proc_show(struct seq_file *m, void *v)
654 *start = page + off; 503{
655 504 seq_printf(m, "%d\n", experimEnabled);
656 if (len > count) 505 return 0;
657 len = count; 506}
658 else
659 *eof = 1;
660
661 if (len < 0)
662 len = 0;
663 507
664 return len; 508static int cifs_experimental_proc_open(struct inode *inode, struct file *file)
509{
510 return single_open(file, cifs_experimental_proc_show, NULL);
665} 511}
666static int 512
667experimEnabled_write(struct file *file, const char __user *buffer, 513static ssize_t cifs_experimental_proc_write(struct file *file,
668 unsigned long count, void *data) 514 const char __user *buffer, size_t count, loff_t *ppos)
669{ 515{
670 char c; 516 char c;
671 int rc; 517 int rc;
@@ -683,29 +529,28 @@ experimEnabled_write(struct file *file, const char __user *buffer,
683 return count; 529 return count;
684} 530}
685 531
686static int 532static const struct file_operations cifs_experimental_proc_fops = {
687linuxExtensionsEnabled_read(char *page, char **start, off_t off, 533 .owner = THIS_MODULE,
688 int count, int *eof, void *data) 534 .open = cifs_experimental_proc_open,
689{ 535 .read = seq_read,
690 int len; 536 .llseek = seq_lseek,
691 537 .release = single_release,
692 len = sprintf(page, "%d\n", linuxExtEnabled); 538 .write = cifs_experimental_proc_write,
693 len -= off; 539};
694 *start = page + off;
695 540
696 if (len > count) 541static int cifs_linux_ext_proc_show(struct seq_file *m, void *v)
697 len = count; 542{
698 else 543 seq_printf(m, "%d\n", linuxExtEnabled);
699 *eof = 1; 544 return 0;
700 545}
701 if (len < 0)
702 len = 0;
703 546
704 return len; 547static int cifs_linux_ext_proc_open(struct inode *inode, struct file *file)
548{
549 return single_open(file, cifs_linux_ext_proc_show, NULL);
705} 550}
706static int 551
707linuxExtensionsEnabled_write(struct file *file, const char __user *buffer, 552static ssize_t cifs_linux_ext_proc_write(struct file *file,
708 unsigned long count, void *data) 553 const char __user *buffer, size_t count, loff_t *ppos)
709{ 554{
710 char c; 555 char c;
711 int rc; 556 int rc;
@@ -721,31 +566,28 @@ linuxExtensionsEnabled_write(struct file *file, const char __user *buffer,
721 return count; 566 return count;
722} 567}
723 568
569static const struct file_operations cifs_linux_ext_proc_fops = {
570 .owner = THIS_MODULE,
571 .open = cifs_linux_ext_proc_open,
572 .read = seq_read,
573 .llseek = seq_lseek,
574 .release = single_release,
575 .write = cifs_linux_ext_proc_write,
576};
724 577
725static int 578static int cifs_lookup_cache_proc_show(struct seq_file *m, void *v)
726lookupFlag_read(char *page, char **start, off_t off,
727 int count, int *eof, void *data)
728{ 579{
729 int len; 580 seq_printf(m, "%d\n", lookupCacheEnabled);
730 581 return 0;
731 len = sprintf(page, "%d\n", lookupCacheEnabled); 582}
732
733 len -= off;
734 *start = page + off;
735
736 if (len > count)
737 len = count;
738 else
739 *eof = 1;
740
741 if (len < 0)
742 len = 0;
743 583
744 return len; 584static int cifs_lookup_cache_proc_open(struct inode *inode, struct file *file)
585{
586 return single_open(file, cifs_lookup_cache_proc_show, NULL);
745} 587}
746static int 588
747lookupFlag_write(struct file *file, const char __user *buffer, 589static ssize_t cifs_lookup_cache_proc_write(struct file *file,
748 unsigned long count, void *data) 590 const char __user *buffer, size_t count, loff_t *ppos)
749{ 591{
750 char c; 592 char c;
751 int rc; 593 int rc;
@@ -760,30 +602,29 @@ lookupFlag_write(struct file *file, const char __user *buffer,
760 602
761 return count; 603 return count;
762} 604}
763static int
764traceSMB_read(char *page, char **start, off_t off, int count,
765 int *eof, void *data)
766{
767 int len;
768
769 len = sprintf(page, "%d\n", traceSMB);
770
771 len -= off;
772 *start = page + off;
773 605
774 if (len > count) 606static const struct file_operations cifs_lookup_cache_proc_fops = {
775 len = count; 607 .owner = THIS_MODULE,
776 else 608 .open = cifs_lookup_cache_proc_open,
777 *eof = 1; 609 .read = seq_read,
610 .llseek = seq_lseek,
611 .release = single_release,
612 .write = cifs_lookup_cache_proc_write,
613};
778 614
779 if (len < 0) 615static int traceSMB_proc_show(struct seq_file *m, void *v)
780 len = 0; 616{
617 seq_printf(m, "%d\n", traceSMB);
618 return 0;
619}
781 620
782 return len; 621static int traceSMB_proc_open(struct inode *inode, struct file *file)
622{
623 return single_open(file, traceSMB_proc_show, NULL);
783} 624}
784static int 625
785traceSMB_write(struct file *file, const char __user *buffer, 626static ssize_t traceSMB_proc_write(struct file *file, const char __user *buffer,
786 unsigned long count, void *data) 627 size_t count, loff_t *ppos)
787{ 628{
788 char c; 629 char c;
789 int rc; 630 int rc;
@@ -799,30 +640,28 @@ traceSMB_write(struct file *file, const char __user *buffer,
799 return count; 640 return count;
800} 641}
801 642
802static int 643static const struct file_operations traceSMB_proc_fops = {
803multiuser_mount_read(char *page, char **start, off_t off, 644 .owner = THIS_MODULE,
804 int count, int *eof, void *data) 645 .open = traceSMB_proc_open,
805{ 646 .read = seq_read,
806 int len; 647 .llseek = seq_lseek,
807 648 .release = single_release,
808 len = sprintf(page, "%d\n", multiuser_mount); 649 .write = traceSMB_proc_write,
809 650};
810 len -= off;
811 *start = page + off;
812 651
813 if (len > count) 652static int cifs_multiuser_mount_proc_show(struct seq_file *m, void *v)
814 len = count; 653{
815 else 654 seq_printf(m, "%d\n", multiuser_mount);
816 *eof = 1; 655 return 0;
817 656}
818 if (len < 0)
819 len = 0;
820 657
821 return len; 658static int cifs_multiuser_mount_proc_open(struct inode *inode, struct file *fh)
659{
660 return single_open(fh, cifs_multiuser_mount_proc_show, NULL);
822} 661}
823static int 662
824multiuser_mount_write(struct file *file, const char __user *buffer, 663static ssize_t cifs_multiuser_mount_proc_write(struct file *file,
825 unsigned long count, void *data) 664 const char __user *buffer, size_t count, loff_t *ppos)
826{ 665{
827 char c; 666 char c;
828 int rc; 667 int rc;
@@ -838,30 +677,28 @@ multiuser_mount_write(struct file *file, const char __user *buffer,
838 return count; 677 return count;
839} 678}
840 679
841static int 680static const struct file_operations cifs_multiuser_mount_proc_fops = {
842security_flags_read(char *page, char **start, off_t off, 681 .owner = THIS_MODULE,
843 int count, int *eof, void *data) 682 .open = cifs_multiuser_mount_proc_open,
844{ 683 .read = seq_read,
845 int len; 684 .llseek = seq_lseek,
846 685 .release = single_release,
847 len = sprintf(page, "0x%x\n", extended_security); 686 .write = cifs_multiuser_mount_proc_write,
848 687};
849 len -= off;
850 *start = page + off;
851 688
852 if (len > count) 689static int cifs_security_flags_proc_show(struct seq_file *m, void *v)
853 len = count; 690{
854 else 691 seq_printf(m, "0x%x\n", extended_security);
855 *eof = 1; 692 return 0;
856 693}
857 if (len < 0)
858 len = 0;
859 694
860 return len; 695static int cifs_security_flags_proc_open(struct inode *inode, struct file *file)
696{
697 return single_open(file, cifs_security_flags_proc_show, NULL);
861} 698}
862static int 699
863security_flags_write(struct file *file, const char __user *buffer, 700static ssize_t cifs_security_flags_proc_write(struct file *file,
864 unsigned long count, void *data) 701 const char __user *buffer, size_t count, loff_t *ppos)
865{ 702{
866 unsigned int flags; 703 unsigned int flags;
867 char flags_string[12]; 704 char flags_string[12];
@@ -917,6 +754,15 @@ security_flags_write(struct file *file, const char __user *buffer,
917 /* BB should we turn on MAY flags for other MUST options? */ 754 /* BB should we turn on MAY flags for other MUST options? */
918 return count; 755 return count;
919} 756}
757
758static const struct file_operations cifs_security_flags_proc_fops = {
759 .owner = THIS_MODULE,
760 .open = cifs_security_flags_proc_open,
761 .read = seq_read,
762 .llseek = seq_lseek,
763 .release = single_release,
764 .write = cifs_security_flags_proc_write,
765};
920#else 766#else
921inline void cifs_proc_init(void) 767inline void cifs_proc_init(void)
922{ 768{