Lines Matching refs:sub

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