Lines Matching defs:sub

42 static void tipc_sub_send_event(struct tipc_subscription *sub,
46 struct tipc_subscr *s = &sub->evt.s;
47 struct tipc_event *evt = &sub->evt;
49 if (sub->inactive)
63 tipc_topsrv_queue_evt(sub->net, sub->conid, event, evt);
86 void tipc_sub_report_overlap(struct tipc_subscription *sub,
90 struct tipc_service_range *sr = &sub->s.seq;
91 u32 filter = sub->s.filter;
101 spin_lock(&sub->lock);
102 tipc_sub_send_event(sub, p, event);
103 spin_unlock(&sub->lock);
108 struct tipc_subscription *sub = from_timer(sub, t, timer);
110 spin_lock(&sub->lock);
111 tipc_sub_send_event(sub, NULL, TIPC_SUBSCR_TIMEOUT);
112 sub->inactive = true;
113 spin_unlock(&sub->lock);
138 struct tipc_subscription *sub;
146 sub = kmalloc(sizeof(*sub), GFP_ATOMIC);
147 if (!sub) {
151 INIT_LIST_HEAD(&sub->service_list);
152 INIT_LIST_HEAD(&sub->sub_list);
153 sub->net = net;
154 sub->conid = conid;
155 sub->inactive = false;
156 memcpy(&sub->evt.s, s, sizeof(*s));
157 sub->s.seq.type = tipc_sub_read(s, seq.type);
158 sub->s.seq.lower = lower;
159 sub->s.seq.upper = upper;
160 sub->s.filter = filter;
161 sub->s.timeout = tipc_sub_read(s, timeout);
162 memcpy(sub->s.usr_handle, s->usr_handle, 8);
163 spin_lock_init(&sub->lock);
164 kref_init(&sub->kref);
165 if (!tipc_nametbl_subscribe(sub)) {
166 kfree(sub);
169 timer_setup(&sub->timer, tipc_sub_timeout, 0);
170 timeout = tipc_sub_read(&sub->evt.s, timeout);
172 mod_timer(&sub->timer, jiffies + msecs_to_jiffies(timeout));
173 return sub;
176 void tipc_sub_unsubscribe(struct tipc_subscription *sub)
178 tipc_nametbl_unsubscribe(sub);
179 if (sub->evt.s.timeout != TIPC_WAIT_FOREVER)
180 del_timer_sync(&sub->timer);
181 list_del(&sub->sub_list);
182 tipc_sub_put(sub);