diff options
author | Paul Gortmaker <paul.gortmaker@windriver.com> | 2012-11-29 13:48:40 -0500 |
---|---|---|
committer | Paul Gortmaker <paul.gortmaker@windriver.com> | 2012-12-07 17:23:19 -0500 |
commit | bc879117d4cf2a6fcf5c5a43f157143bbbe88e84 (patch) | |
tree | ad083eccef0c63f03655f0835355c0fd616c5e52 /net/tipc/port.h | |
parent | e643df156ade104b0430588562d25b8638683fc1 (diff) |
tipc: standardize across connect/disconnect function naming
Currently we have tipc_disconnect and tipc_disconnect_port. It is
not clear from the names alone, what they do or how they differ.
It turns out that tipc_disconnect just deals with the port locking
and then calls tipc_disconnect_port which does all the work.
If we rename as follows: tipc_disconnect_port --> __tipc_disconnect
then we will be following typical linux convention, where:
__tipc_disconnect: "raw" function that does all the work.
tipc_disconnect: wrapper that deals with locking and then calls
the real core __tipc_disconnect function
With this, the difference is immediately evident, and locking
violations are more apt to be spotted by chance while working on,
or even just while reading the code.
On the connect side of things, we currently only have the single
"tipc_connect2port" function. It does both the locking at enter/exit,
and the core of the work. Pending changes will make it desireable to
have the connect be a two part locking wrapper + worker function,
just like the disconnect is already.
Here, we make the connect look just like the updated disconnect case,
for the above reason, and for consistency. In the process, we also
get rid of the "2port" suffix that was on the original name, since
it adds no descriptive value.
On close examination, one might notice that the above connect
changes implicitly move the call to tipc_link_get_max_pkt() to be
within the scope of tipc_port_lock() protected region; when it was
not previously. We don't see any issues with this, and it is in
keeping with __tipc_connect doing the work and tipc_connect just
handling the locking.
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Diffstat (limited to 'net/tipc/port.h')
-rw-r--r-- | net/tipc/port.h | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/net/tipc/port.h b/net/tipc/port.h index 4660e3065790..fb66e2e5f4d1 100644 --- a/net/tipc/port.h +++ b/net/tipc/port.h | |||
@@ -190,7 +190,7 @@ int tipc_publish(u32 portref, unsigned int scope, | |||
190 | int tipc_withdraw(u32 portref, unsigned int scope, | 190 | int tipc_withdraw(u32 portref, unsigned int scope, |
191 | struct tipc_name_seq const *name_seq); | 191 | struct tipc_name_seq const *name_seq); |
192 | 192 | ||
193 | int tipc_connect2port(u32 portref, struct tipc_portid const *port); | 193 | int tipc_connect(u32 portref, struct tipc_portid const *port); |
194 | 194 | ||
195 | int tipc_disconnect(u32 portref); | 195 | int tipc_disconnect(u32 portref); |
196 | 196 | ||
@@ -200,7 +200,9 @@ int tipc_shutdown(u32 ref); | |||
200 | /* | 200 | /* |
201 | * The following routines require that the port be locked on entry | 201 | * The following routines require that the port be locked on entry |
202 | */ | 202 | */ |
203 | int tipc_disconnect_port(struct tipc_port *tp_ptr); | 203 | int __tipc_disconnect(struct tipc_port *tp_ptr); |
204 | int __tipc_connect(u32 ref, struct tipc_port *p_ptr, | ||
205 | struct tipc_portid const *peer); | ||
204 | int tipc_port_peer_msg(struct tipc_port *p_ptr, struct tipc_msg *msg); | 206 | int tipc_port_peer_msg(struct tipc_port *p_ptr, struct tipc_msg *msg); |
205 | 207 | ||
206 | /* | 208 | /* |