Lines Matching refs:sub
41 static void tipc_sub_send_event(struct tipc_subscription *sub,
45 struct tipc_event *evt = &sub->evt;
47 if (sub->inactive)
54 tipc_topsrv_queue_evt(sub->net, sub->conid, event, evt);
75 void tipc_sub_report_overlap(struct tipc_subscription *sub,
80 struct tipc_subscr *s = &sub->evt.s;
97 spin_lock(&sub->lock);
98 tipc_sub_send_event(sub, found_lower, found_upper,
100 spin_unlock(&sub->lock);
105 struct tipc_subscription *sub = from_timer(sub, t, timer);
106 struct tipc_subscr *s = &sub->evt.s;
108 spin_lock(&sub->lock);
109 tipc_sub_send_event(sub, s->seq.lower, s->seq.upper,
111 sub->inactive = true;
112 spin_unlock(&sub->lock);
135 struct tipc_subscription *sub;
143 sub = kmalloc(sizeof(*sub), GFP_ATOMIC);
144 if (!sub) {
148 INIT_LIST_HEAD(&sub->service_list);
149 INIT_LIST_HEAD(&sub->sub_list);
150 sub->net = net;
151 sub->conid = conid;
152 sub->inactive = false;
153 memcpy(&sub->evt.s, s, sizeof(*s));
154 spin_lock_init(&sub->lock);
155 kref_init(&sub->kref);
156 if (!tipc_nametbl_subscribe(sub)) {
157 kfree(sub);
160 timer_setup(&sub->timer, tipc_sub_timeout, 0);
161 timeout = tipc_sub_read(&sub->evt.s, timeout);
163 mod_timer(&sub->timer, jiffies + msecs_to_jiffies(timeout));
164 return sub;
167 void tipc_sub_unsubscribe(struct tipc_subscription *sub)
169 tipc_nametbl_unsubscribe(sub);
170 if (sub->evt.s.timeout != TIPC_WAIT_FOREVER)
171 del_timer_sync(&sub->timer);
172 list_del(&sub->sub_list);
173 tipc_sub_put(sub);