Blame view
fs/cifs/cifs_debug.c
21.1 KB
1da177e4c Linux-2.6.12-rc2 |
1 2 3 |
/* * fs/cifs_debug.c * |
b8643e1b5 [PATCH] cifs: Do ... |
4 |
* Copyright (C) International Business Machines Corp., 2000,2005 |
1da177e4c Linux-2.6.12-rc2 |
5 6 7 8 9 |
* * Modified by Steve French (sfrench@us.ibm.com) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by |
221601c3d [CIFS] whitespace... |
10 |
* the Free Software Foundation; either version 2 of the License, or |
1da177e4c Linux-2.6.12-rc2 |
11 |
* (at your option) any later version. |
221601c3d [CIFS] whitespace... |
12 |
* |
1da177e4c Linux-2.6.12-rc2 |
13 14 15 16 17 18 |
* This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See * the GNU General Public License for more details. * * You should have received a copy of the GNU General Public License |
221601c3d [CIFS] whitespace... |
19 |
* along with this program; if not, write to the Free Software |
1da177e4c Linux-2.6.12-rc2 |
20 21 22 23 24 25 26 27 28 29 30 31 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include <linux/fs.h> #include <linux/string.h> #include <linux/ctype.h> #include <linux/module.h> #include <linux/proc_fs.h> #include <asm/uaccess.h> #include "cifspdu.h" #include "cifsglob.h" #include "cifsproto.h" #include "cifs_debug.h" |
6c91d362f [PATCH] cifs: fin... |
32 |
#include "cifsfs.h" |
1da177e4c Linux-2.6.12-rc2 |
33 34 35 36 37 38 39 40 |
void cifs_dump_mem(char *label, void *data, int length) { int i, j; int *intptr = data; char *charptr = data; char buf[10], line[80]; |
221601c3d [CIFS] whitespace... |
41 42 |
printk(KERN_DEBUG "%s: dump of %d bytes of data at 0x%p ", |
1da177e4c Linux-2.6.12-rc2 |
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
label, length, data); for (i = 0; i < length; i += 16) { line[0] = 0; for (j = 0; (j < 4) && (i + j * 4 < length); j++) { sprintf(buf, " %08x", intptr[i / 4 + j]); strcat(line, buf); } buf[0] = ' '; buf[2] = 0; for (j = 0; (j < 16) && (i + j < length); j++) { buf[1] = isprint(charptr[i + j]) ? charptr[i + j] : '.'; strcat(line, buf); } printk(KERN_DEBUG "%s ", line); } } |
3979877e5 [CIFS] Support fo... |
60 |
#ifdef CONFIG_CIFS_DEBUG2 |
ffdd6e4d1 [CIFS] fix whites... |
61 |
void cifs_dump_detail(struct smb_hdr *smb) |
3979877e5 [CIFS] Support fo... |
62 |
{ |
b6b38f704 [CIFS] Neaten cER... |
63 |
cERROR(1, "Cmd: %d Err: 0x%x Flags: 0x%x Flgs2: 0x%x Mid: %d Pid: %d", |
3979877e5 [CIFS] Support fo... |
64 |
smb->Command, smb->Status.CifsError, |
b6b38f704 [CIFS] Neaten cER... |
65 |
smb->Flags, smb->Flags2, smb->Mid, smb->Pid); |
820a803ff cifs: keep BCC in... |
66 |
cERROR(1, "smb buf %p len %d", smb, smbCalcSize(smb)); |
3979877e5 [CIFS] Support fo... |
67 |
} |
ffdd6e4d1 [CIFS] fix whites... |
68 |
void cifs_dump_mids(struct TCP_Server_Info *server) |
3979877e5 [CIFS] Support fo... |
69 70 |
{ struct list_head *tmp; |
ffdd6e4d1 [CIFS] fix whites... |
71 |
struct mid_q_entry *mid_entry; |
3979877e5 [CIFS] Support fo... |
72 |
|
221601c3d [CIFS] whitespace... |
73 |
if (server == NULL) |
3979877e5 [CIFS] Support fo... |
74 |
return; |
b6b38f704 [CIFS] Neaten cER... |
75 |
cERROR(1, "Dump pending requests:"); |
3979877e5 [CIFS] Support fo... |
76 77 78 |
spin_lock(&GlobalMid_Lock); list_for_each(tmp, &server->pending_mid_q) { mid_entry = list_entry(tmp, struct mid_q_entry, qhead); |
2b84a36c5 cifs: allow for d... |
79 |
cERROR(1, "State: %d Cmd: %d Pid: %d Cbdata: %p Mid %d", |
ad8b15f0f [CIFS] list entry... |
80 81 82 |
mid_entry->midState, (int)mid_entry->command, mid_entry->pid, |
2b84a36c5 cifs: allow for d... |
83 |
mid_entry->callback_data, |
b6b38f704 [CIFS] Neaten cER... |
84 |
mid_entry->mid); |
3979877e5 [CIFS] Support fo... |
85 |
#ifdef CONFIG_CIFS_STATS2 |
b6b38f704 [CIFS] Neaten cER... |
86 |
cERROR(1, "IsLarge: %d buf: %p time rcv: %ld now: %ld", |
ad8b15f0f [CIFS] list entry... |
87 88 89 |
mid_entry->largeBuf, mid_entry->resp_buf, mid_entry->when_received, |
b6b38f704 [CIFS] Neaten cER... |
90 |
jiffies); |
3979877e5 [CIFS] Support fo... |
91 |
#endif /* STATS2 */ |
b6b38f704 [CIFS] Neaten cER... |
92 93 |
cERROR(1, "IsMult: %d IsEnd: %d", mid_entry->multiRsp, mid_entry->multiEnd); |
ad8b15f0f [CIFS] list entry... |
94 95 96 97 |
if (mid_entry->resp_buf) { cifs_dump_detail(mid_entry->resp_buf); cifs_dump_mem("existing buf: ", mid_entry->resp_buf, 62); |
3979877e5 [CIFS] Support fo... |
98 99 100 101 102 |
} } spin_unlock(&GlobalMid_Lock); } #endif /* CONFIG_CIFS_DEBUG2 */ |
1da177e4c Linux-2.6.12-rc2 |
103 |
#ifdef CONFIG_PROC_FS |
f984c7b98 Signed-off-by: Al... |
104 |
static int cifs_debug_data_proc_show(struct seq_file *m, void *v) |
1da177e4c Linux-2.6.12-rc2 |
105 |
{ |
f1987b44f cifs: reinstate s... |
106 |
struct list_head *tmp1, *tmp2, *tmp3; |
ffdd6e4d1 [CIFS] fix whites... |
107 |
struct mid_q_entry *mid_entry; |
14fbf50d6 cifs: reinstate s... |
108 |
struct TCP_Server_Info *server; |
96daf2b09 [CIFS] Rename thr... |
109 110 |
struct cifs_ses *ses; struct cifs_tcon *tcon; |
f1987b44f cifs: reinstate s... |
111 112 |
int i, j; __u32 dev_type; |
1da177e4c Linux-2.6.12-rc2 |
113 |
|
f984c7b98 Signed-off-by: Al... |
114 |
seq_puts(m, |
1da177e4c Linux-2.6.12-rc2 |
115 116 117 118 |
"Display Internal CIFS Data Structures for Debugging " "--------------------------------------------------- "); |
f984c7b98 Signed-off-by: Al... |
119 120 |
seq_printf(m, "CIFS Version %s ", CIFS_VERSION); |
ca40b714b cifs: show "acl" ... |
121 |
seq_printf(m, "Features:"); |
f579903ef cifs: show featur... |
122 |
#ifdef CONFIG_CIFS_DFS_UPCALL |
ca40b714b cifs: show "acl" ... |
123 |
seq_printf(m, " dfs"); |
f579903ef cifs: show featur... |
124 125 |
#endif #ifdef CONFIG_CIFS_FSCACHE |
ca40b714b cifs: show "acl" ... |
126 |
seq_printf(m, " fscache"); |
f579903ef cifs: show featur... |
127 128 |
#endif #ifdef CONFIG_CIFS_WEAK_PW_HASH |
ca40b714b cifs: show "acl" ... |
129 |
seq_printf(m, " lanman"); |
f579903ef cifs: show featur... |
130 131 |
#endif #ifdef CONFIG_CIFS_POSIX |
ca40b714b cifs: show "acl" ... |
132 |
seq_printf(m, " posix"); |
f579903ef cifs: show featur... |
133 134 |
#endif #ifdef CONFIG_CIFS_UPCALL |
ca40b714b cifs: show "acl" ... |
135 |
seq_printf(m, " spnego"); |
f579903ef cifs: show featur... |
136 137 |
#endif #ifdef CONFIG_CIFS_XATTR |
ca40b714b cifs: show "acl" ... |
138 139 140 141 |
seq_printf(m, " xattr"); #endif #ifdef CONFIG_CIFS_ACL seq_printf(m, " acl"); |
f579903ef cifs: show featur... |
142 143 144 |
#endif seq_putc(m, ' '); |
f984c7b98 Signed-off-by: Al... |
145 146 147 |
seq_printf(m, "Active VFS Requests: %d ", GlobalTotalActiveXid); seq_printf(m, "Servers:"); |
1da177e4c Linux-2.6.12-rc2 |
148 149 |
i = 0; |
3f9bcca78 cifs: convert cif... |
150 |
spin_lock(&cifs_tcp_ses_lock); |
f1987b44f cifs: reinstate s... |
151 152 |
list_for_each(tmp1, &cifs_tcp_ses_list) { server = list_entry(tmp1, struct TCP_Server_Info, |
14fbf50d6 cifs: reinstate s... |
153 |
tcp_ses_list); |
1da177e4c Linux-2.6.12-rc2 |
154 |
i++; |
14fbf50d6 cifs: reinstate s... |
155 |
list_for_each(tmp2, &server->smb_ses_list) { |
96daf2b09 [CIFS] Rename thr... |
156 |
ses = list_entry(tmp2, struct cifs_ses, |
14fbf50d6 cifs: reinstate s... |
157 158 159 160 |
smb_ses_list); if ((ses->serverDomain == NULL) || (ses->serverOS == NULL) || (ses->serverNOS == NULL)) { |
f1987b44f cifs: reinstate s... |
161 162 163 164 |
seq_printf(m, " %d) entry for %s not fully " "displayed \t", i, ses->serverName); |
14fbf50d6 cifs: reinstate s... |
165 166 |
} else { seq_printf(m, |
f1987b44f cifs: reinstate s... |
167 168 169 170 171 |
" %d) Name: %s Domain: %s Uses: %d OS:" " %s \tNOS: %s\tCapability: 0x%x \tSMB" |
221601c3d [CIFS] whitespace... |
172 |
" session status: %d\t", |
b8643e1b5 [PATCH] cifs: Do ... |
173 |
i, ses->serverName, ses->serverDomain, |
14fbf50d6 cifs: reinstate s... |
174 |
ses->ses_count, ses->serverOS, ses->serverNOS, |
221601c3d [CIFS] whitespace... |
175 |
ses->capabilities, ses->status); |
14fbf50d6 cifs: reinstate s... |
176 |
} |
f984c7b98 Signed-off-by: Al... |
177 178 |
seq_printf(m, "TCP status: %d \tLocal Users To " |
14fbf50d6 cifs: reinstate s... |
179 180 |
"Server: %d SecMode: 0x%x Req On Wire: %d", server->tcpStatus, server->srv_count, |
96daf2b09 [CIFS] Rename thr... |
181 |
server->sec_mode, |
14fbf50d6 cifs: reinstate s... |
182 |
atomic_read(&server->inFlight)); |
131afd0b7 [CIFS] /proc/fs/c... |
183 184 |
#ifdef CONFIG_CIFS_STATS2 |
f984c7b98 Signed-off-by: Al... |
185 |
seq_printf(m, " In Send: %d In MaxReq Wait: %d", |
789e66612 [CIFS] Cleanup us... |
186 |
atomic_read(&server->in_send), |
14fbf50d6 cifs: reinstate s... |
187 |
atomic_read(&server->num_waiters)); |
131afd0b7 [CIFS] /proc/fs/c... |
188 |
#endif |
f1987b44f cifs: reinstate s... |
189 190 191 192 |
seq_puts(m, " \tShares:"); j = 0; list_for_each(tmp3, &ses->tcon_list) { |
96daf2b09 [CIFS] Rename thr... |
193 |
tcon = list_entry(tmp3, struct cifs_tcon, |
f1987b44f cifs: reinstate s... |
194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 |
tcon_list); ++j; dev_type = le32_to_cpu(tcon->fsDevInfo.DeviceType); seq_printf(m, " \t%d) %s Mounts: %d ", j, tcon->treeName, tcon->tc_count); if (tcon->nativeFileSystem) { seq_printf(m, "Type: %s ", tcon->nativeFileSystem); } seq_printf(m, "DevInfo: 0x%x Attributes: 0x%x" " PathComponentMax: %d Status: 0x%d", le32_to_cpu(tcon->fsDevInfo.DeviceCharacteristics), le32_to_cpu(tcon->fsAttrInfo.Attributes), le32_to_cpu(tcon->fsAttrInfo.MaxPathNameComponentLength), tcon->tidStatus); if (dev_type == FILE_DEVICE_DISK) seq_puts(m, " type: DISK "); else if (dev_type == FILE_DEVICE_CD_ROM) seq_puts(m, " type: CDROM "); else seq_printf(m, " type: %d ", dev_type); if (tcon->need_reconnect) seq_puts(m, "\tDISCONNECTED "); seq_putc(m, ' '); } seq_puts(m, " \tMIDs: "); |
1da177e4c Linux-2.6.12-rc2 |
227 228 |
spin_lock(&GlobalMid_Lock); |
14fbf50d6 cifs: reinstate s... |
229 |
list_for_each(tmp3, &server->pending_mid_q) { |
f1987b44f cifs: reinstate s... |
230 |
mid_entry = list_entry(tmp3, struct mid_q_entry, |
1da177e4c Linux-2.6.12-rc2 |
231 |
qhead); |
f1987b44f cifs: reinstate s... |
232 |
seq_printf(m, "\tState: %d com: %d pid:" |
2b84a36c5 cifs: allow for d... |
233 234 |
" %d cbdata: %p mid %d ", |
ad8b15f0f [CIFS] list entry... |
235 236 237 |
mid_entry->midState, (int)mid_entry->command, mid_entry->pid, |
2b84a36c5 cifs: allow for d... |
238 |
mid_entry->callback_data, |
ad8b15f0f [CIFS] list entry... |
239 |
mid_entry->mid); |
1da177e4c Linux-2.6.12-rc2 |
240 |
} |
221601c3d [CIFS] whitespace... |
241 |
spin_unlock(&GlobalMid_Lock); |
1da177e4c Linux-2.6.12-rc2 |
242 |
} |
1da177e4c Linux-2.6.12-rc2 |
243 |
} |
3f9bcca78 cifs: convert cif... |
244 |
spin_unlock(&cifs_tcp_ses_lock); |
f984c7b98 Signed-off-by: Al... |
245 246 |
seq_putc(m, ' '); |
1da177e4c Linux-2.6.12-rc2 |
247 |
|
1da177e4c Linux-2.6.12-rc2 |
248 |
/* BB add code to dump additional info such as TCP session info now */ |
f984c7b98 Signed-off-by: Al... |
249 250 |
return 0; } |
1da177e4c Linux-2.6.12-rc2 |
251 |
|
f984c7b98 Signed-off-by: Al... |
252 253 254 |
static int cifs_debug_data_proc_open(struct inode *inode, struct file *file) { return single_open(file, cifs_debug_data_proc_show, NULL); |
1da177e4c Linux-2.6.12-rc2 |
255 |
} |
f984c7b98 Signed-off-by: Al... |
256 257 258 259 260 261 262 |
static const struct file_operations cifs_debug_data_proc_fops = { .owner = THIS_MODULE, .open = cifs_debug_data_proc_open, .read = seq_read, .llseek = seq_lseek, .release = single_release, }; |
1047abc15 [CIFS] CIFS Stats... |
263 |
|
f984c7b98 Signed-off-by: Al... |
264 265 266 |
#ifdef CONFIG_CIFS_STATS static ssize_t cifs_stats_proc_write(struct file *file, const char __user *buffer, size_t count, loff_t *ppos) |
1047abc15 [CIFS] CIFS Stats... |
267 |
{ |
221601c3d [CIFS] whitespace... |
268 269 |
char c; int rc; |
f1987b44f cifs: reinstate s... |
270 271 |
struct list_head *tmp1, *tmp2, *tmp3; struct TCP_Server_Info *server; |
96daf2b09 [CIFS] Rename thr... |
272 273 |
struct cifs_ses *ses; struct cifs_tcon *tcon; |
1047abc15 [CIFS] CIFS Stats... |
274 |
|
221601c3d [CIFS] whitespace... |
275 276 277 |
rc = get_user(c, buffer); if (rc) return rc; |
1047abc15 [CIFS] CIFS Stats... |
278 |
|
221601c3d [CIFS] whitespace... |
279 |
if (c == '1' || c == 'y' || c == 'Y' || c == '0') { |
4498eed50 [CIFS] Add extend... |
280 281 282 283 |
#ifdef CONFIG_CIFS_STATS2 atomic_set(&totBufAllocCount, 0); atomic_set(&totSmBufAllocCount, 0); #endif /* CONFIG_CIFS_STATS2 */ |
3f9bcca78 cifs: convert cif... |
284 |
spin_lock(&cifs_tcp_ses_lock); |
f1987b44f cifs: reinstate s... |
285 286 287 |
list_for_each(tmp1, &cifs_tcp_ses_list) { server = list_entry(tmp1, struct TCP_Server_Info, tcp_ses_list); |
c2b3382cd [CIFS] Fix build ... |
288 |
list_for_each(tmp2, &server->smb_ses_list) { |
96daf2b09 [CIFS] Rename thr... |
289 |
ses = list_entry(tmp2, struct cifs_ses, |
c2b3382cd [CIFS] Fix build ... |
290 |
smb_ses_list); |
f1987b44f cifs: reinstate s... |
291 292 |
list_for_each(tmp3, &ses->tcon_list) { tcon = list_entry(tmp3, |
96daf2b09 [CIFS] Rename thr... |
293 |
struct cifs_tcon, |
f1987b44f cifs: reinstate s... |
294 295 296 297 298 299 |
tcon_list); atomic_set(&tcon->num_smbs_sent, 0); atomic_set(&tcon->num_writes, 0); atomic_set(&tcon->num_reads, 0); atomic_set(&tcon->num_oplock_brks, 0); atomic_set(&tcon->num_opens, 0); |
65bc98b00 [CIFS] Distinguis... |
300 301 |
atomic_set(&tcon->num_posixopens, 0); atomic_set(&tcon->num_posixmkdirs, 0); |
f1987b44f cifs: reinstate s... |
302 303 304 305 306 307 308 309 310 311 312 313 314 315 |
atomic_set(&tcon->num_closes, 0); atomic_set(&tcon->num_deletes, 0); atomic_set(&tcon->num_mkdirs, 0); atomic_set(&tcon->num_rmdirs, 0); atomic_set(&tcon->num_renames, 0); atomic_set(&tcon->num_t2renames, 0); atomic_set(&tcon->num_ffirst, 0); atomic_set(&tcon->num_fnext, 0); atomic_set(&tcon->num_fclose, 0); atomic_set(&tcon->num_hardlinks, 0); atomic_set(&tcon->num_symlinks, 0); atomic_set(&tcon->num_locks, 0); } } |
1047abc15 [CIFS] CIFS Stats... |
316 |
} |
3f9bcca78 cifs: convert cif... |
317 |
spin_unlock(&cifs_tcp_ses_lock); |
1047abc15 [CIFS] CIFS Stats... |
318 |
} |
221601c3d [CIFS] whitespace... |
319 |
return count; |
1047abc15 [CIFS] CIFS Stats... |
320 |
} |
f984c7b98 Signed-off-by: Al... |
321 |
static int cifs_stats_proc_show(struct seq_file *m, void *v) |
1da177e4c Linux-2.6.12-rc2 |
322 |
{ |
f984c7b98 Signed-off-by: Al... |
323 |
int i; |
f1987b44f cifs: reinstate s... |
324 325 |
struct list_head *tmp1, *tmp2, *tmp3; struct TCP_Server_Info *server; |
96daf2b09 [CIFS] Rename thr... |
326 327 |
struct cifs_ses *ses; struct cifs_tcon *tcon; |
1da177e4c Linux-2.6.12-rc2 |
328 |
|
f984c7b98 Signed-off-by: Al... |
329 |
seq_printf(m, |
1da177e4c Linux-2.6.12-rc2 |
330 331 332 333 |
"Resources in use CIFS Session: %d ", sesInfoAllocCount.counter); |
f984c7b98 Signed-off-by: Al... |
334 335 |
seq_printf(m, "Share (unique mount targets): %d ", |
1da177e4c Linux-2.6.12-rc2 |
336 |
tconInfoAllocCount.counter); |
f984c7b98 Signed-off-by: Al... |
337 338 |
seq_printf(m, "SMB Request/Response Buffer: %d Pool size: %d ", |
b8643e1b5 [PATCH] cifs: Do ... |
339 340 |
bufAllocCount.counter, cifs_min_rcv + tcpSesAllocCount.counter); |
f984c7b98 Signed-off-by: Al... |
341 342 |
seq_printf(m, "SMB Small Req/Resp Buffer: %d Pool size: %d ", |
221601c3d [CIFS] whitespace... |
343 |
smBufAllocCount.counter, cifs_min_small); |
07475ffba [CIFS] Display la... |
344 |
#ifdef CONFIG_CIFS_STATS2 |
f984c7b98 Signed-off-by: Al... |
345 346 |
seq_printf(m, "Total Large %d Small %d Allocations ", |
07475ffba [CIFS] Display la... |
347 |
atomic_read(&totBufAllocCount), |
221601c3d [CIFS] whitespace... |
348 |
atomic_read(&totSmBufAllocCount)); |
07475ffba [CIFS] Display la... |
349 |
#endif /* CONFIG_CIFS_STATS2 */ |
8097531a5 cifs: clean up ac... |
350 351 |
seq_printf(m, "Operations (MIDs): %d ", atomic_read(&midCount)); |
f984c7b98 Signed-off-by: Al... |
352 |
seq_printf(m, |
1da177e4c Linux-2.6.12-rc2 |
353 354 355 |
" %d session %d share reconnects ", |
221601c3d [CIFS] whitespace... |
356 |
tcpSesReconnectCount.counter, tconInfoReconnectCount.counter); |
1da177e4c Linux-2.6.12-rc2 |
357 |
|
f984c7b98 Signed-off-by: Al... |
358 |
seq_printf(m, |
1da177e4c Linux-2.6.12-rc2 |
359 360 |
"Total vfs operations: %d maximum at one time: %d ", |
221601c3d [CIFS] whitespace... |
361 |
GlobalCurrentXid, GlobalMaxActiveXid); |
1da177e4c Linux-2.6.12-rc2 |
362 363 |
i = 0; |
3f9bcca78 cifs: convert cif... |
364 |
spin_lock(&cifs_tcp_ses_lock); |
f1987b44f cifs: reinstate s... |
365 366 367 368 |
list_for_each(tmp1, &cifs_tcp_ses_list) { server = list_entry(tmp1, struct TCP_Server_Info, tcp_ses_list); list_for_each(tmp2, &server->smb_ses_list) { |
96daf2b09 [CIFS] Rename thr... |
369 |
ses = list_entry(tmp2, struct cifs_ses, |
f1987b44f cifs: reinstate s... |
370 371 372 |
smb_ses_list); list_for_each(tmp3, &ses->tcon_list) { tcon = list_entry(tmp3, |
96daf2b09 [CIFS] Rename thr... |
373 |
struct cifs_tcon, |
f1987b44f cifs: reinstate s... |
374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 |
tcon_list); i++; seq_printf(m, " %d) %s", i, tcon->treeName); if (tcon->need_reconnect) seq_puts(m, "\tDISCONNECTED "); seq_printf(m, " SMBs: %d Oplock Breaks: %d", atomic_read(&tcon->num_smbs_sent), atomic_read(&tcon->num_oplock_brks)); seq_printf(m, " Reads: %d Bytes: %lld", atomic_read(&tcon->num_reads), (long long)(tcon->bytes_read)); seq_printf(m, " Writes: %d Bytes: %lld", atomic_read(&tcon->num_writes), (long long)(tcon->bytes_written)); |
b298f2235 [CIFS] Send SMB f... |
392 393 394 |
seq_printf(m, " Flushes: %d", atomic_read(&tcon->num_flushes)); |
f1987b44f cifs: reinstate s... |
395 396 397 398 399 400 |
seq_printf(m, " Locks: %d HardLinks: %d " "Symlinks: %d", atomic_read(&tcon->num_locks), atomic_read(&tcon->num_hardlinks), atomic_read(&tcon->num_symlinks)); |
65bc98b00 [CIFS] Distinguis... |
401 402 |
seq_printf(m, " Opens: %d Closes: %d " |
f1987b44f cifs: reinstate s... |
403 404 405 406 |
"Deletes: %d", atomic_read(&tcon->num_opens), atomic_read(&tcon->num_closes), atomic_read(&tcon->num_deletes)); |
65bc98b00 [CIFS] Distinguis... |
407 408 409 410 411 |
seq_printf(m, " Posix Opens: %d " "Posix Mkdirs: %d", atomic_read(&tcon->num_posixopens), atomic_read(&tcon->num_posixmkdirs)); |
f1987b44f cifs: reinstate s... |
412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 |
seq_printf(m, " Mkdirs: %d Rmdirs: %d", atomic_read(&tcon->num_mkdirs), atomic_read(&tcon->num_rmdirs)); seq_printf(m, " Renames: %d T2 Renames %d", atomic_read(&tcon->num_renames), atomic_read(&tcon->num_t2renames)); seq_printf(m, " FindFirst: %d FNext %d " "FClose %d", atomic_read(&tcon->num_ffirst), atomic_read(&tcon->num_fnext), atomic_read(&tcon->num_fclose)); } } |
1da177e4c Linux-2.6.12-rc2 |
428 |
} |
3f9bcca78 cifs: convert cif... |
429 |
spin_unlock(&cifs_tcp_ses_lock); |
1da177e4c Linux-2.6.12-rc2 |
430 |
|
f984c7b98 Signed-off-by: Al... |
431 432 433 434 |
seq_putc(m, ' '); return 0; } |
221601c3d [CIFS] whitespace... |
435 |
|
f984c7b98 Signed-off-by: Al... |
436 437 438 |
static int cifs_stats_proc_open(struct inode *inode, struct file *file) { return single_open(file, cifs_stats_proc_show, NULL); |
1da177e4c Linux-2.6.12-rc2 |
439 |
} |
f984c7b98 Signed-off-by: Al... |
440 441 442 443 444 445 446 447 448 |
static const struct file_operations cifs_stats_proc_fops = { .owner = THIS_MODULE, .open = cifs_stats_proc_open, .read = seq_read, .llseek = seq_lseek, .release = single_release, .write = cifs_stats_proc_write, }; |
90c81e0b0 [CIFS] clean up s... |
449 |
#endif /* STATS */ |
1da177e4c Linux-2.6.12-rc2 |
450 451 |
static struct proc_dir_entry *proc_fs_cifs; |
f984c7b98 Signed-off-by: Al... |
452 453 454 455 456 457 |
static const struct file_operations cifsFYI_proc_fops; static const struct file_operations cifs_oplock_proc_fops; static const struct file_operations cifs_lookup_cache_proc_fops; static const struct file_operations traceSMB_proc_fops; static const struct file_operations cifs_multiuser_mount_proc_fops; static const struct file_operations cifs_security_flags_proc_fops; |
f984c7b98 Signed-off-by: Al... |
458 |
static const struct file_operations cifs_linux_ext_proc_fops; |
1da177e4c Linux-2.6.12-rc2 |
459 460 461 462 |
void cifs_proc_init(void) { |
36a5aeb87 proc: remove proc... |
463 |
proc_fs_cifs = proc_mkdir("fs/cifs", NULL); |
1da177e4c Linux-2.6.12-rc2 |
464 465 |
if (proc_fs_cifs == NULL) return; |
f984c7b98 Signed-off-by: Al... |
466 |
proc_create("DebugData", 0, proc_fs_cifs, &cifs_debug_data_proc_fops); |
1da177e4c Linux-2.6.12-rc2 |
467 468 |
#ifdef CONFIG_CIFS_STATS |
f984c7b98 Signed-off-by: Al... |
469 |
proc_create("Stats", 0, proc_fs_cifs, &cifs_stats_proc_fops); |
90c81e0b0 [CIFS] clean up s... |
470 |
#endif /* STATS */ |
f984c7b98 Signed-off-by: Al... |
471 472 473 |
proc_create("cifsFYI", 0, proc_fs_cifs, &cifsFYI_proc_fops); proc_create("traceSMB", 0, proc_fs_cifs, &traceSMB_proc_fops); proc_create("OplockEnabled", 0, proc_fs_cifs, &cifs_oplock_proc_fops); |
99b1f5b2f [CIFS] remove che... |
474 475 476 477 478 479 480 481 |
proc_create("LinuxExtensionsEnabled", 0, proc_fs_cifs, &cifs_linux_ext_proc_fops); proc_create("MultiuserMount", 0, proc_fs_cifs, &cifs_multiuser_mount_proc_fops); proc_create("SecurityFlags", 0, proc_fs_cifs, &cifs_security_flags_proc_fops); proc_create("LookupCacheEnabled", 0, proc_fs_cifs, &cifs_lookup_cache_proc_fops); |
1da177e4c Linux-2.6.12-rc2 |
482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 |
} void cifs_proc_clean(void) { if (proc_fs_cifs == NULL) return; remove_proc_entry("DebugData", proc_fs_cifs); remove_proc_entry("cifsFYI", proc_fs_cifs); remove_proc_entry("traceSMB", proc_fs_cifs); #ifdef CONFIG_CIFS_STATS remove_proc_entry("Stats", proc_fs_cifs); #endif remove_proc_entry("MultiuserMount", proc_fs_cifs); remove_proc_entry("OplockEnabled", proc_fs_cifs); |
221601c3d [CIFS] whitespace... |
498 |
remove_proc_entry("SecurityFlags", proc_fs_cifs); |
221601c3d [CIFS] whitespace... |
499 |
remove_proc_entry("LinuxExtensionsEnabled", proc_fs_cifs); |
221601c3d [CIFS] whitespace... |
500 |
remove_proc_entry("LookupCacheEnabled", proc_fs_cifs); |
36a5aeb87 proc: remove proc... |
501 |
remove_proc_entry("fs/cifs", NULL); |
1da177e4c Linux-2.6.12-rc2 |
502 |
} |
f984c7b98 Signed-off-by: Al... |
503 |
static int cifsFYI_proc_show(struct seq_file *m, void *v) |
1da177e4c Linux-2.6.12-rc2 |
504 |
{ |
f984c7b98 Signed-off-by: Al... |
505 506 507 508 |
seq_printf(m, "%d ", cifsFYI); return 0; } |
1da177e4c Linux-2.6.12-rc2 |
509 |
|
f984c7b98 Signed-off-by: Al... |
510 511 512 |
static int cifsFYI_proc_open(struct inode *inode, struct file *file) { return single_open(file, cifsFYI_proc_show, NULL); |
1da177e4c Linux-2.6.12-rc2 |
513 |
} |
f984c7b98 Signed-off-by: Al... |
514 515 516 |
static ssize_t cifsFYI_proc_write(struct file *file, const char __user *buffer, size_t count, loff_t *ppos) |
1da177e4c Linux-2.6.12-rc2 |
517 518 519 520 521 522 523 524 525 526 527 |
{ char c; int rc; rc = get_user(c, buffer); if (rc) return rc; if (c == '0' || c == 'n' || c == 'N') cifsFYI = 0; else if (c == '1' || c == 'y' || c == 'Y') cifsFYI = 1; |
221601c3d [CIFS] whitespace... |
528 |
else if ((c > '1') && (c <= '9')) |
1047abc15 [CIFS] CIFS Stats... |
529 |
cifsFYI = (int) (c - '0'); /* see cifs_debug.h for meanings */ |
1da177e4c Linux-2.6.12-rc2 |
530 531 532 |
return count; } |
f984c7b98 Signed-off-by: Al... |
533 534 535 536 537 538 539 540 |
static const struct file_operations cifsFYI_proc_fops = { .owner = THIS_MODULE, .open = cifsFYI_proc_open, .read = seq_read, .llseek = seq_lseek, .release = single_release, .write = cifsFYI_proc_write, }; |
1da177e4c Linux-2.6.12-rc2 |
541 |
|
f984c7b98 Signed-off-by: Al... |
542 543 |
static int cifs_oplock_proc_show(struct seq_file *m, void *v) { |
e75047344 add new module pa... |
544 545 |
seq_printf(m, "%d ", enable_oplocks); |
f984c7b98 Signed-off-by: Al... |
546 547 |
return 0; } |
1da177e4c Linux-2.6.12-rc2 |
548 |
|
f984c7b98 Signed-off-by: Al... |
549 550 551 |
static int cifs_oplock_proc_open(struct inode *inode, struct file *file) { return single_open(file, cifs_oplock_proc_show, NULL); |
1da177e4c Linux-2.6.12-rc2 |
552 |
} |
f984c7b98 Signed-off-by: Al... |
553 554 555 |
static ssize_t cifs_oplock_proc_write(struct file *file, const char __user *buffer, size_t count, loff_t *ppos) |
1da177e4c Linux-2.6.12-rc2 |
556 557 558 |
{ char c; int rc; |
8bc4392a1 cifs: warn about ... |
559 560 561 562 |
printk(KERN_WARNING "CIFS: The /proc/fs/cifs/OplockEnabled interface " "will be removed in kernel version 3.4. Please migrate to " "using the 'enable_oplocks' module parameter in cifs.ko. "); |
1da177e4c Linux-2.6.12-rc2 |
563 564 565 566 |
rc = get_user(c, buffer); if (rc) return rc; if (c == '0' || c == 'n' || c == 'N') |
e75047344 add new module pa... |
567 |
enable_oplocks = false; |
1da177e4c Linux-2.6.12-rc2 |
568 |
else if (c == '1' || c == 'y' || c == 'Y') |
e75047344 add new module pa... |
569 |
enable_oplocks = true; |
1da177e4c Linux-2.6.12-rc2 |
570 571 572 |
return count; } |
f984c7b98 Signed-off-by: Al... |
573 574 575 576 577 578 579 580 |
static const struct file_operations cifs_oplock_proc_fops = { .owner = THIS_MODULE, .open = cifs_oplock_proc_open, .read = seq_read, .llseek = seq_lseek, .release = single_release, .write = cifs_oplock_proc_write, }; |
1da177e4c Linux-2.6.12-rc2 |
581 |
|
f984c7b98 Signed-off-by: Al... |
582 583 584 585 586 587 |
static int cifs_linux_ext_proc_show(struct seq_file *m, void *v) { seq_printf(m, "%d ", linuxExtEnabled); return 0; } |
1da177e4c Linux-2.6.12-rc2 |
588 |
|
f984c7b98 Signed-off-by: Al... |
589 590 591 |
static int cifs_linux_ext_proc_open(struct inode *inode, struct file *file) { return single_open(file, cifs_linux_ext_proc_show, NULL); |
1da177e4c Linux-2.6.12-rc2 |
592 |
} |
f984c7b98 Signed-off-by: Al... |
593 594 595 |
static ssize_t cifs_linux_ext_proc_write(struct file *file, const char __user *buffer, size_t count, loff_t *ppos) |
1da177e4c Linux-2.6.12-rc2 |
596 |
{ |
221601c3d [CIFS] whitespace... |
597 598 599 600 601 602 603 604 605 606 607 608 |
char c; int rc; rc = get_user(c, buffer); if (rc) return rc; if (c == '0' || c == 'n' || c == 'N') linuxExtEnabled = 0; else if (c == '1' || c == 'y' || c == 'Y') linuxExtEnabled = 1; return count; |
1da177e4c Linux-2.6.12-rc2 |
609 |
} |
f984c7b98 Signed-off-by: Al... |
610 611 612 613 614 615 616 617 |
static const struct file_operations cifs_linux_ext_proc_fops = { .owner = THIS_MODULE, .open = cifs_linux_ext_proc_open, .read = seq_read, .llseek = seq_lseek, .release = single_release, .write = cifs_linux_ext_proc_write, }; |
1da177e4c Linux-2.6.12-rc2 |
618 |
|
f984c7b98 Signed-off-by: Al... |
619 |
static int cifs_lookup_cache_proc_show(struct seq_file *m, void *v) |
1da177e4c Linux-2.6.12-rc2 |
620 |
{ |
f984c7b98 Signed-off-by: Al... |
621 622 623 624 |
seq_printf(m, "%d ", lookupCacheEnabled); return 0; } |
1da177e4c Linux-2.6.12-rc2 |
625 |
|
f984c7b98 Signed-off-by: Al... |
626 627 628 |
static int cifs_lookup_cache_proc_open(struct inode *inode, struct file *file) { return single_open(file, cifs_lookup_cache_proc_show, NULL); |
1da177e4c Linux-2.6.12-rc2 |
629 |
} |
f984c7b98 Signed-off-by: Al... |
630 631 632 |
static ssize_t cifs_lookup_cache_proc_write(struct file *file, const char __user *buffer, size_t count, loff_t *ppos) |
1da177e4c Linux-2.6.12-rc2 |
633 634 635 636 637 638 639 640 641 642 643 644 645 646 |
{ char c; int rc; rc = get_user(c, buffer); if (rc) return rc; if (c == '0' || c == 'n' || c == 'N') lookupCacheEnabled = 0; else if (c == '1' || c == 'y' || c == 'Y') lookupCacheEnabled = 1; return count; } |
1da177e4c Linux-2.6.12-rc2 |
647 |
|
f984c7b98 Signed-off-by: Al... |
648 649 650 651 652 653 654 655 |
static const struct file_operations cifs_lookup_cache_proc_fops = { .owner = THIS_MODULE, .open = cifs_lookup_cache_proc_open, .read = seq_read, .llseek = seq_lseek, .release = single_release, .write = cifs_lookup_cache_proc_write, }; |
1da177e4c Linux-2.6.12-rc2 |
656 |
|
f984c7b98 Signed-off-by: Al... |
657 658 659 660 661 662 |
static int traceSMB_proc_show(struct seq_file *m, void *v) { seq_printf(m, "%d ", traceSMB); return 0; } |
1da177e4c Linux-2.6.12-rc2 |
663 |
|
f984c7b98 Signed-off-by: Al... |
664 665 666 |
static int traceSMB_proc_open(struct inode *inode, struct file *file) { return single_open(file, traceSMB_proc_show, NULL); |
1da177e4c Linux-2.6.12-rc2 |
667 |
} |
f984c7b98 Signed-off-by: Al... |
668 669 670 |
static ssize_t traceSMB_proc_write(struct file *file, const char __user *buffer, size_t count, loff_t *ppos) |
1da177e4c Linux-2.6.12-rc2 |
671 672 673 674 675 676 677 678 679 680 681 682 683 684 |
{ char c; int rc; rc = get_user(c, buffer); if (rc) return rc; if (c == '0' || c == 'n' || c == 'N') traceSMB = 0; else if (c == '1' || c == 'y' || c == 'Y') traceSMB = 1; return count; } |
f984c7b98 Signed-off-by: Al... |
685 686 687 688 689 690 691 692 |
static const struct file_operations traceSMB_proc_fops = { .owner = THIS_MODULE, .open = traceSMB_proc_open, .read = seq_read, .llseek = seq_lseek, .release = single_release, .write = traceSMB_proc_write, }; |
1da177e4c Linux-2.6.12-rc2 |
693 |
|
f984c7b98 Signed-off-by: Al... |
694 695 696 697 698 699 |
static int cifs_multiuser_mount_proc_show(struct seq_file *m, void *v) { seq_printf(m, "%d ", multiuser_mount); return 0; } |
1da177e4c Linux-2.6.12-rc2 |
700 |
|
99b1f5b2f [CIFS] remove che... |
701 |
static int cifs_multiuser_mount_proc_open(struct inode *inode, struct file *fh) |
f984c7b98 Signed-off-by: Al... |
702 |
{ |
99b1f5b2f [CIFS] remove che... |
703 |
return single_open(fh, cifs_multiuser_mount_proc_show, NULL); |
1da177e4c Linux-2.6.12-rc2 |
704 |
} |
f984c7b98 Signed-off-by: Al... |
705 706 707 |
static ssize_t cifs_multiuser_mount_proc_write(struct file *file, const char __user *buffer, size_t count, loff_t *ppos) |
1da177e4c Linux-2.6.12-rc2 |
708 709 710 711 712 713 714 715 716 717 718 719 720 721 |
{ char c; int rc; rc = get_user(c, buffer); if (rc) return rc; if (c == '0' || c == 'n' || c == 'N') multiuser_mount = 0; else if (c == '1' || c == 'y' || c == 'Y') multiuser_mount = 1; return count; } |
f984c7b98 Signed-off-by: Al... |
722 723 724 725 726 727 728 729 |
static const struct file_operations cifs_multiuser_mount_proc_fops = { .owner = THIS_MODULE, .open = cifs_multiuser_mount_proc_open, .read = seq_read, .llseek = seq_lseek, .release = single_release, .write = cifs_multiuser_mount_proc_write, }; |
1da177e4c Linux-2.6.12-rc2 |
730 |
|
f984c7b98 Signed-off-by: Al... |
731 732 |
static int cifs_security_flags_proc_show(struct seq_file *m, void *v) { |
04912d6a2 cifs: rename "ext... |
733 734 |
seq_printf(m, "0x%x ", global_secflags); |
f984c7b98 Signed-off-by: Al... |
735 736 |
return 0; } |
1da177e4c Linux-2.6.12-rc2 |
737 |
|
f984c7b98 Signed-off-by: Al... |
738 739 740 |
static int cifs_security_flags_proc_open(struct inode *inode, struct file *file) { return single_open(file, cifs_security_flags_proc_show, NULL); |
1da177e4c Linux-2.6.12-rc2 |
741 |
} |
f984c7b98 Signed-off-by: Al... |
742 743 744 |
static ssize_t cifs_security_flags_proc_write(struct file *file, const char __user *buffer, size_t count, loff_t *ppos) |
1da177e4c Linux-2.6.12-rc2 |
745 |
{ |
bdc4bf6e8 [CIFS] Support fo... |
746 747 |
unsigned int flags; char flags_string[12]; |
1da177e4c Linux-2.6.12-rc2 |
748 |
char c; |
bdc4bf6e8 [CIFS] Support fo... |
749 |
|
221601c3d [CIFS] whitespace... |
750 |
if ((count < 1) || (count > 11)) |
3979877e5 [CIFS] Support fo... |
751 |
return -EINVAL; |
1da177e4c Linux-2.6.12-rc2 |
752 |
|
bdc4bf6e8 [CIFS] Support fo... |
753 |
memset(flags_string, 0, 12); |
3979877e5 [CIFS] Support fo... |
754 |
|
221601c3d [CIFS] whitespace... |
755 |
if (copy_from_user(flags_string, buffer, count)) |
bdc4bf6e8 [CIFS] Support fo... |
756 |
return -EFAULT; |
3979877e5 [CIFS] Support fo... |
757 |
|
221601c3d [CIFS] whitespace... |
758 |
if (count < 3) { |
bdc4bf6e8 [CIFS] Support fo... |
759 760 |
/* single char or single char followed by null */ c = flags_string[0]; |
a013689dd [CIFS] Fix cifsd ... |
761 |
if (c == '0' || c == 'n' || c == 'N') { |
04912d6a2 cifs: rename "ext... |
762 |
global_secflags = CIFSSEC_DEF; /* default */ |
a013689dd [CIFS] Fix cifsd ... |
763 764 |
return count; } else if (c == '1' || c == 'y' || c == 'Y') { |
04912d6a2 cifs: rename "ext... |
765 |
global_secflags = CIFSSEC_MAX; |
a013689dd [CIFS] Fix cifsd ... |
766 767 |
return count; } else if (!isdigit(c)) { |
b6b38f704 [CIFS] Neaten cER... |
768 |
cERROR(1, "invalid flag %c", c); |
a013689dd [CIFS] Fix cifsd ... |
769 770 |
return -EINVAL; } |
bdc4bf6e8 [CIFS] Support fo... |
771 772 773 774 |
} /* else we have a number */ flags = simple_strtoul(flags_string, NULL, 0); |
b6b38f704 [CIFS] Neaten cER... |
775 |
cFYI(1, "sec flags 0x%x", flags); |
bdc4bf6e8 [CIFS] Support fo... |
776 |
|
221601c3d [CIFS] whitespace... |
777 |
if (flags <= 0) { |
b6b38f704 [CIFS] Neaten cER... |
778 |
cERROR(1, "invalid security flags %s", flags_string); |
bdc4bf6e8 [CIFS] Support fo... |
779 780 |
return -EINVAL; } |
1da177e4c Linux-2.6.12-rc2 |
781 |
|
221601c3d [CIFS] whitespace... |
782 |
if (flags & ~CIFSSEC_MASK) { |
b6b38f704 [CIFS] Neaten cER... |
783 784 |
cERROR(1, "attempt to set unsupported security flags 0x%x", flags & ~CIFSSEC_MASK); |
bdc4bf6e8 [CIFS] Support fo... |
785 786 787 |
return -EINVAL; } /* flags look ok - update the global security flags for cifs module */ |
04912d6a2 cifs: rename "ext... |
788 789 |
global_secflags = flags; if (global_secflags & CIFSSEC_MUST_SIGN) { |
762e5ab77 [CIFS] Fix sign m... |
790 |
/* requiring signing implies signing is allowed */ |
04912d6a2 cifs: rename "ext... |
791 |
global_secflags |= CIFSSEC_MAY_SIGN; |
b6b38f704 [CIFS] Neaten cER... |
792 |
cFYI(1, "packet signing now required"); |
04912d6a2 cifs: rename "ext... |
793 |
} else if ((global_secflags & CIFSSEC_MAY_SIGN) == 0) { |
b6b38f704 [CIFS] Neaten cER... |
794 |
cFYI(1, "packet signing disabled"); |
762e5ab77 [CIFS] Fix sign m... |
795 796 |
} /* BB should we turn on MAY flags for other MUST options? */ |
1da177e4c Linux-2.6.12-rc2 |
797 798 |
return count; } |
f984c7b98 Signed-off-by: Al... |
799 800 801 802 803 804 805 806 807 |
static const struct file_operations cifs_security_flags_proc_fops = { .owner = THIS_MODULE, .open = cifs_security_flags_proc_open, .read = seq_read, .llseek = seq_lseek, .release = single_release, .write = cifs_security_flags_proc_write, }; |
90c81e0b0 [CIFS] clean up s... |
808 |
#else |
e086fcea8 [CIFS] fix build ... |
809 |
inline void cifs_proc_init(void) |
90c81e0b0 [CIFS] clean up s... |
810 811 |
{ } |
e086fcea8 [CIFS] fix build ... |
812 |
inline void cifs_proc_clean(void) |
90c81e0b0 [CIFS] clean up s... |
813 814 815 |
{ } #endif /* PROC_FS */ |