aboutsummaryrefslogtreecommitdiffstats
path: root/fs/cifs/cifs_debug.c
diff options
context:
space:
mode:
authorAlexey Dobriyan <adobriyan@gmail.com>2008-07-23 22:34:24 -0400
committerSteve French <sfrench@us.ibm.com>2008-07-23 22:34:24 -0400
commitf984c7b98253c541ed6e702ee521f6a84c8113d4 (patch)
tree1940c0769c3a8e61d82260381fdf531b8966197f /fs/cifs/cifs_debug.c
parent5ca33c6ac30596fc1403a092f46ea48c406734e4 (diff)
Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Cc: Steven French <sfrench@us.ibm.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Steve French <sfrench@us.ibm.com>
Diffstat (limited to 'fs/cifs/cifs_debug.c')
-rw-r--r--fs/cifs/cifs_debug.c636
1 files changed, 241 insertions, 395 deletions
diff --git a/fs/cifs/cifs_debug.c b/fs/cifs/cifs_debug.c
index cc950f69e51e..73925a77375e 100644
--- a/fs/cifs/cifs_debug.c
+++ b/fs/cifs/cifs_debug.c
@@ -107,9 +107,7 @@ void cifs_dump_mids(struct TCP_Server_Info *server)
107#endif /* CONFIG_CIFS_DEBUG2 */ 107#endif /* CONFIG_CIFS_DEBUG2 */
108 108
109#ifdef CONFIG_PROC_FS 109#ifdef CONFIG_PROC_FS
110static int 110static 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{ 111{
114 struct list_head *tmp; 112 struct list_head *tmp;
115 struct list_head *tmp1; 113 struct list_head *tmp1;
@@ -117,23 +115,13 @@ cifs_debug_data_read(char *buf, char **beginBuffer, off_t offset,
117 struct cifsSesInfo *ses; 115 struct cifsSesInfo *ses;
118 struct cifsTconInfo *tcon; 116 struct cifsTconInfo *tcon;
119 int i; 117 int i;
120 int length = 0;
121 char *original_buf = buf;
122 118
123 *beginBuffer = buf + offset; 119 seq_puts(m,
124
125 length =
126 sprintf(buf,
127 "Display Internal CIFS Data Structures for Debugging\n" 120 "Display Internal CIFS Data Structures for Debugging\n"
128 "---------------------------------------------------\n"); 121 "---------------------------------------------------\n");
129 buf += length; 122 seq_printf(m, "CIFS Version %s\n", CIFS_VERSION);
130 length = sprintf(buf, "CIFS Version %s\n", CIFS_VERSION); 123 seq_printf(m, "Active VFS Requests: %d\n", GlobalTotalActiveXid);
131 buf += length; 124 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 125
138 i = 0; 126 i = 0;
139 read_lock(&GlobalSMBSeslock); 127 read_lock(&GlobalSMBSeslock);
@@ -142,11 +130,10 @@ cifs_debug_data_read(char *buf, char **beginBuffer, off_t offset,
142 ses = list_entry(tmp, struct cifsSesInfo, cifsSessionList); 130 ses = list_entry(tmp, struct cifsSesInfo, cifsSessionList);
143 if ((ses->serverDomain == NULL) || (ses->serverOS == NULL) || 131 if ((ses->serverDomain == NULL) || (ses->serverOS == NULL) ||
144 (ses->serverNOS == NULL)) { 132 (ses->serverNOS == NULL)) {
145 buf += sprintf(buf, "\nentry for %s not fully " 133 seq_printf(m, "\nentry for %s not fully "
146 "displayed\n\t", ses->serverName); 134 "displayed\n\t", ses->serverName);
147 } else { 135 } else {
148 length = 136 seq_printf(m,
149 sprintf(buf,
150 "\n%d) Name: %s Domain: %s Mounts: %d OS:" 137 "\n%d) Name: %s Domain: %s Mounts: %d OS:"
151 " %s \n\tNOS: %s\tCapability: 0x%x\n\tSMB" 138 " %s \n\tNOS: %s\tCapability: 0x%x\n\tSMB"
152 " session status: %d\t", 139 " session status: %d\t",
@@ -154,10 +141,9 @@ cifs_debug_data_read(char *buf, char **beginBuffer, off_t offset,
154 atomic_read(&ses->inUse), 141 atomic_read(&ses->inUse),
155 ses->serverOS, ses->serverNOS, 142 ses->serverOS, ses->serverNOS,
156 ses->capabilities, ses->status); 143 ses->capabilities, ses->status);
157 buf += length;
158 } 144 }
159 if (ses->server) { 145 if (ses->server) {
160 buf += sprintf(buf, "TCP status: %d\n\tLocal Users To " 146 seq_printf(m, "TCP status: %d\n\tLocal Users To "
161 "Server: %d SecMode: 0x%x Req On Wire: %d", 147 "Server: %d SecMode: 0x%x Req On Wire: %d",
162 ses->server->tcpStatus, 148 ses->server->tcpStatus,
163 atomic_read(&ses->server->socketUseCount), 149 atomic_read(&ses->server->socketUseCount),
@@ -165,13 +151,12 @@ cifs_debug_data_read(char *buf, char **beginBuffer, off_t offset,
165 atomic_read(&ses->server->inFlight)); 151 atomic_read(&ses->server->inFlight));
166 152
167#ifdef CONFIG_CIFS_STATS2 153#ifdef CONFIG_CIFS_STATS2
168 buf += sprintf(buf, " In Send: %d In MaxReq Wait: %d", 154 seq_printf(m, " In Send: %d In MaxReq Wait: %d",
169 atomic_read(&ses->server->inSend), 155 atomic_read(&ses->server->inSend),
170 atomic_read(&ses->server->num_waiters)); 156 atomic_read(&ses->server->num_waiters));
171#endif 157#endif
172 158
173 length = sprintf(buf, "\nMIDs:\n"); 159 seq_puts(m, "\nMIDs:\n");
174 buf += length;
175 160
176 spin_lock(&GlobalMid_Lock); 161 spin_lock(&GlobalMid_Lock);
177 list_for_each(tmp1, &ses->server->pending_mid_q) { 162 list_for_each(tmp1, &ses->server->pending_mid_q) {
@@ -179,7 +164,7 @@ cifs_debug_data_read(char *buf, char **beginBuffer, off_t offset,
179 mid_q_entry, 164 mid_q_entry,
180 qhead); 165 qhead);
181 if (mid_entry) { 166 if (mid_entry) {
182 length = sprintf(buf, 167 seq_printf(m,
183 "State: %d com: %d pid:" 168 "State: %d com: %d pid:"
184 " %d tsk: %p mid %d\n", 169 " %d tsk: %p mid %d\n",
185 mid_entry->midState, 170 mid_entry->midState,
@@ -187,7 +172,6 @@ cifs_debug_data_read(char *buf, char **beginBuffer, off_t offset,
187 mid_entry->pid, 172 mid_entry->pid,
188 mid_entry->tsk, 173 mid_entry->tsk,
189 mid_entry->mid); 174 mid_entry->mid);
190 buf += length;
191 } 175 }
192 } 176 }
193 spin_unlock(&GlobalMid_Lock); 177 spin_unlock(&GlobalMid_Lock);
@@ -195,11 +179,9 @@ cifs_debug_data_read(char *buf, char **beginBuffer, off_t offset,
195 179
196 } 180 }
197 read_unlock(&GlobalSMBSeslock); 181 read_unlock(&GlobalSMBSeslock);
198 sprintf(buf, "\n"); 182 seq_putc(m, '\n');
199 buf++;
200 183
201 length = sprintf(buf, "Shares:"); 184 seq_puts(m, "Shares:");
202 buf += length;
203 185
204 i = 0; 186 i = 0;
205 read_lock(&GlobalSMBSeslock); 187 read_lock(&GlobalSMBSeslock);
@@ -208,62 +190,52 @@ cifs_debug_data_read(char *buf, char **beginBuffer, off_t offset,
208 i++; 190 i++;
209 tcon = list_entry(tmp, struct cifsTconInfo, cifsConnectionList); 191 tcon = list_entry(tmp, struct cifsTconInfo, cifsConnectionList);
210 dev_type = le32_to_cpu(tcon->fsDevInfo.DeviceType); 192 dev_type = le32_to_cpu(tcon->fsDevInfo.DeviceType);
211 length = sprintf(buf, "\n%d) %s Uses: %d ", i, 193 seq_printf(m, "\n%d) %s Uses: %d ", i,
212 tcon->treeName, atomic_read(&tcon->useCount)); 194 tcon->treeName, atomic_read(&tcon->useCount));
213 buf += length;
214 if (tcon->nativeFileSystem) { 195 if (tcon->nativeFileSystem) {
215 length = sprintf(buf, "Type: %s ", 196 seq_printf(m, "Type: %s ",
216 tcon->nativeFileSystem); 197 tcon->nativeFileSystem);
217 buf += length;
218 } 198 }
219 length = sprintf(buf, "DevInfo: 0x%x Attributes: 0x%x" 199 seq_printf(m, "DevInfo: 0x%x Attributes: 0x%x"
220 "\nPathComponentMax: %d Status: %d", 200 "\nPathComponentMax: %d Status: %d",
221 le32_to_cpu(tcon->fsDevInfo.DeviceCharacteristics), 201 le32_to_cpu(tcon->fsDevInfo.DeviceCharacteristics),
222 le32_to_cpu(tcon->fsAttrInfo.Attributes), 202 le32_to_cpu(tcon->fsAttrInfo.Attributes),
223 le32_to_cpu(tcon->fsAttrInfo.MaxPathNameComponentLength), 203 le32_to_cpu(tcon->fsAttrInfo.MaxPathNameComponentLength),
224 tcon->tidStatus); 204 tcon->tidStatus);
225 buf += length;
226 if (dev_type == FILE_DEVICE_DISK) 205 if (dev_type == FILE_DEVICE_DISK)
227 length = sprintf(buf, " type: DISK "); 206 seq_puts(m, " type: DISK ");
228 else if (dev_type == FILE_DEVICE_CD_ROM) 207 else if (dev_type == FILE_DEVICE_CD_ROM)
229 length = sprintf(buf, " type: CDROM "); 208 seq_puts(m, " type: CDROM ");
230 else 209 else
231 length = 210 seq_printf(m, " type: %d ", dev_type);
232 sprintf(buf, " type: %d ", dev_type);
233 buf += length;
234 if (tcon->tidStatus == CifsNeedReconnect) { 211 if (tcon->tidStatus == CifsNeedReconnect) {
235 buf += sprintf(buf, "\tDISCONNECTED "); 212 seq_puts(m, "\tDISCONNECTED ");
236 length += 14;
237 } 213 }
238 } 214 }
239 read_unlock(&GlobalSMBSeslock); 215 read_unlock(&GlobalSMBSeslock);
240 216
241 length = sprintf(buf, "\n"); 217 seq_putc(m, '\n');
242 buf += length;
243 218
244 /* BB add code to dump additional info such as TCP session info now */ 219 /* BB add code to dump additional info such as TCP session info now */
245 /* Now calculate total size of returned data */ 220 return 0;
246 length = buf - original_buf; 221}
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 222
259 return length; 223static int cifs_debug_data_proc_open(struct inode *inode, struct file *file)
224{
225 return single_open(file, cifs_debug_data_proc_show, NULL);
260} 226}
261 227
262#ifdef CONFIG_CIFS_STATS 228static const struct file_operations cifs_debug_data_proc_fops = {
229 .owner = THIS_MODULE,
230 .open = cifs_debug_data_proc_open,
231 .read = seq_read,
232 .llseek = seq_lseek,
233 .release = single_release,
234};
263 235
264static int 236#ifdef CONFIG_CIFS_STATS
265cifs_stats_write(struct file *file, const char __user *buffer, 237static ssize_t cifs_stats_proc_write(struct file *file,
266 unsigned long count, void *data) 238 const char __user *buffer, size_t count, loff_t *ppos)
267{ 239{
268 char c; 240 char c;
269 int rc; 241 int rc;
@@ -307,236 +279,127 @@ cifs_stats_write(struct file *file, const char __user *buffer,
307 return count; 279 return count;
308} 280}
309 281
310static int 282static 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{ 283{
314 int item_length, i, length; 284 int i;
315 struct list_head *tmp; 285 struct list_head *tmp;
316 struct cifsTconInfo *tcon; 286 struct cifsTconInfo *tcon;
317 287
318 *beginBuffer = buf + offset; 288 seq_printf(m,
319
320 length = sprintf(buf,
321 "Resources in use\nCIFS Session: %d\n", 289 "Resources in use\nCIFS Session: %d\n",
322 sesInfoAllocCount.counter); 290 sesInfoAllocCount.counter);
323 buf += length; 291 seq_printf(m, "Share (unique mount targets): %d\n",
324 item_length =
325 sprintf(buf, "Share (unique mount targets): %d\n",
326 tconInfoAllocCount.counter); 292 tconInfoAllocCount.counter);
327 length += item_length; 293 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, 294 bufAllocCount.counter,
332 cifs_min_rcv + tcpSesAllocCount.counter); 295 cifs_min_rcv + tcpSesAllocCount.counter);
333 length += item_length; 296 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); 297 smBufAllocCount.counter, cifs_min_small);
338 length += item_length;
339 buf += item_length;
340#ifdef CONFIG_CIFS_STATS2 298#ifdef CONFIG_CIFS_STATS2
341 item_length = sprintf(buf, "Total Large %d Small %d Allocations\n", 299 seq_printf(m, "Total Large %d Small %d Allocations\n",
342 atomic_read(&totBufAllocCount), 300 atomic_read(&totBufAllocCount),
343 atomic_read(&totSmBufAllocCount)); 301 atomic_read(&totSmBufAllocCount));
344 length += item_length;
345 buf += item_length;
346#endif /* CONFIG_CIFS_STATS2 */ 302#endif /* CONFIG_CIFS_STATS2 */
347 303
348 item_length = 304 seq_printf(m, "Operations (MIDs): %d\n", midCount.counter);
349 sprintf(buf, "Operations (MIDs): %d\n", 305 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", 306 "\n%d session %d share reconnects\n",
355 tcpSesReconnectCount.counter, tconInfoReconnectCount.counter); 307 tcpSesReconnectCount.counter, tconInfoReconnectCount.counter);
356 length += item_length;
357 buf += item_length;
358 308
359 item_length = sprintf(buf, 309 seq_printf(m,
360 "Total vfs operations: %d maximum at one time: %d\n", 310 "Total vfs operations: %d maximum at one time: %d\n",
361 GlobalCurrentXid, GlobalMaxActiveXid); 311 GlobalCurrentXid, GlobalMaxActiveXid);
362 length += item_length;
363 buf += item_length;
364 312
365 i = 0; 313 i = 0;
366 read_lock(&GlobalSMBSeslock); 314 read_lock(&GlobalSMBSeslock);
367 list_for_each(tmp, &GlobalTreeConnectionList) { 315 list_for_each(tmp, &GlobalTreeConnectionList) {
368 i++; 316 i++;
369 tcon = list_entry(tmp, struct cifsTconInfo, cifsConnectionList); 317 tcon = list_entry(tmp, struct cifsTconInfo, cifsConnectionList);
370 item_length = sprintf(buf, "\n%d) %s", i, tcon->treeName); 318 seq_printf(m, "\n%d) %s", i, tcon->treeName);
371 buf += item_length; 319 if (tcon->tidStatus == CifsNeedReconnect)
372 length += item_length; 320 seq_puts(m, "\tDISCONNECTED ");
373 if (tcon->tidStatus == CifsNeedReconnect) { 321 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), 322 atomic_read(&tcon->num_smbs_sent),
379 atomic_read(&tcon->num_oplock_brks)); 323 atomic_read(&tcon->num_oplock_brks));
380 buf += item_length; 324 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), 325 atomic_read(&tcon->num_reads),
384 (long long)(tcon->bytes_read)); 326 (long long)(tcon->bytes_read));
385 buf += item_length; 327 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), 328 atomic_read(&tcon->num_writes),
389 (long long)(tcon->bytes_written)); 329 (long long)(tcon->bytes_written));
390 buf += item_length; 330 seq_printf(m,
391 length += item_length;
392 item_length = sprintf(buf,
393 "\nLocks: %d HardLinks: %d Symlinks: %d", 331 "\nLocks: %d HardLinks: %d Symlinks: %d",
394 atomic_read(&tcon->num_locks), 332 atomic_read(&tcon->num_locks),
395 atomic_read(&tcon->num_hardlinks), 333 atomic_read(&tcon->num_hardlinks),
396 atomic_read(&tcon->num_symlinks)); 334 atomic_read(&tcon->num_symlinks));
397 buf += item_length;
398 length += item_length;
399 335
400 item_length = sprintf(buf, "\nOpens: %d Closes: %d Deletes: %d", 336 seq_printf(m, "\nOpens: %d Closes: %d Deletes: %d",
401 atomic_read(&tcon->num_opens), 337 atomic_read(&tcon->num_opens),
402 atomic_read(&tcon->num_closes), 338 atomic_read(&tcon->num_closes),
403 atomic_read(&tcon->num_deletes)); 339 atomic_read(&tcon->num_deletes));
404 buf += item_length; 340 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), 341 atomic_read(&tcon->num_mkdirs),
408 atomic_read(&tcon->num_rmdirs)); 342 atomic_read(&tcon->num_rmdirs));
409 buf += item_length; 343 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), 344 atomic_read(&tcon->num_renames),
413 atomic_read(&tcon->num_t2renames)); 345 atomic_read(&tcon->num_t2renames));
414 buf += item_length; 346 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), 347 atomic_read(&tcon->num_ffirst),
418 atomic_read(&tcon->num_fnext), 348 atomic_read(&tcon->num_fnext),
419 atomic_read(&tcon->num_fclose)); 349 atomic_read(&tcon->num_fclose));
420 buf += item_length;
421 length += item_length;
422 } 350 }
423 read_unlock(&GlobalSMBSeslock); 351 read_unlock(&GlobalSMBSeslock);
424 352
425 buf += sprintf(buf, "\n"); 353 seq_putc(m, '\n');
426 length++; 354 return 0;
427 355}
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 356
439 return length; 357static int cifs_stats_proc_open(struct inode *inode, struct file *file)
358{
359 return single_open(file, cifs_stats_proc_show, NULL);
440} 360}
361
362static const struct file_operations cifs_stats_proc_fops = {
363 .owner = THIS_MODULE,
364 .open = cifs_stats_proc_open,
365 .read = seq_read,
366 .llseek = seq_lseek,
367 .release = single_release,
368 .write = cifs_stats_proc_write,
369};
441#endif /* STATS */ 370#endif /* STATS */
442 371
443static struct proc_dir_entry *proc_fs_cifs; 372static struct proc_dir_entry *proc_fs_cifs;
444read_proc_t cifs_txanchor_read; 373static const struct file_operations cifsFYI_proc_fops;
445static read_proc_t cifsFYI_read; 374static const struct file_operations cifs_oplock_proc_fops;
446static write_proc_t cifsFYI_write; 375static const struct file_operations cifs_lookup_cache_proc_fops;
447static read_proc_t oplockEnabled_read; 376static const struct file_operations traceSMB_proc_fops;
448static write_proc_t oplockEnabled_write; 377static const struct file_operations cifs_multiuser_mount_proc_fops;
449static read_proc_t lookupFlag_read; 378static const struct file_operations cifs_security_flags_proc_fops;
450static write_proc_t lookupFlag_write; 379static const struct file_operations cifs_experimental_proc_fops;
451static read_proc_t traceSMB_read; 380static 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 381
466void 382void
467cifs_proc_init(void) 383cifs_proc_init(void)
468{ 384{
469 struct proc_dir_entry *pde;
470
471 proc_fs_cifs = proc_mkdir("fs/cifs", NULL); 385 proc_fs_cifs = proc_mkdir("fs/cifs", NULL);
472 if (proc_fs_cifs == NULL) 386 if (proc_fs_cifs == NULL)
473 return; 387 return;
474 388
475 proc_fs_cifs->owner = THIS_MODULE; 389 proc_fs_cifs->owner = THIS_MODULE;
476 create_proc_read_entry("DebugData", 0, proc_fs_cifs, 390 proc_create("DebugData", 0, proc_fs_cifs, &cifs_debug_data_proc_fops);
477 cifs_debug_data_read, NULL);
478 391
479#ifdef CONFIG_CIFS_STATS 392#ifdef CONFIG_CIFS_STATS
480 pde = create_proc_read_entry("Stats", 0, proc_fs_cifs, 393 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 */ 394#endif /* STATS */
485 pde = create_proc_read_entry("cifsFYI", 0, proc_fs_cifs, 395 proc_create("cifsFYI", 0, proc_fs_cifs, &cifsFYI_proc_fops);
486 cifsFYI_read, NULL); 396 proc_create("traceSMB", 0, proc_fs_cifs, &traceSMB_proc_fops);
487 if (pde) 397 proc_create("OplockEnabled", 0, proc_fs_cifs, &cifs_oplock_proc_fops);
488 pde->write_proc = cifsFYI_write; 398 proc_create("Experimental", 0, proc_fs_cifs, &cifs_experimental_proc_fops);
489 399 proc_create("LinuxExtensionsEnabled", 0, proc_fs_cifs, &cifs_linux_ext_proc_fops);
490 pde = 400 proc_create("MultiuserMount", 0, proc_fs_cifs, &cifs_multiuser_mount_proc_fops);
491 create_proc_read_entry("traceSMB", 0, proc_fs_cifs, 401 proc_create("SecurityFlags", 0, proc_fs_cifs, &cifs_security_flags_proc_fops);
492 traceSMB_read, NULL); 402 proc_create("LookupCacheEnabled", 0, proc_fs_cifs, &cifs_lookup_cache_proc_fops);
493 if (pde)
494 pde->write_proc = traceSMB_write;
495
496 pde = create_proc_read_entry("OplockEnabled", 0, proc_fs_cifs,
497 oplockEnabled_read, NULL);
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,
463};
613 464
614 len -= off; 465static int cifs_oplock_proc_show(struct seq_file *m, void *v)
615 *start = page + off; 466{
616 467 seq_printf(m, "%d\n", oplockEnabled);
617 if (len > count) 468 return 0;
618 len = count; 469}
619 else
620 *eof = 1;
621
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,
652 500};
653 len -= off;
654 *start = page + off;
655
656 if (len > count)
657 len = count;
658 else
659 *eof = 1;
660 501
661 if (len < 0) 502static int cifs_experimental_proc_show(struct seq_file *m, void *v)
662 len = 0; 503{
504 seq_printf(m, "%d\n", experimEnabled);
505 return 0;
506}
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
696 if (len > count)
697 len = count;
698 else
699 *eof = 1;
700 540
701 if (len < 0) 541static int cifs_linux_ext_proc_show(struct seq_file *m, void *v)
702 len = 0; 542{
543 seq_printf(m, "%d\n", linuxExtEnabled);
544 return 0;
545}
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 605
769 len = sprintf(page, "%d\n", traceSMB); 606static const struct file_operations cifs_lookup_cache_proc_fops = {
607 .owner = THIS_MODULE,
608 .open = cifs_lookup_cache_proc_open,
609 .read = seq_read,
610 .llseek = seq_lseek,
611 .release = single_release,
612 .write = cifs_lookup_cache_proc_write,
613};
770 614
771 len -= off; 615static int traceSMB_proc_show(struct seq_file *m, void *v)
772 *start = page + off; 616{
773 617 seq_printf(m, "%d\n", traceSMB);
774 if (len > count) 618 return 0;
775 len = count; 619}
776 else
777 *eof = 1;
778
779 if (len < 0)
780 len = 0;
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 *file)
659{
660 return single_open(file, 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{