fix a kmap leak in virtio_console
[linux/fpc-iii.git] / tools / lib / traceevent / plugin_jbd2.c
blob0db714c721bed1458564fe381e0d6b0e25efdc31
1 /*
2 * Copyright (C) 2010 Red Hat Inc, Steven Rostedt <srostedt@redhat.com>
4 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation;
8 * version 2.1 of the License (not later!)
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU Lesser General Public License for more details.
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this program; if not, see <http://www.gnu.org/licenses>
18 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
20 #include <stdio.h>
21 #include <stdlib.h>
22 #include <string.h>
24 #include "event-parse.h"
26 #define MINORBITS 20
27 #define MINORMASK ((1U << MINORBITS) - 1)
29 #define MAJOR(dev) ((unsigned int) ((dev) >> MINORBITS))
30 #define MINOR(dev) ((unsigned int) ((dev) & MINORMASK))
32 static unsigned long long
33 process_jbd2_dev_to_name(struct trace_seq *s,
34 unsigned long long *args)
36 unsigned int dev = args[0];
38 trace_seq_printf(s, "%d:%d", MAJOR(dev), MINOR(dev));
39 return 0;
42 static unsigned long long
43 process_jiffies_to_msecs(struct trace_seq *s,
44 unsigned long long *args)
46 unsigned long long jiffies = args[0];
48 trace_seq_printf(s, "%lld", jiffies);
49 return jiffies;
52 int PEVENT_PLUGIN_LOADER(struct pevent *pevent)
54 pevent_register_print_function(pevent,
55 process_jbd2_dev_to_name,
56 PEVENT_FUNC_ARG_STRING,
57 "jbd2_dev_to_name",
58 PEVENT_FUNC_ARG_INT,
59 PEVENT_FUNC_ARG_VOID);
61 pevent_register_print_function(pevent,
62 process_jiffies_to_msecs,
63 PEVENT_FUNC_ARG_LONG,
64 "jiffies_to_msecs",
65 PEVENT_FUNC_ARG_LONG,
66 PEVENT_FUNC_ARG_VOID);
67 return 0;
70 void PEVENT_PLUGIN_UNLOADER(struct pevent *pevent)
72 pevent_unregister_print_function(pevent, process_jbd2_dev_to_name,
73 "jbd2_dev_to_name");
75 pevent_unregister_print_function(pevent, process_jiffies_to_msecs,
76 "jiffies_to_msecs");