• Home
  • Raw
  • Download

Lines Matching refs:attr

137 static int garp_attr_cmp(const struct garp_attr *attr,  in garp_attr_cmp()  argument
140 if (attr->type != type) in garp_attr_cmp()
141 return attr->type - type; in garp_attr_cmp()
142 if (attr->dlen != len) in garp_attr_cmp()
143 return attr->dlen - len; in garp_attr_cmp()
144 return memcmp(attr->data, data, len); in garp_attr_cmp()
151 struct garp_attr *attr; in garp_attr_lookup() local
155 attr = rb_entry(parent, struct garp_attr, node); in garp_attr_lookup()
156 d = garp_attr_cmp(attr, data, len, type); in garp_attr_lookup()
162 return attr; in garp_attr_lookup()
171 struct garp_attr *attr; in garp_attr_create() local
176 attr = rb_entry(parent, struct garp_attr, node); in garp_attr_create()
177 d = garp_attr_cmp(attr, data, len, type); in garp_attr_create()
184 return attr; in garp_attr_create()
187 attr = kmalloc(sizeof(*attr) + len, GFP_ATOMIC); in garp_attr_create()
188 if (!attr) in garp_attr_create()
189 return attr; in garp_attr_create()
190 attr->state = GARP_APPLICANT_VO; in garp_attr_create()
191 attr->type = type; in garp_attr_create()
192 attr->dlen = len; in garp_attr_create()
193 memcpy(attr->data, data, len); in garp_attr_create()
195 rb_link_node(&attr->node, parent, p); in garp_attr_create()
196 rb_insert_color(&attr->node, &app->gid); in garp_attr_create()
197 return attr; in garp_attr_create()
200 static void garp_attr_destroy(struct garp_applicant *app, struct garp_attr *attr) in garp_attr_destroy() argument
202 rb_erase(&attr->node, &app->gid); in garp_attr_destroy()
203 kfree(attr); in garp_attr_destroy()
209 struct garp_attr *attr; in garp_attr_destroy_all() local
214 attr = rb_entry(node, struct garp_attr, node); in garp_attr_destroy_all()
215 garp_attr_destroy(app, attr); in garp_attr_destroy_all()
288 const struct garp_attr *attr, in garp_pdu_append_attr() argument
301 if (garp_cb(app->pdu)->cur_type != attr->type) { in garp_pdu_append_attr()
305 if (garp_pdu_append_msg(app, attr->type) < 0) in garp_pdu_append_attr()
309 len = sizeof(*ga) + attr->dlen; in garp_pdu_append_attr()
315 memcpy(ga->data, attr->data, attr->dlen); in garp_pdu_append_attr()
324 struct garp_attr *attr, enum garp_event event) in garp_attr_event() argument
328 state = garp_applicant_state_table[attr->state][event].state; in garp_attr_event()
332 switch (garp_applicant_state_table[attr->state][event].action) { in garp_attr_event()
338 if (garp_pdu_append_attr(app, attr, GARP_JOIN_IN) < 0) in garp_attr_event()
342 garp_pdu_append_attr(app, attr, GARP_LEAVE_EMPTY); in garp_attr_event()
345 garp_attr_destroy(app, attr); in garp_attr_event()
351 attr->state = state; in garp_attr_event()
360 struct garp_attr *attr; in garp_request_join() local
363 attr = garp_attr_create(app, data, len, type); in garp_request_join()
364 if (!attr) { in garp_request_join()
368 garp_attr_event(app, attr, GARP_EVENT_REQ_JOIN); in garp_request_join()
380 struct garp_attr *attr; in garp_request_leave() local
383 attr = garp_attr_lookup(app, data, len, type); in garp_request_leave()
384 if (!attr) { in garp_request_leave()
388 garp_attr_event(app, attr, GARP_EVENT_REQ_LEAVE); in garp_request_leave()
396 struct garp_attr *attr; in garp_gid_event() local
401 attr = rb_entry(node, struct garp_attr, node); in garp_gid_event()
402 garp_attr_event(app, attr, event); in garp_gid_event()
442 struct garp_attr *attr; in garp_pdu_parse_attr() local
484 attr = garp_attr_lookup(app, ga->data, dlen, attrtype); in garp_pdu_parse_attr()
485 if (attr == NULL) in garp_pdu_parse_attr()
487 garp_attr_event(app, attr, event); in garp_pdu_parse_attr()