fix a kmap leak in virtio_console
[linux/fpc-iii.git] / tools / lib / traceevent / plugin_mac80211.c
blob7e15a0f1c2fd280fd8f2365d0bbd214cd7415b87
1 /*
2 * Copyright (C) 2009 Johannes Berg <johannes@sipsolutions.net>
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 INDENT 65
28 static void print_string(struct trace_seq *s, struct event_format *event,
29 const char *name, const void *data)
31 struct format_field *f = pevent_find_field(event, name);
32 int offset;
33 int length;
35 if (!f) {
36 trace_seq_printf(s, "NOTFOUND:%s", name);
37 return;
40 offset = f->offset;
41 length = f->size;
43 if (!strncmp(f->type, "__data_loc", 10)) {
44 unsigned long long v;
45 if (pevent_read_number_field(f, data, &v)) {
46 trace_seq_printf(s, "invalid_data_loc");
47 return;
49 offset = v & 0xffff;
50 length = v >> 16;
53 trace_seq_printf(s, "%.*s", length, (char *)data + offset);
56 #define SF(fn) pevent_print_num_field(s, fn ":%d", event, fn, record, 0)
57 #define SFX(fn) pevent_print_num_field(s, fn ":%#x", event, fn, record, 0)
58 #define SP() trace_seq_putc(s, ' ')
60 static int drv_bss_info_changed(struct trace_seq *s,
61 struct pevent_record *record,
62 struct event_format *event, void *context)
64 void *data = record->data;
66 print_string(s, event, "wiphy_name", data);
67 trace_seq_printf(s, " vif:");
68 print_string(s, event, "vif_name", data);
69 pevent_print_num_field(s, "(%d)", event, "vif_type", record, 1);
71 trace_seq_printf(s, "\n%*s", INDENT, "");
72 SF("assoc"); SP();
73 SF("aid"); SP();
74 SF("cts"); SP();
75 SF("shortpre"); SP();
76 SF("shortslot"); SP();
77 SF("dtimper"); SP();
78 trace_seq_printf(s, "\n%*s", INDENT, "");
79 SF("bcnint"); SP();
80 SFX("assoc_cap"); SP();
81 SFX("basic_rates"); SP();
82 SF("enable_beacon");
83 trace_seq_printf(s, "\n%*s", INDENT, "");
84 SF("ht_operation_mode");
86 return 0;
89 int PEVENT_PLUGIN_LOADER(struct pevent *pevent)
91 pevent_register_event_handler(pevent, -1, "mac80211",
92 "drv_bss_info_changed",
93 drv_bss_info_changed, NULL);
94 return 0;
97 void PEVENT_PLUGIN_UNLOADER(struct pevent *pevent)
99 pevent_unregister_event_handler(pevent, -1, "mac80211",
100 "drv_bss_info_changed",
101 drv_bss_info_changed, NULL);