diff options
Diffstat (limited to 'net/tipc/dbg.c')
-rw-r--r-- | net/tipc/dbg.c | 56 |
1 files changed, 28 insertions, 28 deletions
diff --git a/net/tipc/dbg.c b/net/tipc/dbg.c index 627f99b7afdf..e809d2a2ce06 100644 --- a/net/tipc/dbg.c +++ b/net/tipc/dbg.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | * net/tipc/dbg.c: TIPC print buffer routines for debugging | 2 | * net/tipc/dbg.c: TIPC print buffer routines for debugging |
3 | * | 3 | * |
4 | * Copyright (c) 1996-2006, Ericsson AB | 4 | * Copyright (c) 1996-2006, Ericsson AB |
5 | * Copyright (c) 2005-2006, Wind River Systems | 5 | * Copyright (c) 2005-2006, Wind River Systems |
6 | * All rights reserved. | 6 | * All rights reserved. |
@@ -123,34 +123,34 @@ int tipc_printbuf_empty(struct print_buf *pb) | |||
123 | /** | 123 | /** |
124 | * tipc_printbuf_validate - check for print buffer overflow | 124 | * tipc_printbuf_validate - check for print buffer overflow |
125 | * @pb: pointer to print buffer structure | 125 | * @pb: pointer to print buffer structure |
126 | * | 126 | * |
127 | * Verifies that a print buffer has captured all data written to it. | 127 | * Verifies that a print buffer has captured all data written to it. |
128 | * If data has been lost, linearize buffer and prepend an error message | 128 | * If data has been lost, linearize buffer and prepend an error message |
129 | * | 129 | * |
130 | * Returns length of print buffer data string (including trailing NUL) | 130 | * Returns length of print buffer data string (including trailing NUL) |
131 | */ | 131 | */ |
132 | 132 | ||
133 | int tipc_printbuf_validate(struct print_buf *pb) | 133 | int tipc_printbuf_validate(struct print_buf *pb) |
134 | { | 134 | { |
135 | char *err = "\n\n*** PRINT BUFFER OVERFLOW ***\n\n"; | 135 | char *err = "\n\n*** PRINT BUFFER OVERFLOW ***\n\n"; |
136 | char *cp_buf; | 136 | char *cp_buf; |
137 | struct print_buf cb; | 137 | struct print_buf cb; |
138 | 138 | ||
139 | if (!pb->buf) | 139 | if (!pb->buf) |
140 | return 0; | 140 | return 0; |
141 | 141 | ||
142 | if (pb->buf[pb->size - 1] == 0) { | 142 | if (pb->buf[pb->size - 1] == 0) { |
143 | cp_buf = kmalloc(pb->size, GFP_ATOMIC); | 143 | cp_buf = kmalloc(pb->size, GFP_ATOMIC); |
144 | if (cp_buf != NULL){ | 144 | if (cp_buf != NULL){ |
145 | tipc_printbuf_init(&cb, cp_buf, pb->size); | 145 | tipc_printbuf_init(&cb, cp_buf, pb->size); |
146 | tipc_printbuf_move(&cb, pb); | 146 | tipc_printbuf_move(&cb, pb); |
147 | tipc_printbuf_move(pb, &cb); | 147 | tipc_printbuf_move(pb, &cb); |
148 | kfree(cp_buf); | 148 | kfree(cp_buf); |
149 | memcpy(pb->buf, err, strlen(err)); | 149 | memcpy(pb->buf, err, strlen(err)); |
150 | } else { | 150 | } else { |
151 | tipc_printbuf_reset(pb); | 151 | tipc_printbuf_reset(pb); |
152 | tipc_printf(pb, err); | 152 | tipc_printf(pb, err); |
153 | } | 153 | } |
154 | } | 154 | } |
155 | return (pb->crs - pb->buf + 1); | 155 | return (pb->crs - pb->buf + 1); |
156 | } | 156 | } |
@@ -159,7 +159,7 @@ int tipc_printbuf_validate(struct print_buf *pb) | |||
159 | * tipc_printbuf_move - move print buffer contents to another print buffer | 159 | * tipc_printbuf_move - move print buffer contents to another print buffer |
160 | * @pb_to: pointer to destination print buffer structure | 160 | * @pb_to: pointer to destination print buffer structure |
161 | * @pb_from: pointer to source print buffer structure | 161 | * @pb_from: pointer to source print buffer structure |
162 | * | 162 | * |
163 | * Current contents of destination print buffer (if any) are discarded. | 163 | * Current contents of destination print buffer (if any) are discarded. |
164 | * Source print buffer becomes empty if a successful move occurs. | 164 | * Source print buffer becomes empty if a successful move occurs. |
165 | */ | 165 | */ |
@@ -234,13 +234,13 @@ void tipc_printf(struct print_buf *pb, const char *fmt, ...) | |||
234 | pb->crs = pb->buf + pb->size - 1; | 234 | pb->crs = pb->buf + pb->size - 1; |
235 | } else { | 235 | } else { |
236 | strcpy(pb->buf, print_string + chars_left); | 236 | strcpy(pb->buf, print_string + chars_left); |
237 | save_char = print_string[chars_left]; | 237 | save_char = print_string[chars_left]; |
238 | print_string[chars_left] = 0; | 238 | print_string[chars_left] = 0; |
239 | strcpy(pb->crs, print_string); | 239 | strcpy(pb->crs, print_string); |
240 | print_string[chars_left] = save_char; | 240 | print_string[chars_left] = save_char; |
241 | pb->crs = pb->buf + chars_to_add - chars_left; | 241 | pb->crs = pb->buf + chars_to_add - chars_left; |
242 | } | 242 | } |
243 | } | 243 | } |
244 | pb_next = pb->next; | 244 | pb_next = pb->next; |
245 | pb->next = NULL; | 245 | pb->next = NULL; |
246 | pb = pb_next; | 246 | pb = pb_next; |
@@ -249,7 +249,7 @@ void tipc_printf(struct print_buf *pb, const char *fmt, ...) | |||
249 | } | 249 | } |
250 | 250 | ||
251 | /** | 251 | /** |
252 | * TIPC_TEE - perform next output operation on both print buffers | 252 | * TIPC_TEE - perform next output operation on both print buffers |
253 | * @b0: pointer to chain of print buffers (may be NULL) | 253 | * @b0: pointer to chain of print buffers (may be NULL) |
254 | * @b1: pointer to print buffer to add to chain | 254 | * @b1: pointer to print buffer to add to chain |
255 | * | 255 | * |
@@ -350,7 +350,7 @@ void tipc_dump(struct print_buf *pb, const char *fmt, ...) | |||
350 | } | 350 | } |
351 | 351 | ||
352 | /** | 352 | /** |
353 | * tipc_log_stop - free up TIPC log print buffer | 353 | * tipc_log_stop - free up TIPC log print buffer |
354 | */ | 354 | */ |
355 | 355 | ||
356 | void tipc_log_stop(void) | 356 | void tipc_log_stop(void) |