Changeset View
Changeset View
Standalone View
Standalone View
sys/ofed/drivers/infiniband/core/ib_uverbs_cmd.c
Show First 20 Lines • Show All 678 Lines • ▼ Show 20 Lines | static int xrcd_table_insert(struct ib_uverbs_device *dev, | ||||
entry = kmalloc(sizeof *entry, GFP_KERNEL); | entry = kmalloc(sizeof *entry, GFP_KERNEL); | ||||
if (!entry) | if (!entry) | ||||
return -ENOMEM; | return -ENOMEM; | ||||
entry->xrcd = xrcd; | entry->xrcd = xrcd; | ||||
entry->inode = inode; | entry->inode = inode; | ||||
while (*p) { | while (rb_ptr(*p)) { | ||||
parent = *p; | parent = rb_ptr(*p); | ||||
scan = rb_entry(parent, struct xrcd_table_entry, node); | scan = rb_entry(parent, struct xrcd_table_entry, node); | ||||
if (inode < scan->inode) { | if (inode < scan->inode) { | ||||
p = &(*p)->rb_left; | p = &(*p)->rb_left; | ||||
} else if (inode > scan->inode) { | } else if (inode > scan->inode) { | ||||
p = &(*p)->rb_right; | p = &(*p)->rb_right; | ||||
} else { | } else { | ||||
kfree(entry); | kfree(entry); | ||||
Show All 12 Lines | |||||
{ | { | ||||
struct xrcd_table_entry *entry; | struct xrcd_table_entry *entry; | ||||
struct rb_node *p = dev->xrcd_tree.rb_node; | struct rb_node *p = dev->xrcd_tree.rb_node; | ||||
while (p) { | while (p) { | ||||
entry = rb_entry(p, struct xrcd_table_entry, node); | entry = rb_entry(p, struct xrcd_table_entry, node); | ||||
if (inode < entry->inode) | if (inode < entry->inode) | ||||
p = p->rb_left; | p = rb_ptr(p->rb_left); | ||||
else if (inode > entry->inode) | else if (inode > entry->inode) | ||||
p = p->rb_right; | p = rb_ptr(p->rb_right); | ||||
else | else | ||||
return entry; | return entry; | ||||
} | } | ||||
return NULL; | return NULL; | ||||
} | } | ||||
static struct ib_xrcd *find_xrcd(struct ib_uverbs_device *dev, struct inode *inode) | static struct ib_xrcd *find_xrcd(struct ib_uverbs_device *dev, struct inode *inode) | ||||
▲ Show 20 Lines • Show All 3,579 Lines • Show Last 20 Lines |