diff options
-rw-r--r-- | arch/x86/kvm/mmutrace.h | 2 | ||||
-rw-r--r-- | drivers/scsi/scsi_trace.c | 16 | ||||
-rw-r--r-- | include/linux/trace_seq.h | 15 | ||||
-rw-r--r-- | kernel/trace/trace_output.c | 14 |
4 files changed, 31 insertions, 16 deletions
diff --git a/arch/x86/kvm/mmutrace.h b/arch/x86/kvm/mmutrace.h index 9d2e0ffcb190..2e5652b62fd6 100644 --- a/arch/x86/kvm/mmutrace.h +++ b/arch/x86/kvm/mmutrace.h | |||
@@ -22,7 +22,7 @@ | |||
22 | __entry->unsync = sp->unsync; | 22 | __entry->unsync = sp->unsync; |
23 | 23 | ||
24 | #define KVM_MMU_PAGE_PRINTK() ({ \ | 24 | #define KVM_MMU_PAGE_PRINTK() ({ \ |
25 | const char *ret = p->buffer + p->len; \ | 25 | const char *ret = trace_seq_buffer_ptr(p); \ |
26 | static const char *access_str[] = { \ | 26 | static const char *access_str[] = { \ |
27 | "---", "--x", "w--", "w-x", "-u-", "-ux", "wu-", "wux" \ | 27 | "---", "--x", "w--", "w-x", "-u-", "-ux", "wu-", "wux" \ |
28 | }; \ | 28 | }; \ |
diff --git a/drivers/scsi/scsi_trace.c b/drivers/scsi/scsi_trace.c index 2bea4f0b684a..503594e5f76d 100644 --- a/drivers/scsi/scsi_trace.c +++ b/drivers/scsi/scsi_trace.c | |||
@@ -28,7 +28,7 @@ scsi_trace_misc(struct trace_seq *, unsigned char *, int); | |||
28 | static const char * | 28 | static const char * |
29 | scsi_trace_rw6(struct trace_seq *p, unsigned char *cdb, int len) | 29 | scsi_trace_rw6(struct trace_seq *p, unsigned char *cdb, int len) |
30 | { | 30 | { |
31 | const char *ret = p->buffer + p->len; | 31 | const char *ret = trace_seq_buffer_ptr(p); |
32 | sector_t lba = 0, txlen = 0; | 32 | sector_t lba = 0, txlen = 0; |
33 | 33 | ||
34 | lba |= ((cdb[1] & 0x1F) << 16); | 34 | lba |= ((cdb[1] & 0x1F) << 16); |
@@ -46,7 +46,7 @@ scsi_trace_rw6(struct trace_seq *p, unsigned char *cdb, int len) | |||
46 | static const char * | 46 | static const char * |
47 | scsi_trace_rw10(struct trace_seq *p, unsigned char *cdb, int len) | 47 | scsi_trace_rw10(struct trace_seq *p, unsigned char *cdb, int len) |
48 | { | 48 | { |
49 | const char *ret = p->buffer + p->len; | 49 | const char *ret = trace_seq_buffer_ptr(p); |
50 | sector_t lba = 0, txlen = 0; | 50 | sector_t lba = 0, txlen = 0; |
51 | 51 | ||
52 | lba |= (cdb[2] << 24); | 52 | lba |= (cdb[2] << 24); |
@@ -71,7 +71,7 @@ scsi_trace_rw10(struct trace_seq *p, unsigned char *cdb, int len) | |||
71 | static const char * | 71 | static const char * |
72 | scsi_trace_rw12(struct trace_seq *p, unsigned char *cdb, int len) | 72 | scsi_trace_rw12(struct trace_seq *p, unsigned char *cdb, int len) |
73 | { | 73 | { |
74 | const char *ret = p->buffer + p->len; | 74 | const char *ret = trace_seq_buffer_ptr(p); |
75 | sector_t lba = 0, txlen = 0; | 75 | sector_t lba = 0, txlen = 0; |
76 | 76 | ||
77 | lba |= (cdb[2] << 24); | 77 | lba |= (cdb[2] << 24); |
@@ -94,7 +94,7 @@ scsi_trace_rw12(struct trace_seq *p, unsigned char *cdb, int len) | |||
94 | static const char * | 94 | static const char * |
95 | scsi_trace_rw16(struct trace_seq *p, unsigned char *cdb, int len) | 95 | scsi_trace_rw16(struct trace_seq *p, unsigned char *cdb, int len) |
96 | { | 96 | { |
97 | const char *ret = p->buffer + p->len; | 97 | const char *ret = trace_seq_buffer_ptr(p); |
98 | sector_t lba = 0, txlen = 0; | 98 | sector_t lba = 0, txlen = 0; |
99 | 99 | ||
100 | lba |= ((u64)cdb[2] << 56); | 100 | lba |= ((u64)cdb[2] << 56); |
@@ -125,7 +125,7 @@ scsi_trace_rw16(struct trace_seq *p, unsigned char *cdb, int len) | |||
125 | static const char * | 125 | static const char * |
126 | scsi_trace_rw32(struct trace_seq *p, unsigned char *cdb, int len) | 126 | scsi_trace_rw32(struct trace_seq *p, unsigned char *cdb, int len) |
127 | { | 127 | { |
128 | const char *ret = p->buffer + p->len, *cmd; | 128 | const char *ret = trace_seq_buffer_ptr(p), *cmd; |
129 | sector_t lba = 0, txlen = 0; | 129 | sector_t lba = 0, txlen = 0; |
130 | u32 ei_lbrt = 0; | 130 | u32 ei_lbrt = 0; |
131 | 131 | ||
@@ -180,7 +180,7 @@ out: | |||
180 | static const char * | 180 | static const char * |
181 | scsi_trace_unmap(struct trace_seq *p, unsigned char *cdb, int len) | 181 | scsi_trace_unmap(struct trace_seq *p, unsigned char *cdb, int len) |
182 | { | 182 | { |
183 | const char *ret = p->buffer + p->len; | 183 | const char *ret = trace_seq_buffer_ptr(p); |
184 | unsigned int regions = cdb[7] << 8 | cdb[8]; | 184 | unsigned int regions = cdb[7] << 8 | cdb[8]; |
185 | 185 | ||
186 | trace_seq_printf(p, "regions=%u", (regions - 8) / 16); | 186 | trace_seq_printf(p, "regions=%u", (regions - 8) / 16); |
@@ -192,7 +192,7 @@ scsi_trace_unmap(struct trace_seq *p, unsigned char *cdb, int len) | |||
192 | static const char * | 192 | static const char * |
193 | scsi_trace_service_action_in(struct trace_seq *p, unsigned char *cdb, int len) | 193 | scsi_trace_service_action_in(struct trace_seq *p, unsigned char *cdb, int len) |
194 | { | 194 | { |
195 | const char *ret = p->buffer + p->len, *cmd; | 195 | const char *ret = trace_seq_buffer_ptr(p), *cmd; |
196 | sector_t lba = 0; | 196 | sector_t lba = 0; |
197 | u32 alloc_len = 0; | 197 | u32 alloc_len = 0; |
198 | 198 | ||
@@ -247,7 +247,7 @@ scsi_trace_varlen(struct trace_seq *p, unsigned char *cdb, int len) | |||
247 | static const char * | 247 | static const char * |
248 | scsi_trace_misc(struct trace_seq *p, unsigned char *cdb, int len) | 248 | scsi_trace_misc(struct trace_seq *p, unsigned char *cdb, int len) |
249 | { | 249 | { |
250 | const char *ret = p->buffer + p->len; | 250 | const char *ret = trace_seq_buffer_ptr(p); |
251 | 251 | ||
252 | trace_seq_printf(p, "-"); | 252 | trace_seq_printf(p, "-"); |
253 | trace_seq_putc(p, 0); | 253 | trace_seq_putc(p, 0); |
diff --git a/include/linux/trace_seq.h b/include/linux/trace_seq.h index dd85753e1bb0..ea6c9dea79e3 100644 --- a/include/linux/trace_seq.h +++ b/include/linux/trace_seq.h | |||
@@ -25,6 +25,21 @@ trace_seq_init(struct trace_seq *s) | |||
25 | s->full = 0; | 25 | s->full = 0; |
26 | } | 26 | } |
27 | 27 | ||
28 | /** | ||
29 | * trace_seq_buffer_ptr - return pointer to next location in buffer | ||
30 | * @s: trace sequence descriptor | ||
31 | * | ||
32 | * Returns the pointer to the buffer where the next write to | ||
33 | * the buffer will happen. This is useful to save the location | ||
34 | * that is about to be written to and then return the result | ||
35 | * of that write. | ||
36 | */ | ||
37 | static inline unsigned char * | ||
38 | trace_seq_buffer_ptr(struct trace_seq *s) | ||
39 | { | ||
40 | return s->buffer + s->len; | ||
41 | } | ||
42 | |||
28 | /* | 43 | /* |
29 | * Currently only defined when tracing is enabled. | 44 | * Currently only defined when tracing is enabled. |
30 | */ | 45 | */ |
diff --git a/kernel/trace/trace_output.c b/kernel/trace/trace_output.c index b8930f79a04b..c6977d5a9b12 100644 --- a/kernel/trace/trace_output.c +++ b/kernel/trace/trace_output.c | |||
@@ -75,7 +75,7 @@ ftrace_print_flags_seq(struct trace_seq *p, const char *delim, | |||
75 | { | 75 | { |
76 | unsigned long mask; | 76 | unsigned long mask; |
77 | const char *str; | 77 | const char *str; |
78 | const char *ret = p->buffer + p->len; | 78 | const char *ret = trace_seq_buffer_ptr(p); |
79 | int i, first = 1; | 79 | int i, first = 1; |
80 | 80 | ||
81 | for (i = 0; flag_array[i].name && flags; i++) { | 81 | for (i = 0; flag_array[i].name && flags; i++) { |
@@ -111,7 +111,7 @@ ftrace_print_symbols_seq(struct trace_seq *p, unsigned long val, | |||
111 | const struct trace_print_flags *symbol_array) | 111 | const struct trace_print_flags *symbol_array) |
112 | { | 112 | { |
113 | int i; | 113 | int i; |
114 | const char *ret = p->buffer + p->len; | 114 | const char *ret = trace_seq_buffer_ptr(p); |
115 | 115 | ||
116 | for (i = 0; symbol_array[i].name; i++) { | 116 | for (i = 0; symbol_array[i].name; i++) { |
117 | 117 | ||
@@ -122,7 +122,7 @@ ftrace_print_symbols_seq(struct trace_seq *p, unsigned long val, | |||
122 | break; | 122 | break; |
123 | } | 123 | } |
124 | 124 | ||
125 | if (ret == (const char *)(p->buffer + p->len)) | 125 | if (ret == (const char *)(trace_seq_buffer_ptr(p))) |
126 | trace_seq_printf(p, "0x%lx", val); | 126 | trace_seq_printf(p, "0x%lx", val); |
127 | 127 | ||
128 | trace_seq_putc(p, 0); | 128 | trace_seq_putc(p, 0); |
@@ -137,7 +137,7 @@ ftrace_print_symbols_seq_u64(struct trace_seq *p, unsigned long long val, | |||
137 | const struct trace_print_flags_u64 *symbol_array) | 137 | const struct trace_print_flags_u64 *symbol_array) |
138 | { | 138 | { |
139 | int i; | 139 | int i; |
140 | const char *ret = p->buffer + p->len; | 140 | const char *ret = trace_seq_buffer_ptr(p); |
141 | 141 | ||
142 | for (i = 0; symbol_array[i].name; i++) { | 142 | for (i = 0; symbol_array[i].name; i++) { |
143 | 143 | ||
@@ -148,7 +148,7 @@ ftrace_print_symbols_seq_u64(struct trace_seq *p, unsigned long long val, | |||
148 | break; | 148 | break; |
149 | } | 149 | } |
150 | 150 | ||
151 | if (ret == (const char *)(p->buffer + p->len)) | 151 | if (ret == (const char *)(trace_seq_buffer_ptr(p))) |
152 | trace_seq_printf(p, "0x%llx", val); | 152 | trace_seq_printf(p, "0x%llx", val); |
153 | 153 | ||
154 | trace_seq_putc(p, 0); | 154 | trace_seq_putc(p, 0); |
@@ -162,7 +162,7 @@ const char * | |||
162 | ftrace_print_bitmask_seq(struct trace_seq *p, void *bitmask_ptr, | 162 | ftrace_print_bitmask_seq(struct trace_seq *p, void *bitmask_ptr, |
163 | unsigned int bitmask_size) | 163 | unsigned int bitmask_size) |
164 | { | 164 | { |
165 | const char *ret = p->buffer + p->len; | 165 | const char *ret = trace_seq_buffer_ptr(p); |
166 | 166 | ||
167 | trace_seq_bitmask(p, bitmask_ptr, bitmask_size * 8); | 167 | trace_seq_bitmask(p, bitmask_ptr, bitmask_size * 8); |
168 | trace_seq_putc(p, 0); | 168 | trace_seq_putc(p, 0); |
@@ -175,7 +175,7 @@ const char * | |||
175 | ftrace_print_hex_seq(struct trace_seq *p, const unsigned char *buf, int buf_len) | 175 | ftrace_print_hex_seq(struct trace_seq *p, const unsigned char *buf, int buf_len) |
176 | { | 176 | { |
177 | int i; | 177 | int i; |
178 | const char *ret = p->buffer + p->len; | 178 | const char *ret = trace_seq_buffer_ptr(p); |
179 | 179 | ||
180 | for (i = 0; i < buf_len; i++) | 180 | for (i = 0; i < buf_len; i++) |
181 | trace_seq_printf(p, "%s%2.2x", i == 0 ? "" : " ", buf[i]); | 181 | trace_seq_printf(p, "%s%2.2x", i == 0 ? "" : " ", buf[i]); |