4242 * struct tipc_subscriber - TIPC network topology subscriber
4343 * @conid: connection identifier to server connecting to subscriber
4444 * @lock: control access to subscriber
45- * @subscription_list : list of subscription objects for this subscriber
45+ * @subscrp_list : list of subscription objects for this subscriber
4646 */
4747struct tipc_subscriber {
4848 int conid ;
4949 spinlock_t lock ;
50- struct list_head subscription_list ;
50+ struct list_head subscrp_list ;
5151};
5252
5353/**
@@ -62,9 +62,9 @@ static u32 htohl(u32 in, int swap)
6262 return swap ? swab32 (in ) : in ;
6363}
6464
65- static void subscr_send_event (struct tipc_subscription * sub , u32 found_lower ,
66- u32 found_upper , u32 event , u32 port_ref ,
67- u32 node )
65+ static void tipc_subscrp_send_event (struct tipc_subscription * sub ,
66+ u32 found_lower , u32 found_upper ,
67+ u32 event , u32 port_ref , u32 node )
6868{
6969 struct tipc_net * tn = net_generic (sub -> net , tipc_net_id );
7070 struct tipc_subscriber * subscriber = sub -> subscriber ;
@@ -82,12 +82,13 @@ static void subscr_send_event(struct tipc_subscription *sub, u32 found_lower,
8282}
8383
8484/**
85- * tipc_subscr_overlap - test for subscription overlap with the given values
85+ * tipc_subscrp_check_overlap - test for subscription overlap with the
86+ * given values
8687 *
8788 * Returns 1 if there is overlap, otherwise 0.
8889 */
89- int tipc_subscr_overlap (struct tipc_subscription * sub , u32 found_lower ,
90- u32 found_upper )
90+ int tipc_subscrp_check_overlap (struct tipc_subscription * sub , u32 found_lower ,
91+ u32 found_upper )
9192{
9293 if (found_lower < sub -> seq .lower )
9394 found_lower = sub -> seq .lower ;
@@ -98,24 +99,20 @@ int tipc_subscr_overlap(struct tipc_subscription *sub, u32 found_lower,
9899 return 1 ;
99100}
100101
101- /**
102- * tipc_subscr_report_overlap - issue event if there is subscription overlap
103- *
104- * Protected by nameseq.lock in name_table.c
105- */
106- void tipc_subscr_report_overlap (struct tipc_subscription * sub , u32 found_lower ,
107- u32 found_upper , u32 event , u32 port_ref ,
108- u32 node , int must )
102+ void tipc_subscrp_report_overlap (struct tipc_subscription * sub , u32 found_lower ,
103+ u32 found_upper , u32 event , u32 port_ref ,
104+ u32 node , int must )
109105{
110- if (!tipc_subscr_overlap (sub , found_lower , found_upper ))
106+ if (!tipc_subscrp_check_overlap (sub , found_lower , found_upper ))
111107 return ;
112108 if (!must && !(sub -> filter & TIPC_SUB_PORTS ))
113109 return ;
114110
115- subscr_send_event (sub , found_lower , found_upper , event , port_ref , node );
111+ tipc_subscrp_send_event (sub , found_lower , found_upper , event , port_ref ,
112+ node );
116113}
117114
118- static void subscr_timeout (unsigned long data )
115+ static void tipc_subscrp_timeout (unsigned long data )
119116{
120117 struct tipc_subscription * sub = (struct tipc_subscription * )data ;
121118 struct tipc_subscriber * subscriber = sub -> subscriber ;
@@ -134,50 +131,45 @@ static void subscr_timeout(unsigned long data)
134131 tipc_nametbl_unsubscribe (sub );
135132
136133 /* Unlink subscription from subscriber */
137- list_del (& sub -> subscription_list );
134+ list_del (& sub -> subscrp_list );
138135
139136 spin_unlock_bh (& subscriber -> lock );
140137
141138 /* Notify subscriber of timeout */
142- subscr_send_event (sub , sub -> evt .s .seq .lower , sub -> evt .s .seq .upper ,
143- TIPC_SUBSCR_TIMEOUT , 0 , 0 );
139+ tipc_subscrp_send_event (sub , sub -> evt .s .seq .lower , sub -> evt .s .seq .upper ,
140+ TIPC_SUBSCR_TIMEOUT , 0 , 0 );
144141
145142 /* Now destroy subscription */
146143 kfree (sub );
147144 atomic_dec (& tn -> subscription_count );
148145}
149146
150- /**
151- * subscr_del - delete a subscription within a subscription list
152- *
153- * Called with subscriber lock held.
154- */
155- static void subscr_del (struct tipc_subscription * sub )
147+ static void tipc_subscrp_delete (struct tipc_subscription * sub )
156148{
157149 struct tipc_net * tn = net_generic (sub -> net , tipc_net_id );
158150
159151 tipc_nametbl_unsubscribe (sub );
160- list_del (& sub -> subscription_list );
152+ list_del (& sub -> subscrp_list );
161153 kfree (sub );
162154 atomic_dec (& tn -> subscription_count );
163155}
164156
165- static void subscr_release (struct tipc_subscriber * subscriber )
157+ static void tipc_subscrb_delete (struct tipc_subscriber * subscriber )
166158{
167159 struct tipc_subscription * sub ;
168160 struct tipc_subscription * sub_temp ;
169161
170162 spin_lock_bh (& subscriber -> lock );
171163
172164 /* Destroy any existing subscriptions for subscriber */
173- list_for_each_entry_safe (sub , sub_temp , & subscriber -> subscription_list ,
174- subscription_list ) {
165+ list_for_each_entry_safe (sub , sub_temp , & subscriber -> subscrp_list ,
166+ subscrp_list ) {
175167 if (sub -> timeout != TIPC_WAIT_FOREVER ) {
176168 spin_unlock_bh (& subscriber -> lock );
177169 del_timer_sync (& sub -> timer );
178170 spin_lock_bh (& subscriber -> lock );
179171 }
180- subscr_del (sub );
172+ tipc_subscrp_delete (sub );
181173 }
182174 spin_unlock_bh (& subscriber -> lock );
183175
@@ -186,24 +178,24 @@ static void subscr_release(struct tipc_subscriber *subscriber)
186178}
187179
188180/**
189- * subscr_cancel - handle subscription cancellation request
181+ * tipc_subscrp_cancel - handle subscription cancellation request
190182 *
191183 * Called with subscriber lock held. Routine must temporarily release lock
192184 * to enable the subscription timeout routine to finish without deadlocking;
193185 * the lock is then reclaimed to allow caller to release it upon return.
194186 *
195187 * Note that fields of 's' use subscriber's endianness!
196188 */
197- static void subscr_cancel (struct tipc_subscr * s ,
198- struct tipc_subscriber * subscriber )
189+ static void tipc_subscrp_cancel (struct tipc_subscr * s ,
190+ struct tipc_subscriber * subscriber )
199191{
200192 struct tipc_subscription * sub ;
201193 struct tipc_subscription * sub_temp ;
202194 int found = 0 ;
203195
204196 /* Find first matching subscription, exit if not found */
205- list_for_each_entry_safe (sub , sub_temp , & subscriber -> subscription_list ,
206- subscription_list ) {
197+ list_for_each_entry_safe (sub , sub_temp , & subscriber -> subscrp_list ,
198+ subscrp_list ) {
207199 if (!memcmp (s , & sub -> evt .s , sizeof (struct tipc_subscr ))) {
208200 found = 1 ;
209201 break ;
@@ -219,17 +211,12 @@ static void subscr_cancel(struct tipc_subscr *s,
219211 del_timer_sync (& sub -> timer );
220212 spin_lock_bh (& subscriber -> lock );
221213 }
222- subscr_del (sub );
214+ tipc_subscrp_delete (sub );
223215}
224216
225- /**
226- * subscr_subscribe - create subscription for subscriber
227- *
228- * Called with subscriber lock held.
229- */
230- static int subscr_subscribe (struct net * net , struct tipc_subscr * s ,
231- struct tipc_subscriber * subscriber ,
232- struct tipc_subscription * * sub_p )
217+ static int tipc_subscrp_create (struct net * net , struct tipc_subscr * s ,
218+ struct tipc_subscriber * subscriber ,
219+ struct tipc_subscription * * sub_p )
233220{
234221 struct tipc_net * tn = net_generic (net , tipc_net_id );
235222 struct tipc_subscription * sub ;
@@ -241,7 +228,7 @@ static int subscr_subscribe(struct net *net, struct tipc_subscr *s,
241228 /* Detect & process a subscription cancellation request */
242229 if (s -> filter & htohl (TIPC_SUB_CANCEL , swap )) {
243230 s -> filter &= ~htohl (TIPC_SUB_CANCEL , swap );
244- subscr_cancel (s , subscriber );
231+ tipc_subscrp_cancel (s , subscriber );
245232 return 0 ;
246233 }
247234
@@ -273,36 +260,37 @@ static int subscr_subscribe(struct net *net, struct tipc_subscr *s,
273260 kfree (sub );
274261 return - EINVAL ;
275262 }
276- list_add (& sub -> subscription_list , & subscriber -> subscription_list );
263+ list_add (& sub -> subscrp_list , & subscriber -> subscrp_list );
277264 sub -> subscriber = subscriber ;
278265 sub -> swap = swap ;
279- memcpy (& sub -> evt .s , s , sizeof (struct tipc_subscr ));
266+ memcpy (& sub -> evt .s , s , sizeof (* s ));
280267 atomic_inc (& tn -> subscription_count );
281268 if (sub -> timeout != TIPC_WAIT_FOREVER ) {
282- setup_timer (& sub -> timer , subscr_timeout , (unsigned long )sub );
269+ setup_timer (& sub -> timer , tipc_subscrp_timeout ,
270+ (unsigned long )sub );
283271 mod_timer (& sub -> timer , jiffies + sub -> timeout );
284272 }
285273 * sub_p = sub ;
286274 return 0 ;
287275}
288276
289277/* Handle one termination request for the subscriber */
290- static void subscr_conn_shutdown_event (int conid , void * usr_data )
278+ static void tipc_subscrb_shutdown_cb (int conid , void * usr_data )
291279{
292- subscr_release ((struct tipc_subscriber * )usr_data );
280+ tipc_subscrb_delete ((struct tipc_subscriber * )usr_data );
293281}
294282
295283/* Handle one request to create a new subscription for the subscriber */
296- static void subscr_conn_msg_event (struct net * net , int conid ,
297- struct sockaddr_tipc * addr , void * usr_data ,
298- void * buf , size_t len )
284+ static void tipc_subscrb_rcv_cb (struct net * net , int conid ,
285+ struct sockaddr_tipc * addr , void * usr_data ,
286+ void * buf , size_t len )
299287{
300288 struct tipc_subscriber * subscriber = usr_data ;
301289 struct tipc_subscription * sub = NULL ;
302290 struct tipc_net * tn = net_generic (net , tipc_net_id );
303291
304292 spin_lock_bh (& subscriber -> lock );
305- subscr_subscribe (net , (struct tipc_subscr * )buf , subscriber , & sub );
293+ tipc_subscrp_create (net , (struct tipc_subscr * )buf , subscriber , & sub );
306294 if (sub )
307295 tipc_nametbl_subscribe (sub );
308296 else
@@ -311,7 +299,7 @@ static void subscr_conn_msg_event(struct net *net, int conid,
311299}
312300
313301/* Handle one request to establish a new subscriber */
314- static void * subscr_named_msg_event (int conid )
302+ static void * tipc_subscrb_connect_cb (int conid )
315303{
316304 struct tipc_subscriber * subscriber ;
317305
@@ -321,14 +309,14 @@ static void *subscr_named_msg_event(int conid)
321309 pr_warn ("Subscriber rejected, no memory\n" );
322310 return NULL ;
323311 }
324- INIT_LIST_HEAD (& subscriber -> subscription_list );
312+ INIT_LIST_HEAD (& subscriber -> subscrp_list );
325313 subscriber -> conid = conid ;
326314 spin_lock_init (& subscriber -> lock );
327315
328316 return (void * )subscriber ;
329317}
330318
331- int tipc_subscr_start (struct net * net )
319+ int tipc_topsrv_start (struct net * net )
332320{
333321 struct tipc_net * tn = net_generic (net , tipc_net_id );
334322 const char name [] = "topology_server" ;
@@ -355,9 +343,9 @@ int tipc_subscr_start(struct net *net)
355343 topsrv -> imp = TIPC_CRITICAL_IMPORTANCE ;
356344 topsrv -> type = SOCK_SEQPACKET ;
357345 topsrv -> max_rcvbuf_size = sizeof (struct tipc_subscr );
358- topsrv -> tipc_conn_recvmsg = subscr_conn_msg_event ;
359- topsrv -> tipc_conn_new = subscr_named_msg_event ;
360- topsrv -> tipc_conn_shutdown = subscr_conn_shutdown_event ;
346+ topsrv -> tipc_conn_recvmsg = tipc_subscrb_rcv_cb ;
347+ topsrv -> tipc_conn_new = tipc_subscrb_connect_cb ;
348+ topsrv -> tipc_conn_shutdown = tipc_subscrb_shutdown_cb ;
361349
362350 strncpy (topsrv -> name , name , strlen (name ) + 1 );
363351 tn -> topsrv = topsrv ;
@@ -366,7 +354,7 @@ int tipc_subscr_start(struct net *net)
366354 return tipc_server_start (topsrv );
367355}
368356
369- void tipc_subscr_stop (struct net * net )
357+ void tipc_topsrv_stop (struct net * net )
370358{
371359 struct tipc_net * tn = net_generic (net , tipc_net_id );
372360 struct tipc_server * topsrv = tn -> topsrv ;
0 commit comments