summaryrefslogtreecommitdiffstats
path: root/net/tipc/dbg.c
diff options
context:
space:
mode:
authorAllan Stephens <allan.stephens@windriver.com>2008-05-05 01:20:04 -0700
committerDavid S. Miller <davem@davemloft.net>2008-05-05 01:20:04 -0700
commit025adbe8e58290798001b472aec3eb618d8fc930 (patch)
treeb9d49cd2f7be5b9e214d6e36306bceb077081256 /net/tipc/dbg.c
parentf74d505b58d36ceeef10e459094f0eb760681165 (diff)
downloadlinux-025adbe8e58290798001b472aec3eb618d8fc930.tar.gz
linux-025adbe8e58290798001b472aec3eb618d8fc930.tar.bz2
linux-025adbe8e58290798001b472aec3eb618d8fc930.zip
tipc: Simplify log buffer resizing
This patch simplifies & standardizes the way TIPC's print buffer log is resized. Code to terminate use of the log buffer is eliminated by simply setting the log buffer size to 0 bytes. 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.c26
1 files changed, 7 insertions, 19 deletions
diff --git a/net/tipc/dbg.c b/net/tipc/dbg.c
index e809d2a2ce06..1a8d0a24d9e3 100644
--- a/net/tipc/dbg.c
+++ b/net/tipc/dbg.c
@@ -350,43 +350,31 @@ void tipc_dump(struct print_buf *pb, const char *fmt, ...)
}
/**
- * tipc_log_stop - free up TIPC log print buffer
+ * tipc_log_resize - change the size of the TIPC log buffer
+ * @log_size: print buffer size to use
*/
-void tipc_log_stop(void)
+void tipc_log_resize(int log_size)
{
spin_lock_bh(&print_lock);
if (TIPC_LOG->buf) {
kfree(TIPC_LOG->buf);
TIPC_LOG->buf = NULL;
}
- spin_unlock_bh(&print_lock);
-}
-
-/**
- * tipc_log_reinit - (re)initialize TIPC log print buffer
- * @log_size: print buffer size to use
- */
-
-void tipc_log_reinit(int log_size)
-{
- tipc_log_stop();
-
if (log_size) {
if (log_size < TIPC_PB_MIN_SIZE)
log_size = TIPC_PB_MIN_SIZE;
- spin_lock_bh(&print_lock);
tipc_printbuf_init(TIPC_LOG, kmalloc(log_size, GFP_ATOMIC),
log_size);
- spin_unlock_bh(&print_lock);
}
+ spin_unlock_bh(&print_lock);
}
/**
- * tipc_log_resize - reconfigure size of TIPC log buffer
+ * tipc_log_resize_cmd - reconfigure size of TIPC log buffer
*/
-struct sk_buff *tipc_log_resize(const void *req_tlv_area, int req_tlv_space)
+struct sk_buff *tipc_log_resize_cmd(const void *req_tlv_area, int req_tlv_space)
{
u32 value;
@@ -397,7 +385,7 @@ struct sk_buff *tipc_log_resize(const void *req_tlv_area, int req_tlv_space)
if (value != delimit(value, 0, 32768))
return tipc_cfg_reply_error_string(TIPC_CFG_INVALID_VALUE
" (log size must be 0-32768)");
- tipc_log_reinit(value);
+ tipc_log_resize(value);
return tipc_cfg_reply_none();
}