Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 298478
b: refs/heads/master
c: 6737856
h: refs/heads/master
v: v3
  • Loading branch information
David Ward authored and David S. Miller committed Apr 1, 2012
1 parent d53d684 commit 417b9cf
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 13 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 54f5ffbf308828b588b9d1acd9a512d433be8a09
refs/heads/master: 67378563df2e168d32a4054616f244a91aec462d
22 changes: 10 additions & 12 deletions trunk/net/802/garp.c
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,8 @@ static struct garp_attr *garp_attr_lookup(const struct garp_applicant *app,
return NULL;
}

static void garp_attr_insert(struct garp_applicant *app, struct garp_attr *new)
static struct garp_attr *garp_attr_create(struct garp_applicant *app,
const void *data, u8 len, u8 type)
{
struct rb_node *parent = NULL, **p = &app->gid.rb_node;
struct garp_attr *attr;
Expand All @@ -176,29 +177,26 @@ static void garp_attr_insert(struct garp_applicant *app, struct garp_attr *new)
while (*p) {
parent = *p;
attr = rb_entry(parent, struct garp_attr, node);
d = garp_attr_cmp(attr, new->data, new->dlen, new->type);
d = garp_attr_cmp(attr, data, len, type);
if (d < 0)
p = &parent->rb_left;
else if (d > 0)
p = &parent->rb_right;
else {
/* The attribute already exists; re-use it. */
return attr;
}
}
rb_link_node(&new->node, parent, p);
rb_insert_color(&new->node, &app->gid);
}

static struct garp_attr *garp_attr_create(struct garp_applicant *app,
const void *data, u8 len, u8 type)
{
struct garp_attr *attr;

attr = kmalloc(sizeof(*attr) + len, GFP_ATOMIC);
if (!attr)
return attr;
attr->state = GARP_APPLICANT_VO;
attr->type = type;
attr->dlen = len;
memcpy(attr->data, data, len);
garp_attr_insert(app, attr);

rb_link_node(&attr->node, parent, p);
rb_insert_color(&attr->node, &app->gid);
return attr;
}

Expand Down

0 comments on commit 417b9cf

Please sign in to comment.