提交 da0a75e8 编写于 作者: J Jon Maloy 提交者: David S. Miller

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: NYing Xue <ying.xue@windriver.com>
Signed-off-by: NJon Maloy <jon.maloy@ericsson.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 242e82cc
...@@ -326,10 +326,10 @@ static struct publication *tipc_nameseq_insert_publ(struct net *net, ...@@ -326,10 +326,10 @@ static struct publication *tipc_nameseq_insert_publ(struct net *net,
/* Any subscriptions waiting for notification? */ /* Any subscriptions waiting for notification? */
list_for_each_entry_safe(s, st, &nseq->subscriptions, nameseq_list) { list_for_each_entry_safe(s, st, &nseq->subscriptions, nameseq_list) {
tipc_subscrp_report_overlap(s, publ->lower, publ->upper, tipc_sub_report_overlap(s, publ->lower, publ->upper,
TIPC_PUBLISHED, publ->ref, TIPC_PUBLISHED, publ->ref,
publ->node, publ->scope, publ->node, publ->scope,
created_subseq); created_subseq);
} }
return publ; return publ;
} }
...@@ -397,10 +397,9 @@ static struct publication *tipc_nameseq_remove_publ(struct net *net, ...@@ -397,10 +397,9 @@ static struct publication *tipc_nameseq_remove_publ(struct net *net,
/* Notify any waiting subscriptions */ /* Notify any waiting subscriptions */
list_for_each_entry_safe(s, st, &nseq->subscriptions, nameseq_list) { list_for_each_entry_safe(s, st, &nseq->subscriptions, nameseq_list) {
tipc_subscrp_report_overlap(s, publ->lower, publ->upper, tipc_sub_report_overlap(s, publ->lower, publ->upper,
TIPC_WITHDRAWN, publ->ref, TIPC_WITHDRAWN, publ->ref, publ->node,
publ->node, publ->scope, publ->scope, removed_subseq);
removed_subseq);
} }
return publ; return publ;
...@@ -424,25 +423,25 @@ static void tipc_nameseq_subscribe(struct name_seq *nseq, ...@@ -424,25 +423,25 @@ static void tipc_nameseq_subscribe(struct name_seq *nseq,
ns.upper = tipc_sub_read(s, seq.upper); ns.upper = tipc_sub_read(s, seq.upper);
no_status = tipc_sub_read(s, filter) & TIPC_SUB_NO_STATUS; no_status = tipc_sub_read(s, filter) & TIPC_SUB_NO_STATUS;
tipc_subscrp_get(sub); tipc_sub_get(sub);
list_add(&sub->nameseq_list, &nseq->subscriptions); list_add(&sub->nameseq_list, &nseq->subscriptions);
if (no_status || !sseq) if (no_status || !sseq)
return; return;
while (sseq != &nseq->sseqs[nseq->first_free]) { while (sseq != &nseq->sseqs[nseq->first_free]) {
if (tipc_subscrp_check_overlap(&ns, sseq->lower, sseq->upper)) { if (tipc_sub_check_overlap(&ns, sseq->lower, sseq->upper)) {
struct publication *crs; struct publication *crs;
struct name_info *info = sseq->info; struct name_info *info = sseq->info;
int must_report = 1; int must_report = 1;
list_for_each_entry(crs, &info->zone_list, zone_list) { list_for_each_entry(crs, &info->zone_list, zone_list) {
tipc_subscrp_report_overlap(sub, sseq->lower, tipc_sub_report_overlap(sub, sseq->lower,
sseq->upper, sseq->upper,
TIPC_PUBLISHED, TIPC_PUBLISHED,
crs->ref, crs->node, crs->ref, crs->node,
crs->scope, crs->scope,
must_report); must_report);
must_report = 0; must_report = 0;
} }
} }
...@@ -856,7 +855,7 @@ void tipc_nametbl_unsubscribe(struct tipc_subscription *sub) ...@@ -856,7 +855,7 @@ void tipc_nametbl_unsubscribe(struct tipc_subscription *sub)
if (seq != NULL) { if (seq != NULL) {
spin_lock_bh(&seq->lock); spin_lock_bh(&seq->lock);
list_del_init(&sub->nameseq_list); list_del_init(&sub->nameseq_list);
tipc_subscrp_put(sub); tipc_sub_put(sub);
if (!seq->first_free && list_empty(&seq->subscriptions)) { if (!seq->first_free && list_empty(&seq->subscriptions)) {
hlist_del_init_rcu(&seq->ns_list); hlist_del_init_rcu(&seq->ns_list);
kfree(seq->sseqs); kfree(seq->sseqs);
......
...@@ -201,7 +201,7 @@ static void tipc_con_delete_sub(struct tipc_conn *con, struct tipc_subscr *s) ...@@ -201,7 +201,7 @@ static void tipc_con_delete_sub(struct tipc_conn *con, struct tipc_subscr *s)
struct tipc_subscription *sub, *tmp; struct tipc_subscription *sub, *tmp;
spin_lock_bh(&con->sub_lock); spin_lock_bh(&con->sub_lock);
list_for_each_entry_safe(sub, tmp, sub_list, subscrp_list) { list_for_each_entry_safe(sub, tmp, sub_list, sub_list) {
if (!s || !memcmp(s, &sub->evt.s, sizeof(*s))) if (!s || !memcmp(s, &sub->evt.s, sizeof(*s)))
tipc_sub_unsubscribe(sub); tipc_sub_unsubscribe(sub);
else if (s) else if (s)
...@@ -281,9 +281,8 @@ static int tipc_con_rcv_sub(struct tipc_server *srv, ...@@ -281,9 +281,8 @@ static int tipc_con_rcv_sub(struct tipc_server *srv,
sub = tipc_sub_subscribe(srv, s, con->conid); sub = tipc_sub_subscribe(srv, s, con->conid);
if (!sub) if (!sub)
return -1; return -1;
spin_lock_bh(&con->sub_lock); spin_lock_bh(&con->sub_lock);
list_add(&sub->subscrp_list, &con->sub_list); list_add(&sub->sub_list, &con->sub_list);
spin_unlock_bh(&con->sub_lock); spin_unlock_bh(&con->sub_lock);
return 0; return 0;
} }
......
...@@ -38,9 +38,9 @@ ...@@ -38,9 +38,9 @@
#include "name_table.h" #include "name_table.h"
#include "subscr.h" #include "subscr.h"
static void tipc_subscrp_send_event(struct tipc_subscription *sub, static void tipc_sub_send_event(struct tipc_subscription *sub,
u32 found_lower, u32 found_upper, u32 found_lower, u32 found_upper,
u32 event, u32 port, u32 node) u32 event, u32 port, u32 node)
{ {
struct tipc_event *evt = &sub->evt; struct tipc_event *evt = &sub->evt;
...@@ -55,13 +55,13 @@ static void tipc_subscrp_send_event(struct tipc_subscription *sub, ...@@ -55,13 +55,13 @@ static void tipc_subscrp_send_event(struct tipc_subscription *sub,
} }
/** /**
* tipc_subscrp_check_overlap - test for subscription overlap with the * tipc_sub_check_overlap - test for subscription overlap with the
* given values * given values
* *
* Returns 1 if there is overlap, otherwise 0. * Returns 1 if there is overlap, otherwise 0.
*/ */
int tipc_subscrp_check_overlap(struct tipc_name_seq *seq, u32 found_lower, int tipc_sub_check_overlap(struct tipc_name_seq *seq, u32 found_lower,
u32 found_upper) u32 found_upper)
{ {
if (found_lower < seq->lower) if (found_lower < seq->lower)
found_lower = seq->lower; found_lower = seq->lower;
...@@ -72,20 +72,20 @@ int tipc_subscrp_check_overlap(struct tipc_name_seq *seq, u32 found_lower, ...@@ -72,20 +72,20 @@ int tipc_subscrp_check_overlap(struct tipc_name_seq *seq, u32 found_lower,
return 1; return 1;
} }
void tipc_subscrp_report_overlap(struct tipc_subscription *sub, void tipc_sub_report_overlap(struct tipc_subscription *sub,
u32 found_lower, u32 found_upper, u32 found_lower, u32 found_upper,
u32 event, u32 port, u32 node, u32 event, u32 port, u32 node,
u32 scope, int must) u32 scope, int must)
{ {
struct tipc_name_seq seq;
struct tipc_subscr *s = &sub->evt.s; struct tipc_subscr *s = &sub->evt.s;
u32 filter = tipc_sub_read(s, filter); u32 filter = tipc_sub_read(s, filter);
struct tipc_name_seq seq;
seq.type = tipc_sub_read(s, seq.type); seq.type = tipc_sub_read(s, seq.type);
seq.lower = tipc_sub_read(s, seq.lower); seq.lower = tipc_sub_read(s, seq.lower);
seq.upper = tipc_sub_read(s, seq.upper); seq.upper = tipc_sub_read(s, seq.upper);
if (!tipc_subscrp_check_overlap(&seq, found_lower, found_upper)) if (!tipc_sub_check_overlap(&seq, found_lower, found_upper))
return; return;
if (!must && !(filter & TIPC_SUB_PORTS)) if (!must && !(filter & TIPC_SUB_PORTS))
...@@ -95,24 +95,24 @@ void tipc_subscrp_report_overlap(struct tipc_subscription *sub, ...@@ -95,24 +95,24 @@ void tipc_subscrp_report_overlap(struct tipc_subscription *sub,
if (filter & TIPC_SUB_NODE_SCOPE && scope != TIPC_NODE_SCOPE) if (filter & TIPC_SUB_NODE_SCOPE && scope != TIPC_NODE_SCOPE)
return; return;
spin_lock(&sub->lock); spin_lock(&sub->lock);
tipc_subscrp_send_event(sub, found_lower, found_upper, tipc_sub_send_event(sub, found_lower, found_upper,
event, port, node); event, port, node);
spin_unlock(&sub->lock); spin_unlock(&sub->lock);
} }
static void tipc_subscrp_timeout(struct timer_list *t) static void tipc_sub_timeout(struct timer_list *t)
{ {
struct tipc_subscription *sub = from_timer(sub, t, timer); struct tipc_subscription *sub = from_timer(sub, t, timer);
struct tipc_subscr *s = &sub->evt.s; struct tipc_subscr *s = &sub->evt.s;
spin_lock(&sub->lock); spin_lock(&sub->lock);
tipc_subscrp_send_event(sub, s->seq.lower, s->seq.upper, tipc_sub_send_event(sub, s->seq.lower, s->seq.upper,
TIPC_SUBSCR_TIMEOUT, 0, 0); TIPC_SUBSCR_TIMEOUT, 0, 0);
sub->inactive = true; sub->inactive = true;
spin_unlock(&sub->lock); spin_unlock(&sub->lock);
} }
static void tipc_subscrp_kref_release(struct kref *kref) static void tipc_sub_kref_release(struct kref *kref)
{ {
struct tipc_subscription *sub; struct tipc_subscription *sub;
struct tipc_net *tn; struct tipc_net *tn;
...@@ -124,12 +124,12 @@ static void tipc_subscrp_kref_release(struct kref *kref) ...@@ -124,12 +124,12 @@ static void tipc_subscrp_kref_release(struct kref *kref)
kfree(sub); kfree(sub);
} }
void tipc_subscrp_put(struct tipc_subscription *subscription) void tipc_sub_put(struct tipc_subscription *subscription)
{ {
kref_put(&subscription->kref, tipc_subscrp_kref_release); kref_put(&subscription->kref, tipc_sub_kref_release);
} }
void tipc_subscrp_get(struct tipc_subscription *subscription) void tipc_sub_get(struct tipc_subscription *subscription)
{ {
kref_get(&subscription->kref); kref_get(&subscription->kref);
} }
...@@ -139,8 +139,8 @@ struct tipc_subscription *tipc_sub_subscribe(struct tipc_server *srv, ...@@ -139,8 +139,8 @@ struct tipc_subscription *tipc_sub_subscribe(struct tipc_server *srv,
int conid) int conid)
{ {
struct tipc_net *tn = tipc_net(srv->net); struct tipc_net *tn = tipc_net(srv->net);
struct tipc_subscription *sub;
u32 filter = tipc_sub_read(s, filter); u32 filter = tipc_sub_read(s, filter);
struct tipc_subscription *sub;
u32 timeout; u32 timeout;
if (atomic_read(&tn->subscription_count) >= TIPC_MAX_SUBSCR) { if (atomic_read(&tn->subscription_count) >= TIPC_MAX_SUBSCR) {
...@@ -165,7 +165,7 @@ struct tipc_subscription *tipc_sub_subscribe(struct tipc_server *srv, ...@@ -165,7 +165,7 @@ struct tipc_subscription *tipc_sub_subscribe(struct tipc_server *srv,
atomic_inc(&tn->subscription_count); atomic_inc(&tn->subscription_count);
kref_init(&sub->kref); kref_init(&sub->kref);
tipc_nametbl_subscribe(sub); tipc_nametbl_subscribe(sub);
timer_setup(&sub->timer, tipc_subscrp_timeout, 0); timer_setup(&sub->timer, tipc_sub_timeout, 0);
timeout = tipc_sub_read(&sub->evt.s, timeout); timeout = tipc_sub_read(&sub->evt.s, timeout);
if (timeout != TIPC_WAIT_FOREVER) if (timeout != TIPC_WAIT_FOREVER)
mod_timer(&sub->timer, jiffies + msecs_to_jiffies(timeout)); mod_timer(&sub->timer, jiffies + msecs_to_jiffies(timeout));
...@@ -177,16 +177,16 @@ void tipc_sub_unsubscribe(struct tipc_subscription *sub) ...@@ -177,16 +177,16 @@ void tipc_sub_unsubscribe(struct tipc_subscription *sub)
tipc_nametbl_unsubscribe(sub); tipc_nametbl_unsubscribe(sub);
if (sub->evt.s.timeout != TIPC_WAIT_FOREVER) if (sub->evt.s.timeout != TIPC_WAIT_FOREVER)
del_timer_sync(&sub->timer); del_timer_sync(&sub->timer);
list_del(&sub->subscrp_list); list_del(&sub->sub_list);
tipc_subscrp_put(sub); tipc_sub_put(sub);
} }
int tipc_topsrv_start(struct net *net) int tipc_topsrv_start(struct net *net)
{ {
struct tipc_net *tn = net_generic(net, tipc_net_id); struct tipc_net *tn = net_generic(net, tipc_net_id);
const char name[] = "topology_server"; const char name[] = "topology_server";
struct tipc_server *topsrv;
struct sockaddr_tipc *saddr; struct sockaddr_tipc *saddr;
struct tipc_server *topsrv;
saddr = kzalloc(sizeof(*saddr), GFP_ATOMIC); saddr = kzalloc(sizeof(*saddr), GFP_ATOMIC);
if (!saddr) if (!saddr)
......
...@@ -51,7 +51,7 @@ struct tipc_conn; ...@@ -51,7 +51,7 @@ struct tipc_conn;
* @seq: name sequence associated with subscription * @seq: name sequence associated with subscription
* @timer: timer governing subscription duration (optional) * @timer: timer governing subscription duration (optional)
* @nameseq_list: adjacent subscriptions in name sequence's subscription list * @nameseq_list: adjacent subscriptions in name sequence's subscription list
* @subscrp_list: adjacent subscriptions in subscriber's subscription list * @sub_list: adjacent subscriptions in subscriber's subscription list
* @evt: template for events generated by subscription * @evt: template for events generated by subscription
*/ */
struct tipc_subscription { struct tipc_subscription {
...@@ -59,7 +59,7 @@ struct tipc_subscription { ...@@ -59,7 +59,7 @@ struct tipc_subscription {
struct tipc_server *server; struct tipc_server *server;
struct timer_list timer; struct timer_list timer;
struct list_head nameseq_list; struct list_head nameseq_list;
struct list_head subscrp_list; struct list_head sub_list;
struct tipc_event evt; struct tipc_event evt;
int conid; int conid;
bool inactive; bool inactive;
...@@ -71,17 +71,17 @@ struct tipc_subscription *tipc_sub_subscribe(struct tipc_server *srv, ...@@ -71,17 +71,17 @@ struct tipc_subscription *tipc_sub_subscribe(struct tipc_server *srv,
int conid); int conid);
void tipc_sub_unsubscribe(struct tipc_subscription *sub); void tipc_sub_unsubscribe(struct tipc_subscription *sub);
int tipc_subscrp_check_overlap(struct tipc_name_seq *seq, u32 found_lower, int tipc_sub_check_overlap(struct tipc_name_seq *seq, u32 found_lower,
u32 found_upper); u32 found_upper);
void tipc_subscrp_report_overlap(struct tipc_subscription *sub, void tipc_sub_report_overlap(struct tipc_subscription *sub,
u32 found_lower, u32 found_upper, u32 found_lower, u32 found_upper,
u32 event, u32 port, u32 node, u32 event, u32 port, u32 node,
u32 scope, int must); u32 scope, int must);
int tipc_topsrv_start(struct net *net); int tipc_topsrv_start(struct net *net);
void tipc_topsrv_stop(struct net *net); void tipc_topsrv_stop(struct net *net);
void tipc_subscrp_put(struct tipc_subscription *subscription); void tipc_sub_put(struct tipc_subscription *subscription);
void tipc_subscrp_get(struct tipc_subscription *subscription); void tipc_sub_get(struct tipc_subscription *subscription);
#define TIPC_FILTER_MASK (TIPC_SUB_PORTS | TIPC_SUB_SERVICE | TIPC_SUB_CANCEL) #define TIPC_FILTER_MASK (TIPC_SUB_PORTS | TIPC_SUB_SERVICE | TIPC_SUB_CANCEL)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册