lockdep: Simplify lockdep seqfile code
[deliverable/linux.git] / kernel / lockdep_proc.c
1 /*
2 * kernel/lockdep_proc.c
3 *
4 * Runtime locking correctness validator
5 *
6 * Started by Ingo Molnar:
7 *
8 * Copyright (C) 2006,2007 Red Hat, Inc., Ingo Molnar <mingo@redhat.com>
9 * Copyright (C) 2007 Red Hat, Inc., Peter Zijlstra <pzijlstr@redhat.com>
10 *
11 * Code for /proc/lockdep and /proc/lockdep_stats:
12 *
13 */
14 #include <linux/module.h>
15 #include <linux/proc_fs.h>
16 #include <linux/seq_file.h>
17 #include <linux/kallsyms.h>
18 #include <linux/debug_locks.h>
19 #include <linux/vmalloc.h>
20 #include <linux/sort.h>
21 #include <asm/uaccess.h>
22 #include <asm/div64.h>
23
24 #include "lockdep_internals.h"
25
26 static void *l_next(struct seq_file *m, void *v, loff_t *pos)
27 {
28 return seq_list_next(v, &all_lock_classes, pos);
29 }
30
31 static void *l_start(struct seq_file *m, loff_t *pos)
32 {
33 return seq_list_start_head(&all_lock_classes, *pos);
34 }
35
36 static void l_stop(struct seq_file *m, void *v)
37 {
38 }
39
40 static void print_name(struct seq_file *m, struct lock_class *class)
41 {
42 char str[128];
43 const char *name = class->name;
44
45 if (!name) {
46 name = __get_key_name(class->key, str);
47 seq_printf(m, "%s", name);
48 } else{
49 seq_printf(m, "%s", name);
50 if (class->name_version > 1)
51 seq_printf(m, "#%d", class->name_version);
52 if (class->subclass)
53 seq_printf(m, "/%d", class->subclass);
54 }
55 }
56
57 static int l_show(struct seq_file *m, void *v)
58 {
59 struct lock_class *class = list_entry(v, struct lock_class, lock_entry);
60 struct lock_list *entry;
61 char usage[LOCK_USAGE_CHARS];
62
63 if (v == &all_lock_classes) {
64 seq_printf(m, "all lock classes:\n");
65 return 0;
66 }
67
68 seq_printf(m, "%p", class->key);
69 #ifdef CONFIG_DEBUG_LOCKDEP
70 seq_printf(m, " OPS:%8ld", class->ops);
71 #endif
72 #ifdef CONFIG_PROVE_LOCKING
73 seq_printf(m, " FD:%5ld", lockdep_count_forward_deps(class));
74 seq_printf(m, " BD:%5ld", lockdep_count_backward_deps(class));
75 #endif
76
77 get_usage_chars(class, usage);
78 seq_printf(m, " %s", usage);
79
80 seq_printf(m, ": ");
81 print_name(m, class);
82 seq_puts(m, "\n");
83
84 list_for_each_entry(entry, &class->locks_after, entry) {
85 if (entry->distance == 1) {
86 seq_printf(m, " -> [%p] ", entry->class->key);
87 print_name(m, entry->class);
88 seq_puts(m, "\n");
89 }
90 }
91 seq_puts(m, "\n");
92
93 return 0;
94 }
95
96 static const struct seq_operations lockdep_ops = {
97 .start = l_start,
98 .next = l_next,
99 .stop = l_stop,
100 .show = l_show,
101 };
102
103 static int lockdep_open(struct inode *inode, struct file *file)
104 {
105 return seq_open(file, &lockdep_ops);
106 }
107
108 static const struct file_operations proc_lockdep_operations = {
109 .open = lockdep_open,
110 .read = seq_read,
111 .llseek = seq_lseek,
112 .release = seq_release,
113 };
114
115 #ifdef CONFIG_PROVE_LOCKING
116 static void *lc_next(struct seq_file *m, void *v, loff_t *pos)
117 {
118 struct lock_chain *chain;
119
120 (*pos)++;
121
122 if (v == SEQ_START_TOKEN)
123 chain = m->private;
124 else {
125 chain = v;
126
127 if (*pos - 1 < nr_lock_chains)
128 chain = lock_chains + (*pos - 1);
129 else
130 chain = NULL;
131 }
132
133 return chain;
134 }
135
136 static void *lc_start(struct seq_file *m, loff_t *pos)
137 {
138 if (*pos == 0)
139 return SEQ_START_TOKEN;
140
141 if (*pos - 1 < nr_lock_chains)
142 return lock_chains + (*pos - 1);
143
144 return NULL;
145 }
146
147 static void lc_stop(struct seq_file *m, void *v)
148 {
149 }
150
151 static int lc_show(struct seq_file *m, void *v)
152 {
153 struct lock_chain *chain = v;
154 struct lock_class *class;
155 int i;
156
157 if (v == SEQ_START_TOKEN) {
158 seq_printf(m, "all lock chains:\n");
159 return 0;
160 }
161
162 seq_printf(m, "irq_context: %d\n", chain->irq_context);
163
164 for (i = 0; i < chain->depth; i++) {
165 class = lock_chain_get_class(chain, i);
166 if (!class->key)
167 continue;
168
169 seq_printf(m, "[%p] ", class->key);
170 print_name(m, class);
171 seq_puts(m, "\n");
172 }
173 seq_puts(m, "\n");
174
175 return 0;
176 }
177
178 static const struct seq_operations lockdep_chains_ops = {
179 .start = lc_start,
180 .next = lc_next,
181 .stop = lc_stop,
182 .show = lc_show,
183 };
184
185 static int lockdep_chains_open(struct inode *inode, struct file *file)
186 {
187 int res = seq_open(file, &lockdep_chains_ops);
188 if (!res) {
189 struct seq_file *m = file->private_data;
190
191 if (nr_lock_chains)
192 m->private = lock_chains;
193 else
194 m->private = NULL;
195 }
196 return res;
197 }
198
199 static const struct file_operations proc_lockdep_chains_operations = {
200 .open = lockdep_chains_open,
201 .read = seq_read,
202 .llseek = seq_lseek,
203 .release = seq_release,
204 };
205 #endif /* CONFIG_PROVE_LOCKING */
206
207 static void lockdep_stats_debug_show(struct seq_file *m)
208 {
209 #ifdef CONFIG_DEBUG_LOCKDEP
210 unsigned int hi1 = debug_atomic_read(&hardirqs_on_events),
211 hi2 = debug_atomic_read(&hardirqs_off_events),
212 hr1 = debug_atomic_read(&redundant_hardirqs_on),
213 hr2 = debug_atomic_read(&redundant_hardirqs_off),
214 si1 = debug_atomic_read(&softirqs_on_events),
215 si2 = debug_atomic_read(&softirqs_off_events),
216 sr1 = debug_atomic_read(&redundant_softirqs_on),
217 sr2 = debug_atomic_read(&redundant_softirqs_off);
218
219 seq_printf(m, " chain lookup misses: %11u\n",
220 debug_atomic_read(&chain_lookup_misses));
221 seq_printf(m, " chain lookup hits: %11u\n",
222 debug_atomic_read(&chain_lookup_hits));
223 seq_printf(m, " cyclic checks: %11u\n",
224 debug_atomic_read(&nr_cyclic_checks));
225 seq_printf(m, " cyclic-check recursions: %11u\n",
226 debug_atomic_read(&nr_cyclic_check_recursions));
227 seq_printf(m, " find-mask forwards checks: %11u\n",
228 debug_atomic_read(&nr_find_usage_forwards_checks));
229 seq_printf(m, " find-mask forwards recursions: %11u\n",
230 debug_atomic_read(&nr_find_usage_forwards_recursions));
231 seq_printf(m, " find-mask backwards checks: %11u\n",
232 debug_atomic_read(&nr_find_usage_backwards_checks));
233 seq_printf(m, " find-mask backwards recursions:%11u\n",
234 debug_atomic_read(&nr_find_usage_backwards_recursions));
235
236 seq_printf(m, " hardirq on events: %11u\n", hi1);
237 seq_printf(m, " hardirq off events: %11u\n", hi2);
238 seq_printf(m, " redundant hardirq ons: %11u\n", hr1);
239 seq_printf(m, " redundant hardirq offs: %11u\n", hr2);
240 seq_printf(m, " softirq on events: %11u\n", si1);
241 seq_printf(m, " softirq off events: %11u\n", si2);
242 seq_printf(m, " redundant softirq ons: %11u\n", sr1);
243 seq_printf(m, " redundant softirq offs: %11u\n", sr2);
244 #endif
245 }
246
247 static int lockdep_stats_show(struct seq_file *m, void *v)
248 {
249 struct lock_class *class;
250 unsigned long nr_unused = 0, nr_uncategorized = 0,
251 nr_irq_safe = 0, nr_irq_unsafe = 0,
252 nr_softirq_safe = 0, nr_softirq_unsafe = 0,
253 nr_hardirq_safe = 0, nr_hardirq_unsafe = 0,
254 nr_irq_read_safe = 0, nr_irq_read_unsafe = 0,
255 nr_softirq_read_safe = 0, nr_softirq_read_unsafe = 0,
256 nr_hardirq_read_safe = 0, nr_hardirq_read_unsafe = 0,
257 sum_forward_deps = 0, factor = 0;
258
259 list_for_each_entry(class, &all_lock_classes, lock_entry) {
260
261 if (class->usage_mask == 0)
262 nr_unused++;
263 if (class->usage_mask == LOCKF_USED)
264 nr_uncategorized++;
265 if (class->usage_mask & LOCKF_USED_IN_IRQ)
266 nr_irq_safe++;
267 if (class->usage_mask & LOCKF_ENABLED_IRQ)
268 nr_irq_unsafe++;
269 if (class->usage_mask & LOCKF_USED_IN_SOFTIRQ)
270 nr_softirq_safe++;
271 if (class->usage_mask & LOCKF_ENABLED_SOFTIRQ)
272 nr_softirq_unsafe++;
273 if (class->usage_mask & LOCKF_USED_IN_HARDIRQ)
274 nr_hardirq_safe++;
275 if (class->usage_mask & LOCKF_ENABLED_HARDIRQ)
276 nr_hardirq_unsafe++;
277 if (class->usage_mask & LOCKF_USED_IN_IRQ_READ)
278 nr_irq_read_safe++;
279 if (class->usage_mask & LOCKF_ENABLED_IRQ_READ)
280 nr_irq_read_unsafe++;
281 if (class->usage_mask & LOCKF_USED_IN_SOFTIRQ_READ)
282 nr_softirq_read_safe++;
283 if (class->usage_mask & LOCKF_ENABLED_SOFTIRQ_READ)
284 nr_softirq_read_unsafe++;
285 if (class->usage_mask & LOCKF_USED_IN_HARDIRQ_READ)
286 nr_hardirq_read_safe++;
287 if (class->usage_mask & LOCKF_ENABLED_HARDIRQ_READ)
288 nr_hardirq_read_unsafe++;
289
290 #ifdef CONFIG_PROVE_LOCKING
291 sum_forward_deps += lockdep_count_forward_deps(class);
292 #endif
293 }
294 #ifdef CONFIG_DEBUG_LOCKDEP
295 DEBUG_LOCKS_WARN_ON(debug_atomic_read(&nr_unused_locks) != nr_unused);
296 #endif
297 seq_printf(m, " lock-classes: %11lu [max: %lu]\n",
298 nr_lock_classes, MAX_LOCKDEP_KEYS);
299 seq_printf(m, " direct dependencies: %11lu [max: %lu]\n",
300 nr_list_entries, MAX_LOCKDEP_ENTRIES);
301 seq_printf(m, " indirect dependencies: %11lu\n",
302 sum_forward_deps);
303
304 /*
305 * Total number of dependencies:
306 *
307 * All irq-safe locks may nest inside irq-unsafe locks,
308 * plus all the other known dependencies:
309 */
310 seq_printf(m, " all direct dependencies: %11lu\n",
311 nr_irq_unsafe * nr_irq_safe +
312 nr_hardirq_unsafe * nr_hardirq_safe +
313 nr_list_entries);
314
315 /*
316 * Estimated factor between direct and indirect
317 * dependencies:
318 */
319 if (nr_list_entries)
320 factor = sum_forward_deps / nr_list_entries;
321
322 #ifdef CONFIG_PROVE_LOCKING
323 seq_printf(m, " dependency chains: %11lu [max: %lu]\n",
324 nr_lock_chains, MAX_LOCKDEP_CHAINS);
325 seq_printf(m, " dependency chain hlocks: %11d [max: %lu]\n",
326 nr_chain_hlocks, MAX_LOCKDEP_CHAIN_HLOCKS);
327 #endif
328
329 #ifdef CONFIG_TRACE_IRQFLAGS
330 seq_printf(m, " in-hardirq chains: %11u\n",
331 nr_hardirq_chains);
332 seq_printf(m, " in-softirq chains: %11u\n",
333 nr_softirq_chains);
334 #endif
335 seq_printf(m, " in-process chains: %11u\n",
336 nr_process_chains);
337 seq_printf(m, " stack-trace entries: %11lu [max: %lu]\n",
338 nr_stack_trace_entries, MAX_STACK_TRACE_ENTRIES);
339 seq_printf(m, " combined max dependencies: %11u\n",
340 (nr_hardirq_chains + 1) *
341 (nr_softirq_chains + 1) *
342 (nr_process_chains + 1)
343 );
344 seq_printf(m, " hardirq-safe locks: %11lu\n",
345 nr_hardirq_safe);
346 seq_printf(m, " hardirq-unsafe locks: %11lu\n",
347 nr_hardirq_unsafe);
348 seq_printf(m, " softirq-safe locks: %11lu\n",
349 nr_softirq_safe);
350 seq_printf(m, " softirq-unsafe locks: %11lu\n",
351 nr_softirq_unsafe);
352 seq_printf(m, " irq-safe locks: %11lu\n",
353 nr_irq_safe);
354 seq_printf(m, " irq-unsafe locks: %11lu\n",
355 nr_irq_unsafe);
356
357 seq_printf(m, " hardirq-read-safe locks: %11lu\n",
358 nr_hardirq_read_safe);
359 seq_printf(m, " hardirq-read-unsafe locks: %11lu\n",
360 nr_hardirq_read_unsafe);
361 seq_printf(m, " softirq-read-safe locks: %11lu\n",
362 nr_softirq_read_safe);
363 seq_printf(m, " softirq-read-unsafe locks: %11lu\n",
364 nr_softirq_read_unsafe);
365 seq_printf(m, " irq-read-safe locks: %11lu\n",
366 nr_irq_read_safe);
367 seq_printf(m, " irq-read-unsafe locks: %11lu\n",
368 nr_irq_read_unsafe);
369
370 seq_printf(m, " uncategorized locks: %11lu\n",
371 nr_uncategorized);
372 seq_printf(m, " unused locks: %11lu\n",
373 nr_unused);
374 seq_printf(m, " max locking depth: %11u\n",
375 max_lockdep_depth);
376 seq_printf(m, " max recursion depth: %11u\n",
377 max_recursion_depth);
378 #ifdef CONFIG_PROVE_LOCKING
379 seq_printf(m, " max bfs queue depth: %11u\n",
380 max_bfs_queue_depth);
381 #endif
382 lockdep_stats_debug_show(m);
383 seq_printf(m, " debug_locks: %11u\n",
384 debug_locks);
385
386 return 0;
387 }
388
389 static int lockdep_stats_open(struct inode *inode, struct file *file)
390 {
391 return single_open(file, lockdep_stats_show, NULL);
392 }
393
394 static const struct file_operations proc_lockdep_stats_operations = {
395 .open = lockdep_stats_open,
396 .read = seq_read,
397 .llseek = seq_lseek,
398 .release = single_release,
399 };
400
401 #ifdef CONFIG_LOCK_STAT
402
403 struct lock_stat_data {
404 struct lock_class *class;
405 struct lock_class_stats stats;
406 };
407
408 struct lock_stat_seq {
409 struct lock_stat_data *iter;
410 struct lock_stat_data *iter_end;
411 struct lock_stat_data stats[MAX_LOCKDEP_KEYS];
412 };
413
414 /*
415 * sort on absolute number of contentions
416 */
417 static int lock_stat_cmp(const void *l, const void *r)
418 {
419 const struct lock_stat_data *dl = l, *dr = r;
420 unsigned long nl, nr;
421
422 nl = dl->stats.read_waittime.nr + dl->stats.write_waittime.nr;
423 nr = dr->stats.read_waittime.nr + dr->stats.write_waittime.nr;
424
425 return nr - nl;
426 }
427
428 static void seq_line(struct seq_file *m, char c, int offset, int length)
429 {
430 int i;
431
432 for (i = 0; i < offset; i++)
433 seq_puts(m, " ");
434 for (i = 0; i < length; i++)
435 seq_printf(m, "%c", c);
436 seq_puts(m, "\n");
437 }
438
439 static void snprint_time(char *buf, size_t bufsiz, s64 nr)
440 {
441 s64 div;
442 s32 rem;
443
444 nr += 5; /* for display rounding */
445 div = div_s64_rem(nr, 1000, &rem);
446 snprintf(buf, bufsiz, "%lld.%02d", (long long)div, (int)rem/10);
447 }
448
449 static void seq_time(struct seq_file *m, s64 time)
450 {
451 char num[15];
452
453 snprint_time(num, sizeof(num), time);
454 seq_printf(m, " %14s", num);
455 }
456
457 static void seq_lock_time(struct seq_file *m, struct lock_time *lt)
458 {
459 seq_printf(m, "%14lu", lt->nr);
460 seq_time(m, lt->min);
461 seq_time(m, lt->max);
462 seq_time(m, lt->total);
463 }
464
465 static void seq_stats(struct seq_file *m, struct lock_stat_data *data)
466 {
467 char name[39];
468 struct lock_class *class;
469 struct lock_class_stats *stats;
470 int i, namelen;
471
472 class = data->class;
473 stats = &data->stats;
474
475 namelen = 38;
476 if (class->name_version > 1)
477 namelen -= 2; /* XXX truncates versions > 9 */
478 if (class->subclass)
479 namelen -= 2;
480
481 if (!class->name) {
482 char str[KSYM_NAME_LEN];
483 const char *key_name;
484
485 key_name = __get_key_name(class->key, str);
486 snprintf(name, namelen, "%s", key_name);
487 } else {
488 snprintf(name, namelen, "%s", class->name);
489 }
490 namelen = strlen(name);
491 if (class->name_version > 1) {
492 snprintf(name+namelen, 3, "#%d", class->name_version);
493 namelen += 2;
494 }
495 if (class->subclass) {
496 snprintf(name+namelen, 3, "/%d", class->subclass);
497 namelen += 2;
498 }
499
500 if (stats->write_holdtime.nr) {
501 if (stats->read_holdtime.nr)
502 seq_printf(m, "%38s-W:", name);
503 else
504 seq_printf(m, "%40s:", name);
505
506 seq_printf(m, "%14lu ", stats->bounces[bounce_contended_write]);
507 seq_lock_time(m, &stats->write_waittime);
508 seq_printf(m, " %14lu ", stats->bounces[bounce_acquired_write]);
509 seq_lock_time(m, &stats->write_holdtime);
510 seq_puts(m, "\n");
511 }
512
513 if (stats->read_holdtime.nr) {
514 seq_printf(m, "%38s-R:", name);
515 seq_printf(m, "%14lu ", stats->bounces[bounce_contended_read]);
516 seq_lock_time(m, &stats->read_waittime);
517 seq_printf(m, " %14lu ", stats->bounces[bounce_acquired_read]);
518 seq_lock_time(m, &stats->read_holdtime);
519 seq_puts(m, "\n");
520 }
521
522 if (stats->read_waittime.nr + stats->write_waittime.nr == 0)
523 return;
524
525 if (stats->read_holdtime.nr)
526 namelen += 2;
527
528 for (i = 0; i < LOCKSTAT_POINTS; i++) {
529 char sym[KSYM_SYMBOL_LEN];
530 char ip[32];
531
532 if (class->contention_point[i] == 0)
533 break;
534
535 if (!i)
536 seq_line(m, '-', 40-namelen, namelen);
537
538 sprint_symbol(sym, class->contention_point[i]);
539 snprintf(ip, sizeof(ip), "[<%p>]",
540 (void *)class->contention_point[i]);
541 seq_printf(m, "%40s %14lu %29s %s\n", name,
542 stats->contention_point[i],
543 ip, sym);
544 }
545 for (i = 0; i < LOCKSTAT_POINTS; i++) {
546 char sym[KSYM_SYMBOL_LEN];
547 char ip[32];
548
549 if (class->contending_point[i] == 0)
550 break;
551
552 if (!i)
553 seq_line(m, '-', 40-namelen, namelen);
554
555 sprint_symbol(sym, class->contending_point[i]);
556 snprintf(ip, sizeof(ip), "[<%p>]",
557 (void *)class->contending_point[i]);
558 seq_printf(m, "%40s %14lu %29s %s\n", name,
559 stats->contending_point[i],
560 ip, sym);
561 }
562 if (i) {
563 seq_puts(m, "\n");
564 seq_line(m, '.', 0, 40 + 1 + 10 * (14 + 1));
565 seq_puts(m, "\n");
566 }
567 }
568
569 static void seq_header(struct seq_file *m)
570 {
571 seq_printf(m, "lock_stat version 0.3\n");
572
573 if (unlikely(!debug_locks))
574 seq_printf(m, "*WARNING* lock debugging disabled!! - possibly due to a lockdep warning\n");
575
576 seq_line(m, '-', 0, 40 + 1 + 10 * (14 + 1));
577 seq_printf(m, "%40s %14s %14s %14s %14s %14s %14s %14s %14s "
578 "%14s %14s\n",
579 "class name",
580 "con-bounces",
581 "contentions",
582 "waittime-min",
583 "waittime-max",
584 "waittime-total",
585 "acq-bounces",
586 "acquisitions",
587 "holdtime-min",
588 "holdtime-max",
589 "holdtime-total");
590 seq_line(m, '-', 0, 40 + 1 + 10 * (14 + 1));
591 seq_printf(m, "\n");
592 }
593
594 static void *ls_start(struct seq_file *m, loff_t *pos)
595 {
596 struct lock_stat_seq *data = m->private;
597
598 if (*pos == 0)
599 return SEQ_START_TOKEN;
600
601 data->iter = data->stats + (*pos - 1);
602 if (data->iter >= data->iter_end)
603 data->iter = NULL;
604
605 return data->iter;
606 }
607
608 static void *ls_next(struct seq_file *m, void *v, loff_t *pos)
609 {
610 struct lock_stat_seq *data = m->private;
611
612 (*pos)++;
613
614 if (v == SEQ_START_TOKEN)
615 data->iter = data->stats;
616 else {
617 data->iter = v;
618 data->iter++;
619 }
620
621 if (data->iter == data->iter_end)
622 data->iter = NULL;
623
624 return data->iter;
625 }
626
627 static void ls_stop(struct seq_file *m, void *v)
628 {
629 }
630
631 static int ls_show(struct seq_file *m, void *v)
632 {
633 if (v == SEQ_START_TOKEN)
634 seq_header(m);
635 else
636 seq_stats(m, v);
637
638 return 0;
639 }
640
641 static struct seq_operations lockstat_ops = {
642 .start = ls_start,
643 .next = ls_next,
644 .stop = ls_stop,
645 .show = ls_show,
646 };
647
648 static int lock_stat_open(struct inode *inode, struct file *file)
649 {
650 int res;
651 struct lock_class *class;
652 struct lock_stat_seq *data = vmalloc(sizeof(struct lock_stat_seq));
653
654 if (!data)
655 return -ENOMEM;
656
657 res = seq_open(file, &lockstat_ops);
658 if (!res) {
659 struct lock_stat_data *iter = data->stats;
660 struct seq_file *m = file->private_data;
661
662 data->iter = iter;
663 list_for_each_entry(class, &all_lock_classes, lock_entry) {
664 iter->class = class;
665 iter->stats = lock_stats(class);
666 iter++;
667 }
668 data->iter_end = iter;
669
670 sort(data->stats, data->iter_end - data->iter,
671 sizeof(struct lock_stat_data),
672 lock_stat_cmp, NULL);
673
674 m->private = data;
675 } else
676 vfree(data);
677
678 return res;
679 }
680
681 static ssize_t lock_stat_write(struct file *file, const char __user *buf,
682 size_t count, loff_t *ppos)
683 {
684 struct lock_class *class;
685 char c;
686
687 if (count) {
688 if (get_user(c, buf))
689 return -EFAULT;
690
691 if (c != '0')
692 return count;
693
694 list_for_each_entry(class, &all_lock_classes, lock_entry)
695 clear_lock_stats(class);
696 }
697 return count;
698 }
699
700 static int lock_stat_release(struct inode *inode, struct file *file)
701 {
702 struct seq_file *seq = file->private_data;
703
704 vfree(seq->private);
705 seq->private = NULL;
706 return seq_release(inode, file);
707 }
708
709 static const struct file_operations proc_lock_stat_operations = {
710 .open = lock_stat_open,
711 .write = lock_stat_write,
712 .read = seq_read,
713 .llseek = seq_lseek,
714 .release = lock_stat_release,
715 };
716 #endif /* CONFIG_LOCK_STAT */
717
718 static int __init lockdep_proc_init(void)
719 {
720 proc_create("lockdep", S_IRUSR, NULL, &proc_lockdep_operations);
721 #ifdef CONFIG_PROVE_LOCKING
722 proc_create("lockdep_chains", S_IRUSR, NULL,
723 &proc_lockdep_chains_operations);
724 #endif
725 proc_create("lockdep_stats", S_IRUSR, NULL,
726 &proc_lockdep_stats_operations);
727
728 #ifdef CONFIG_LOCK_STAT
729 proc_create("lock_stat", S_IRUSR, NULL, &proc_lock_stat_operations);
730 #endif
731
732 return 0;
733 }
734
735 __initcall(lockdep_proc_init);
736
This page took 0.045461 seconds and 6 git commands to generate.