X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=net%2Ftipc%2Fuser_reg.c;h=5069288031629ca0a30370942c6ab742a069890a;hb=9714be7da8b32f36d2468fe08ff603b6402df8cf;hp=04d1b9be9c5197ccf4ec6c9c9a401985959d50a0;hpb=4da3dcf34671fa15c4f01101754106d97fc98e6e;p=linux-2.6 diff --git a/net/tipc/user_reg.c b/net/tipc/user_reg.c index 04d1b9be9c..5069288031 100644 --- a/net/tipc/user_reg.c +++ b/net/tipc/user_reg.c @@ -1,6 +1,6 @@ /* * net/tipc/user_reg.c: TIPC user registry code - * + * * Copyright (c) 2000-2006, Ericsson AB * Copyright (c) 2004-2005, Wind River Systems * All rights reserved. @@ -40,7 +40,7 @@ /* * TIPC user registry keeps track of users of the tipc_port interface. * - * The registry utilizes an array of "TIPC user" entries; + * The registry utilizes an array of "TIPC user" entries; * a user's ID is the index of their associated array entry. * Array entry 0 is not used, so userid 0 is not valid; * TIPC sometimes uses this value to denote an anonymous user. @@ -51,7 +51,7 @@ * struct tipc_user - registered TIPC user info * @next: index of next free registry entry (or -1 for an allocated entry) * @callback: ptr to routine to call when TIPC mode changes (NULL if none) - * @usr_handle: user-defined value passed to callback routine + * @usr_handle: user-defined value passed to callback routine * @ports: list of user ports owned by the user */ @@ -71,7 +71,7 @@ static DEFINE_SPINLOCK(reg_lock); /** * reg_init - create TIPC user registry (but don't activate it) - * + * * If registry has been pre-initialized it is left "as is". * NOTE: This routine may be called when TIPC is inactive. */ @@ -79,7 +79,7 @@ static DEFINE_SPINLOCK(reg_lock); static int reg_init(void) { u32 i; - + spin_lock_bh(®_lock); if (!users) { users = kzalloc(USER_LIST_SIZE, GFP_ATOMIC); @@ -91,7 +91,7 @@ static int reg_init(void) } } spin_unlock_bh(®_lock); - return users ? TIPC_OK : -ENOMEM; + return users ? 0 : -ENOMEM; } /** @@ -129,7 +129,7 @@ int tipc_reg_start(void) tipc_k_signal((Handler)reg_callback, (unsigned long)&users[u]); } - return TIPC_OK; + return 0; } /** @@ -137,7 +137,7 @@ int tipc_reg_start(void) */ void tipc_reg_stop(void) -{ +{ int id; if (!users) @@ -174,17 +174,17 @@ int tipc_attach(u32 *userid, tipc_mode_event cb, void *usr_handle) user_ptr = &users[next_free_user]; *userid = next_free_user; next_free_user = user_ptr->next; - user_ptr->next = -1; + user_ptr->next = -1; spin_unlock_bh(®_lock); user_ptr->callback = cb; user_ptr->usr_handle = usr_handle; INIT_LIST_HEAD(&user_ptr->ports); atomic_inc(&tipc_user_count); - + if (cb && (tipc_mode != TIPC_NOT_RUNNING)) tipc_k_signal((Handler)reg_callback, (unsigned long)user_ptr); - return TIPC_OK; + return 0; } /** @@ -207,16 +207,16 @@ void tipc_detach(u32 userid) } user_ptr = &users[userid]; - user_ptr->callback = NULL; + user_ptr->callback = NULL; INIT_LIST_HEAD(&ports_temp); - list_splice(&user_ptr->ports, &ports_temp); + list_splice(&user_ptr->ports, &ports_temp); user_ptr->next = next_free_user; next_free_user = userid; spin_unlock_bh(®_lock); atomic_dec(&tipc_user_count); - list_for_each_entry_safe(up_ptr, temp_up_ptr, &ports_temp, uport_list) { + list_for_each_entry_safe(up_ptr, temp_up_ptr, &ports_temp, uport_list) { tipc_deleteport(up_ptr->ref); } } @@ -230,7 +230,7 @@ int tipc_reg_add_port(struct user_port *up_ptr) struct tipc_user *user_ptr; if (up_ptr->user_ref == 0) - return TIPC_OK; + return 0; if (up_ptr->user_ref > MAX_USERID) return -EINVAL; if ((tipc_mode == TIPC_NOT_RUNNING) || !users ) @@ -240,7 +240,7 @@ int tipc_reg_add_port(struct user_port *up_ptr) user_ptr = &users[up_ptr->user_ref]; list_add(&up_ptr->uport_list, &user_ptr->ports); spin_unlock_bh(®_lock); - return TIPC_OK; + return 0; } /** @@ -250,7 +250,7 @@ int tipc_reg_add_port(struct user_port *up_ptr) int tipc_reg_remove_port(struct user_port *up_ptr) { if (up_ptr->user_ref == 0) - return TIPC_OK; + return 0; if (up_ptr->user_ref > MAX_USERID) return -EINVAL; if (!users ) @@ -259,6 +259,6 @@ int tipc_reg_remove_port(struct user_port *up_ptr) spin_lock_bh(®_lock); list_del_init(&up_ptr->uport_list); spin_unlock_bh(®_lock); - return TIPC_OK; + return 0; }