diff options
author | Jon Maloy <jon.maloy@ericsson.com> | 2018-02-15 04:40:48 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2018-02-16 15:26:34 -0500 |
commit | da0a75e86ae230f92743c073843d3ea35bd061af (patch) | |
tree | 0d9399dc7925997a99590a8c65788768cf5aa588 /net/tipc | |
parent | 242e82cc95f6b4e83e1771f9915edcb2a63708e1 (diff) |
tipc: some prefix changes
Since we now have removed struct tipc_subscriber from the code, and
only struct tipc_subscription remains, there is no longer need for long
and awkward prefixes to distinguish between their pertaining functions.
We now change all tipc_subscrp_* prefixes to tipc_sub_*. This is
a purely cosmetic change.
Acked-by: Ying Xue <ying.xue@windriver.com>
Signed-off-by: Jon Maloy <jon.maloy@ericsson.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/tipc')
-rw-r--r-- | net/tipc/name_table.c | 33 | ||||
-rw-r--r-- | net/tipc/server.c | 5 | ||||
-rw-r--r-- | net/tipc/subscr.c | 52 | ||||
-rw-r--r-- | net/tipc/subscr.h | 20 |
4 files changed, 54 insertions, 56 deletions
diff --git a/net/tipc/name_table.c b/net/tipc/name_table.c index 2fbd0a20a958..b234b7ee0b84 100644 --- a/net/tipc/name_table.c +++ b/net/tipc/name_table.c | |||
@@ -326,10 +326,10 @@ static struct publication *tipc_nameseq_insert_publ(struct net *net, | |||
326 | 326 | ||
327 | /* Any subscriptions waiting for notification? */ | 327 | /* Any subscriptions waiting for notification? */ |
328 | list_for_each_entry_safe(s, st, &nseq->subscriptions, nameseq_list) { | 328 | list_for_each_entry_safe(s, st, &nseq->subscriptions, nameseq_list) { |
329 | tipc_subscrp_report_overlap(s, publ->lower, publ->upper, | 329 | tipc_sub_report_overlap(s, publ->lower, publ->upper, |
330 | TIPC_PUBLISHED, publ->ref, | 330 | TIPC_PUBLISHED, publ->ref, |
331 | publ->node, publ->scope, | 331 | publ->node, publ->scope, |
332 | created_subseq); | 332 | created_subseq); |
333 | } | 333 | } |
334 | return publ; | 334 | return publ; |
335 | } | 335 | } |
@@ -397,10 +397,9 @@ found: | |||
397 | 397 | ||
398 | /* Notify any waiting subscriptions */ | 398 | /* Notify any waiting subscriptions */ |
399 | list_for_each_entry_safe(s, st, &nseq->subscriptions, nameseq_list) { | 399 | list_for_each_entry_safe(s, st, &nseq->subscriptions, nameseq_list) { |
400 | tipc_subscrp_report_overlap(s, publ->lower, publ->upper, | 400 | tipc_sub_report_overlap(s, publ->lower, publ->upper, |
401 | TIPC_WITHDRAWN, publ->ref, | 401 | TIPC_WITHDRAWN, publ->ref, publ->node, |
402 | publ->node, publ->scope, | 402 | publ->scope, removed_subseq); |
403 | removed_subseq); | ||
404 | } | 403 | } |
405 | 404 | ||
406 | return publ; | 405 | return publ; |
@@ -424,25 +423,25 @@ static void tipc_nameseq_subscribe(struct name_seq *nseq, | |||
424 | ns.upper = tipc_sub_read(s, seq.upper); | 423 | ns.upper = tipc_sub_read(s, seq.upper); |
425 | no_status = tipc_sub_read(s, filter) & TIPC_SUB_NO_STATUS; | 424 | no_status = tipc_sub_read(s, filter) & TIPC_SUB_NO_STATUS; |
426 | 425 | ||
427 | tipc_subscrp_get(sub); | 426 | tipc_sub_get(sub); |
428 | list_add(&sub->nameseq_list, &nseq->subscriptions); | 427 | list_add(&sub->nameseq_list, &nseq->subscriptions); |
429 | 428 | ||
430 | if (no_status || !sseq) | 429 | if (no_status || !sseq) |
431 | return; | 430 | return; |
432 | 431 | ||
433 | while (sseq != &nseq->sseqs[nseq->first_free]) { | 432 | while (sseq != &nseq->sseqs[nseq->first_free]) { |
434 | if (tipc_subscrp_check_overlap(&ns, sseq->lower, sseq->upper)) { | 433 | if (tipc_sub_check_overlap(&ns, sseq->lower, sseq->upper)) { |
435 | struct publication *crs; | 434 | struct publication *crs; |
436 | struct name_info *info = sseq->info; | 435 | struct name_info *info = sseq->info; |
437 | int must_report = 1; | 436 | int must_report = 1; |
438 | 437 | ||
439 | list_for_each_entry(crs, &info->zone_list, zone_list) { | 438 | list_for_each_entry(crs, &info->zone_list, zone_list) { |
440 | tipc_subscrp_report_overlap(sub, sseq->lower, | 439 | tipc_sub_report_overlap(sub, sseq->lower, |
441 | sseq->upper, | 440 | sseq->upper, |
442 | TIPC_PUBLISHED, | 441 | TIPC_PUBLISHED, |
443 | crs->ref, crs->node, | 442 | crs->ref, crs->node, |
444 | crs->scope, | 443 | crs->scope, |
445 | must_report); | 444 | must_report); |
446 | must_report = 0; | 445 | must_report = 0; |
447 | } | 446 | } |
448 | } | 447 | } |
@@ -856,7 +855,7 @@ void tipc_nametbl_unsubscribe(struct tipc_subscription *sub) | |||
856 | if (seq != NULL) { | 855 | if (seq != NULL) { |
857 | spin_lock_bh(&seq->lock); | 856 | spin_lock_bh(&seq->lock); |
858 | list_del_init(&sub->nameseq_list); | 857 | list_del_init(&sub->nameseq_list); |
859 | tipc_subscrp_put(sub); | 858 | tipc_sub_put(sub); |
860 | if (!seq->first_free && list_empty(&seq->subscriptions)) { | 859 | if (!seq->first_free && list_empty(&seq->subscriptions)) { |
861 | hlist_del_init_rcu(&seq->ns_list); | 860 | hlist_del_init_rcu(&seq->ns_list); |
862 | kfree(seq->sseqs); | 861 | kfree(seq->sseqs); |
diff --git a/net/tipc/server.c b/net/tipc/server.c index 6a18b10ac271..a5c112ed3bbe 100644 --- a/net/tipc/server.c +++ b/net/tipc/server.c | |||
@@ -201,7 +201,7 @@ static void tipc_con_delete_sub(struct tipc_conn *con, struct tipc_subscr *s) | |||
201 | struct tipc_subscription *sub, *tmp; | 201 | struct tipc_subscription *sub, *tmp; |
202 | 202 | ||
203 | spin_lock_bh(&con->sub_lock); | 203 | spin_lock_bh(&con->sub_lock); |
204 | list_for_each_entry_safe(sub, tmp, sub_list, subscrp_list) { | 204 | list_for_each_entry_safe(sub, tmp, sub_list, sub_list) { |
205 | if (!s || !memcmp(s, &sub->evt.s, sizeof(*s))) | 205 | if (!s || !memcmp(s, &sub->evt.s, sizeof(*s))) |
206 | tipc_sub_unsubscribe(sub); | 206 | tipc_sub_unsubscribe(sub); |
207 | else if (s) | 207 | else if (s) |
@@ -281,9 +281,8 @@ static int tipc_con_rcv_sub(struct tipc_server *srv, | |||
281 | sub = tipc_sub_subscribe(srv, s, con->conid); | 281 | sub = tipc_sub_subscribe(srv, s, con->conid); |
282 | if (!sub) | 282 | if (!sub) |
283 | return -1; | 283 | return -1; |
284 | |||
285 | spin_lock_bh(&con->sub_lock); | 284 | spin_lock_bh(&con->sub_lock); |
286 | list_add(&sub->subscrp_list, &con->sub_list); | 285 | list_add(&sub->sub_list, &con->sub_list); |
287 | spin_unlock_bh(&con->sub_lock); | 286 | spin_unlock_bh(&con->sub_lock); |
288 | return 0; | 287 | return 0; |
289 | } | 288 | } |
diff --git a/net/tipc/subscr.c b/net/tipc/subscr.c index 8d37b61e3163..3be1e4b6cbfa 100644 --- a/net/tipc/subscr.c +++ b/net/tipc/subscr.c | |||
@@ -38,9 +38,9 @@ | |||
38 | #include "name_table.h" | 38 | #include "name_table.h" |
39 | #include "subscr.h" | 39 | #include "subscr.h" |
40 | 40 | ||
41 | static void tipc_subscrp_send_event(struct tipc_subscription *sub, | 41 | static void tipc_sub_send_event(struct tipc_subscription *sub, |
42 | u32 found_lower, u32 found_upper, | 42 | u32 found_lower, u32 found_upper, |
43 | u32 event, u32 port, u32 node) | 43 | u32 event, u32 port, u32 node) |
44 | { | 44 | { |
45 | struct tipc_event *evt = &sub->evt; | 45 | struct tipc_event *evt = &sub->evt; |
46 | 46 | ||
@@ -55,13 +55,13 @@ static void tipc_subscrp_send_event(struct tipc_subscription *sub, | |||
55 | } | 55 | } |
56 | 56 | ||
57 | /** | 57 | /** |
58 | * tipc_subscrp_check_overlap - test for subscription overlap with the | 58 | * tipc_sub_check_overlap - test for subscription overlap with the |
59 | * given values | 59 | * given values |
60 | * | 60 | * |
61 | * Returns 1 if there is overlap, otherwise 0. | 61 | * Returns 1 if there is overlap, otherwise 0. |
62 | */ | 62 | */ |
63 | int tipc_subscrp_check_overlap(struct tipc_name_seq *seq, u32 found_lower, | 63 | int tipc_sub_check_overlap(struct tipc_name_seq *seq, u32 found_lower, |
64 | u32 found_upper) | 64 | u32 found_upper) |
65 | { | 65 | { |
66 | if (found_lower < seq->lower) | 66 | if (found_lower < seq->lower) |
67 | found_lower = seq->lower; | 67 | found_lower = seq->lower; |
@@ -72,20 +72,20 @@ int tipc_subscrp_check_overlap(struct tipc_name_seq *seq, u32 found_lower, | |||
72 | return 1; | 72 | return 1; |
73 | } | 73 | } |
74 | 74 | ||
75 | void tipc_subscrp_report_overlap(struct tipc_subscription *sub, | 75 | void tipc_sub_report_overlap(struct tipc_subscription *sub, |
76 | u32 found_lower, u32 found_upper, | 76 | u32 found_lower, u32 found_upper, |
77 | u32 event, u32 port, u32 node, | 77 | u32 event, u32 port, u32 node, |
78 | u32 scope, int must) | 78 | u32 scope, int must) |
79 | { | 79 | { |
80 | struct tipc_name_seq seq; | ||
81 | struct tipc_subscr *s = &sub->evt.s; | 80 | struct tipc_subscr *s = &sub->evt.s; |
82 | u32 filter = tipc_sub_read(s, filter); | 81 | u32 filter = tipc_sub_read(s, filter); |
82 | struct tipc_name_seq seq; | ||
83 | 83 | ||
84 | seq.type = tipc_sub_read(s, seq.type); | 84 | seq.type = tipc_sub_read(s, seq.type); |
85 | seq.lower = tipc_sub_read(s, seq.lower); | 85 | seq.lower = tipc_sub_read(s, seq.lower); |
86 | seq.upper = tipc_sub_read(s, seq.upper); | 86 | seq.upper = tipc_sub_read(s, seq.upper); |
87 | 87 | ||
88 | if (!tipc_subscrp_check_overlap(&seq, found_lower, found_upper)) | 88 | if (!tipc_sub_check_overlap(&seq, found_lower, found_upper)) |
89 | return; | 89 | return; |
90 | 90 | ||
91 | if (!must && !(filter & TIPC_SUB_PORTS)) | 91 | if (!must && !(filter & TIPC_SUB_PORTS)) |
@@ -95,24 +95,24 @@ void tipc_subscrp_report_overlap(struct tipc_subscription *sub, | |||
95 | if (filter & TIPC_SUB_NODE_SCOPE && scope != TIPC_NODE_SCOPE) | 95 | if (filter & TIPC_SUB_NODE_SCOPE && scope != TIPC_NODE_SCOPE) |
96 | return; | 96 | return; |
97 | spin_lock(&sub->lock); | 97 | spin_lock(&sub->lock); |
98 | tipc_subscrp_send_event(sub, found_lower, found_upper, | 98 | tipc_sub_send_event(sub, found_lower, found_upper, |
99 | event, port, node); | 99 | event, port, node); |
100 | spin_unlock(&sub->lock); | 100 | spin_unlock(&sub->lock); |
101 | } | 101 | } |
102 | 102 | ||
103 | static void tipc_subscrp_timeout(struct timer_list *t) | 103 | static void tipc_sub_timeout(struct timer_list *t) |
104 | { | 104 | { |
105 | struct tipc_subscription *sub = from_timer(sub, t, timer); | 105 | struct tipc_subscription *sub = from_timer(sub, t, timer); |
106 | struct tipc_subscr *s = &sub->evt.s; | 106 | struct tipc_subscr *s = &sub->evt.s; |
107 | 107 | ||
108 | spin_lock(&sub->lock); | 108 | spin_lock(&sub->lock); |
109 | tipc_subscrp_send_event(sub, s->seq.lower, s->seq.upper, | 109 | tipc_sub_send_event(sub, s->seq.lower, s->seq.upper, |
110 | TIPC_SUBSCR_TIMEOUT, 0, 0); | 110 | TIPC_SUBSCR_TIMEOUT, 0, 0); |
111 | sub->inactive = true; | 111 | sub->inactive = true; |
112 | spin_unlock(&sub->lock); | 112 | spin_unlock(&sub->lock); |
113 | } | 113 | } |
114 | 114 | ||
115 | static void tipc_subscrp_kref_release(struct kref *kref) | 115 | static void tipc_sub_kref_release(struct kref *kref) |
116 | { | 116 | { |
117 | struct tipc_subscription *sub; | 117 | struct tipc_subscription *sub; |
118 | struct tipc_net *tn; | 118 | struct tipc_net *tn; |
@@ -124,12 +124,12 @@ static void tipc_subscrp_kref_release(struct kref *kref) | |||
124 | kfree(sub); | 124 | kfree(sub); |
125 | } | 125 | } |
126 | 126 | ||
127 | void tipc_subscrp_put(struct tipc_subscription *subscription) | 127 | void tipc_sub_put(struct tipc_subscription *subscription) |
128 | { | 128 | { |
129 | kref_put(&subscription->kref, tipc_subscrp_kref_release); | 129 | kref_put(&subscription->kref, tipc_sub_kref_release); |
130 | } | 130 | } |
131 | 131 | ||
132 | void tipc_subscrp_get(struct tipc_subscription *subscription) | 132 | void tipc_sub_get(struct tipc_subscription *subscription) |
133 | { | 133 | { |
134 | kref_get(&subscription->kref); | 134 | kref_get(&subscription->kref); |
135 | } | 135 | } |
@@ -139,8 +139,8 @@ struct tipc_subscription *tipc_sub_subscribe(struct tipc_server *srv, | |||
139 | int conid) | 139 | int conid) |
140 | { | 140 | { |
141 | struct tipc_net *tn = tipc_net(srv->net); | 141 | struct tipc_net *tn = tipc_net(srv->net); |
142 | struct tipc_subscription *sub; | ||
143 | u32 filter = tipc_sub_read(s, filter); | 142 | u32 filter = tipc_sub_read(s, filter); |
143 | struct tipc_subscription *sub; | ||
144 | u32 timeout; | 144 | u32 timeout; |
145 | 145 | ||
146 | if (atomic_read(&tn->subscription_count) >= TIPC_MAX_SUBSCR) { | 146 | if (atomic_read(&tn->subscription_count) >= TIPC_MAX_SUBSCR) { |
@@ -165,7 +165,7 @@ struct tipc_subscription *tipc_sub_subscribe(struct tipc_server *srv, | |||
165 | atomic_inc(&tn->subscription_count); | 165 | atomic_inc(&tn->subscription_count); |
166 | kref_init(&sub->kref); | 166 | kref_init(&sub->kref); |
167 | tipc_nametbl_subscribe(sub); | 167 | tipc_nametbl_subscribe(sub); |
168 | timer_setup(&sub->timer, tipc_subscrp_timeout, 0); | 168 | timer_setup(&sub->timer, tipc_sub_timeout, 0); |
169 | timeout = tipc_sub_read(&sub->evt.s, timeout); | 169 | timeout = tipc_sub_read(&sub->evt.s, timeout); |
170 | if (timeout != TIPC_WAIT_FOREVER) | 170 | if (timeout != TIPC_WAIT_FOREVER) |
171 | mod_timer(&sub->timer, jiffies + msecs_to_jiffies(timeout)); | 171 | mod_timer(&sub->timer, jiffies + msecs_to_jiffies(timeout)); |
@@ -177,16 +177,16 @@ void tipc_sub_unsubscribe(struct tipc_subscription *sub) | |||
177 | tipc_nametbl_unsubscribe(sub); | 177 | tipc_nametbl_unsubscribe(sub); |
178 | if (sub->evt.s.timeout != TIPC_WAIT_FOREVER) | 178 | if (sub->evt.s.timeout != TIPC_WAIT_FOREVER) |
179 | del_timer_sync(&sub->timer); | 179 | del_timer_sync(&sub->timer); |
180 | list_del(&sub->subscrp_list); | 180 | list_del(&sub->sub_list); |
181 | tipc_subscrp_put(sub); | 181 | tipc_sub_put(sub); |
182 | } | 182 | } |
183 | 183 | ||
184 | int tipc_topsrv_start(struct net *net) | 184 | int tipc_topsrv_start(struct net *net) |
185 | { | 185 | { |
186 | struct tipc_net *tn = net_generic(net, tipc_net_id); | 186 | struct tipc_net *tn = net_generic(net, tipc_net_id); |
187 | const char name[] = "topology_server"; | 187 | const char name[] = "topology_server"; |
188 | struct tipc_server *topsrv; | ||
189 | struct sockaddr_tipc *saddr; | 188 | struct sockaddr_tipc *saddr; |
189 | struct tipc_server *topsrv; | ||
190 | 190 | ||
191 | saddr = kzalloc(sizeof(*saddr), GFP_ATOMIC); | 191 | saddr = kzalloc(sizeof(*saddr), GFP_ATOMIC); |
192 | if (!saddr) | 192 | if (!saddr) |
diff --git a/net/tipc/subscr.h b/net/tipc/subscr.h index 2d35f1046754..720932896ba6 100644 --- a/net/tipc/subscr.h +++ b/net/tipc/subscr.h | |||
@@ -51,7 +51,7 @@ struct tipc_conn; | |||
51 | * @seq: name sequence associated with subscription | 51 | * @seq: name sequence associated with subscription |
52 | * @timer: timer governing subscription duration (optional) | 52 | * @timer: timer governing subscription duration (optional) |
53 | * @nameseq_list: adjacent subscriptions in name sequence's subscription list | 53 | * @nameseq_list: adjacent subscriptions in name sequence's subscription list |
54 | * @subscrp_list: adjacent subscriptions in subscriber's subscription list | 54 | * @sub_list: adjacent subscriptions in subscriber's subscription list |
55 | * @evt: template for events generated by subscription | 55 | * @evt: template for events generated by subscription |
56 | */ | 56 | */ |
57 | struct tipc_subscription { | 57 | struct tipc_subscription { |
@@ -59,7 +59,7 @@ struct tipc_subscription { | |||
59 | struct tipc_server *server; | 59 | struct tipc_server *server; |
60 | struct timer_list timer; | 60 | struct timer_list timer; |
61 | struct list_head nameseq_list; | 61 | struct list_head nameseq_list; |
62 | struct list_head subscrp_list; | 62 | struct list_head sub_list; |
63 | struct tipc_event evt; | 63 | struct tipc_event evt; |
64 | int conid; | 64 | int conid; |
65 | bool inactive; | 65 | bool inactive; |
@@ -71,17 +71,17 @@ struct tipc_subscription *tipc_sub_subscribe(struct tipc_server *srv, | |||
71 | int conid); | 71 | int conid); |
72 | void tipc_sub_unsubscribe(struct tipc_subscription *sub); | 72 | void tipc_sub_unsubscribe(struct tipc_subscription *sub); |
73 | 73 | ||
74 | int tipc_subscrp_check_overlap(struct tipc_name_seq *seq, u32 found_lower, | 74 | int tipc_sub_check_overlap(struct tipc_name_seq *seq, u32 found_lower, |
75 | u32 found_upper); | 75 | u32 found_upper); |
76 | void tipc_subscrp_report_overlap(struct tipc_subscription *sub, | 76 | void tipc_sub_report_overlap(struct tipc_subscription *sub, |
77 | u32 found_lower, u32 found_upper, | 77 | u32 found_lower, u32 found_upper, |
78 | u32 event, u32 port, u32 node, | 78 | u32 event, u32 port, u32 node, |
79 | u32 scope, int must); | 79 | u32 scope, int must); |
80 | int tipc_topsrv_start(struct net *net); | 80 | int tipc_topsrv_start(struct net *net); |
81 | void tipc_topsrv_stop(struct net *net); | 81 | void tipc_topsrv_stop(struct net *net); |
82 | 82 | ||
83 | void tipc_subscrp_put(struct tipc_subscription *subscription); | 83 | void tipc_sub_put(struct tipc_subscription *subscription); |
84 | void tipc_subscrp_get(struct tipc_subscription *subscription); | 84 | void tipc_sub_get(struct tipc_subscription *subscription); |
85 | 85 | ||
86 | #define TIPC_FILTER_MASK (TIPC_SUB_PORTS | TIPC_SUB_SERVICE | TIPC_SUB_CANCEL) | 86 | #define TIPC_FILTER_MASK (TIPC_SUB_PORTS | TIPC_SUB_SERVICE | TIPC_SUB_CANCEL) |
87 | 87 | ||