diff options
| author | Allan Stephens <allan.stephens@windriver.com> | 2008-05-05 04:22:59 -0400 |
|---|---|---|
| committer | David S. Miller <davem@davemloft.net> | 2008-05-05 04:22:59 -0400 |
| commit | 7d3aa71239f588215b5a7c359f05155b192d8081 (patch) | |
| tree | 15128a65d133a4a4259d17ca3c507bce75ab26c5 /net | |
| parent | c89039850bdf8047472b4ee6132048dacef2cf5a (diff) | |
[TIPC]: Cosmetic cleanup of print buffer code
This patch contains changes to make TIPC's print buffer code
conform more closely to Linux kernel coding guidelines.
Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
| -rw-r--r-- | net/tipc/core.h | 6 | ||||
| -rw-r--r-- | net/tipc/dbg.c | 14 |
2 files changed, 11 insertions, 9 deletions
diff --git a/net/tipc/core.h b/net/tipc/core.h index 7042ef377262..bc633552e9ff 100644 --- a/net/tipc/core.h +++ b/net/tipc/core.h | |||
| @@ -2,7 +2,7 @@ | |||
| 2 | * net/tipc/core.h: Include file for TIPC global declarations | 2 | * net/tipc/core.h: Include file for TIPC global declarations |
| 3 | * | 3 | * |
| 4 | * Copyright (c) 2005-2006, Ericsson AB | 4 | * Copyright (c) 2005-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 |
| @@ -65,7 +65,9 @@ | |||
| 65 | #define assert(i) BUG_ON(!(i)) | 65 | #define assert(i) BUG_ON(!(i)) |
| 66 | 66 | ||
| 67 | struct tipc_msg; | 67 | struct tipc_msg; |
| 68 | extern struct print_buf *TIPC_NULL, *TIPC_CONS, *TIPC_LOG; | 68 | extern struct print_buf *const TIPC_NULL; |
| 69 | extern struct print_buf *const TIPC_CONS; | ||
| 70 | extern struct print_buf *const TIPC_LOG; | ||
| 69 | void tipc_msg_print(struct print_buf*,struct tipc_msg *,const char*); | 71 | void tipc_msg_print(struct print_buf*,struct tipc_msg *,const char*); |
| 70 | void tipc_printf(struct print_buf *, const char *fmt, ...); | 72 | void tipc_printf(struct print_buf *, const char *fmt, ...); |
| 71 | void tipc_dump(struct print_buf*,const char *fmt, ...); | 73 | void tipc_dump(struct print_buf*,const char *fmt, ...); |
diff --git a/net/tipc/dbg.c b/net/tipc/dbg.c index 8ca9457250be..cda496815a05 100644 --- a/net/tipc/dbg.c +++ b/net/tipc/dbg.c | |||
| @@ -49,13 +49,13 @@ | |||
| 49 | */ | 49 | */ |
| 50 | 50 | ||
| 51 | static struct print_buf null_buf = { NULL, 0, NULL, 0 }; | 51 | static struct print_buf null_buf = { NULL, 0, NULL, 0 }; |
| 52 | struct print_buf *TIPC_NULL = &null_buf; | 52 | struct print_buf *const TIPC_NULL = &null_buf; |
| 53 | 53 | ||
| 54 | static struct print_buf cons_buf = { NULL, 0, NULL, 1 }; | 54 | static struct print_buf cons_buf = { NULL, 0, NULL, 1 }; |
| 55 | struct print_buf *TIPC_CONS = &cons_buf; | 55 | struct print_buf *const TIPC_CONS = &cons_buf; |
| 56 | 56 | ||
| 57 | static struct print_buf log_buf = { NULL, 0, NULL, 1 }; | 57 | static struct print_buf log_buf = { NULL, 0, NULL, 1 }; |
| 58 | struct print_buf *TIPC_LOG = &log_buf; | 58 | struct print_buf *const TIPC_LOG = &log_buf; |
| 59 | 59 | ||
| 60 | /* | 60 | /* |
| 61 | * Locking policy when using print buffers. | 61 | * Locking policy when using print buffers. |
| @@ -107,7 +107,7 @@ void tipc_printbuf_init(struct print_buf *pb, char *raw, u32 size) | |||
| 107 | pb->buf = NULL; | 107 | pb->buf = NULL; |
| 108 | } else if (raw) { | 108 | } else if (raw) { |
| 109 | pb->buf[0] = 0; | 109 | pb->buf[0] = 0; |
| 110 | pb->buf[size-1] = ~0; | 110 | pb->buf[size - 1] = ~0; |
| 111 | } | 111 | } |
| 112 | } | 112 | } |
| 113 | 113 | ||
| @@ -118,7 +118,7 @@ void tipc_printbuf_init(struct print_buf *pb, char *raw, u32 size) | |||
| 118 | 118 | ||
| 119 | void tipc_printbuf_reset(struct print_buf *pb) | 119 | void tipc_printbuf_reset(struct print_buf *pb) |
| 120 | { | 120 | { |
| 121 | if (pb->buf != NULL) { | 121 | if (pb->buf) { |
| 122 | pb->crs = pb->buf; | 122 | pb->crs = pb->buf; |
| 123 | pb->buf[0] = 0; | 123 | pb->buf[0] = 0; |
| 124 | pb->buf[pb->size - 1] = ~0; | 124 | pb->buf[pb->size - 1] = ~0; |
| @@ -158,7 +158,7 @@ int tipc_printbuf_validate(struct print_buf *pb) | |||
| 158 | 158 | ||
| 159 | if (pb->buf[pb->size - 1] == 0) { | 159 | if (pb->buf[pb->size - 1] == 0) { |
| 160 | cp_buf = kmalloc(pb->size, GFP_ATOMIC); | 160 | cp_buf = kmalloc(pb->size, GFP_ATOMIC); |
| 161 | if (cp_buf != NULL){ | 161 | if (cp_buf) { |
| 162 | tipc_printbuf_init(&cb, cp_buf, pb->size); | 162 | tipc_printbuf_init(&cb, cp_buf, pb->size); |
| 163 | tipc_printbuf_move(&cb, pb); | 163 | tipc_printbuf_move(&cb, pb); |
| 164 | tipc_printbuf_move(pb, &cb); | 164 | tipc_printbuf_move(pb, &cb); |
| @@ -205,7 +205,7 @@ void tipc_printbuf_move(struct print_buf *pb_to, struct print_buf *pb_from) | |||
| 205 | /* Copy data from char after cursor to end (if used) */ | 205 | /* Copy data from char after cursor to end (if used) */ |
| 206 | 206 | ||
| 207 | len = pb_from->buf + pb_from->size - pb_from->crs - 2; | 207 | len = pb_from->buf + pb_from->size - pb_from->crs - 2; |
| 208 | if ((pb_from->buf[pb_from->size-1] == 0) && (len > 0)) { | 208 | if ((pb_from->buf[pb_from->size - 1] == 0) && (len > 0)) { |
| 209 | strcpy(pb_to->buf, pb_from->crs + 1); | 209 | strcpy(pb_to->buf, pb_from->crs + 1); |
| 210 | pb_to->crs = pb_to->buf + len; | 210 | pb_to->crs = pb_to->buf + len; |
| 211 | } else | 211 | } else |
