aboutsummaryrefslogtreecommitdiffstats
path: root/net/tipc/dbg.c
diff options
context:
space:
mode:
authorAllan Stephens <allan.stephens@windriver.com>2008-05-05 04:20:42 -0400
committerDavid S. Miller <davem@davemloft.net>2008-05-05 04:20:42 -0400
commitfb98ec71c7f81b6db9b793aeb9d53823b6960d8b (patch)
treeef526b18473b2772d9d9142ef41e7061b2e1cf0c /net/tipc/dbg.c
parent025adbe8e58290798001b472aec3eb618d8fc930 (diff)
tipc: Provide feedback when log buffer resizing fails
This patch provides feedback to the user when TIPC is unable to set its log buffer to the requested size. Signed-off-by: Allan Stephens <allan.stephens@windriver.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/tipc/dbg.c')
-rw-r--r--net/tipc/dbg.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/net/tipc/dbg.c b/net/tipc/dbg.c
index 1a8d0a24d9e3..c6806910598c 100644
--- a/net/tipc/dbg.c
+++ b/net/tipc/dbg.c
@@ -2,7 +2,7 @@
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-2007, Wind River Systems
6 * All rights reserved. 6 * All rights reserved.
7 * 7 *
8 * Redistribution and use in source and binary forms, with or without 8 * Redistribution and use in source and binary forms, with or without
@@ -354,8 +354,10 @@ void tipc_dump(struct print_buf *pb, const char *fmt, ...)
354 * @log_size: print buffer size to use 354 * @log_size: print buffer size to use
355 */ 355 */
356 356
357void tipc_log_resize(int log_size) 357int tipc_log_resize(int log_size)
358{ 358{
359 int res = 0;
360
359 spin_lock_bh(&print_lock); 361 spin_lock_bh(&print_lock);
360 if (TIPC_LOG->buf) { 362 if (TIPC_LOG->buf) {
361 kfree(TIPC_LOG->buf); 363 kfree(TIPC_LOG->buf);
@@ -366,8 +368,11 @@ void tipc_log_resize(int log_size)
366 log_size = TIPC_PB_MIN_SIZE; 368 log_size = TIPC_PB_MIN_SIZE;
367 tipc_printbuf_init(TIPC_LOG, kmalloc(log_size, GFP_ATOMIC), 369 tipc_printbuf_init(TIPC_LOG, kmalloc(log_size, GFP_ATOMIC),
368 log_size); 370 log_size);
371 res = !TIPC_LOG->buf;
369 } 372 }
370 spin_unlock_bh(&print_lock); 373 spin_unlock_bh(&print_lock);
374
375 return res;
371} 376}
372 377
373/** 378/**
@@ -385,7 +390,9 @@ struct sk_buff *tipc_log_resize_cmd(const void *req_tlv_area, int req_tlv_space)
385 if (value != delimit(value, 0, 32768)) 390 if (value != delimit(value, 0, 32768))
386 return tipc_cfg_reply_error_string(TIPC_CFG_INVALID_VALUE 391 return tipc_cfg_reply_error_string(TIPC_CFG_INVALID_VALUE
387 " (log size must be 0-32768)"); 392 " (log size must be 0-32768)");
388 tipc_log_resize(value); 393 if (tipc_log_resize(value))
394 return tipc_cfg_reply_error_string(
395 "unable to create specified log (log size is now 0)");
389 return tipc_cfg_reply_none(); 396 return tipc_cfg_reply_none();
390} 397}
391 398