本文整理汇总了C++中rb_first函数的典型用法代码示例。如果您正苦于以下问题:C++ rb_first函数的具体用法?C++ rb_first怎么用?C++ rb_first使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了rb_first函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: maps__delete
static void maps__delete(struct rb_root *maps)
{
struct rb_node *next = rb_first(maps);
while (next) {
struct map *pos = rb_entry(next, struct map, rb_node);
next = rb_next(&pos->rb_node);
rb_erase(&pos->rb_node, maps);
map__delete(pos);
}
}
示例2: down_read
static void *nommu_region_list_start(struct seq_file *m, loff_t *_pos)
{
struct rb_node *p;
loff_t pos = *_pos;
down_read(&nommu_region_sem);
for (p = rb_first(&nommu_region_tree); p; p = rb_next(p))
if (pos-- == 0)
return p;
return NULL;
}
示例3: dso__fprintf
size_t dso__fprintf(struct dso *self, FILE *fp)
{
size_t ret = fprintf(fp, "dso: %s\n", self->name);
struct rb_node *nd;
for (nd = rb_first(&self->syms); nd; nd = rb_next(nd)) {
struct symbol *pos = rb_entry(nd, struct symbol, rb_node);
ret += symbol__fprintf(pos, fp);
}
return ret;
}
示例4: symbols__delete
void symbols__delete(struct rb_root *symbols)
{
struct symbol *pos;
struct rb_node *next = rb_first(symbols);
while (next) {
pos = rb_entry(next, struct symbol, rb_node);
next = rb_next(&pos->rb_node);
rb_erase(&pos->rb_node, symbols);
symbol__delete(pos);
}
}
示例5: dso__delete_symbols
static void dso__delete_symbols(struct dso *self)
{
struct symbol *pos;
struct rb_node *next = rb_first(&self->syms);
while (next) {
pos = rb_entry(next, struct symbol, rb_node);
next = rb_next(&pos->rb_node);
rb_erase(&pos->rb_node, &self->syms);
symbol__delete(pos, self->sym_priv_size);
}
}
示例6: debug_print_digest_tree
void debug_print_digest_tree(struct rb_root *d_tree)
{
struct rb_node *node;
struct d_tree *d_node;
printf("Digests in digest tree:\n");
for (node = rb_first(d_tree); node; node = rb_next(node)) {
d_node = rb_entry(node, struct d_tree, t_node);
debug_print_digest(stdout, d_node->digest);
printf("\n");
}
}
示例7: mutex_lock
struct ion_handle *ion_alloc(struct ion_client *client, size_t len,
size_t align, unsigned int flags)
{
struct rb_node *n;
struct ion_handle *handle;
struct ion_device *dev = client->dev;
struct ion_buffer *buffer = NULL;
/*
* traverse the list of heaps available in this system in priority
* order. If the heap type is supported by the client, and matches the
* request of the caller allocate from it. Repeat until allocate has
* succeeded or all heaps have been tried
*/
mutex_lock(&dev->lock);
for (n = rb_first(&dev->heaps); n != NULL; n = rb_next(n)) {
struct ion_heap *heap = rb_entry(n, struct ion_heap, node);
/* if the client doesn't support this heap type */
if (!((1 << heap->type) & client->heap_mask))
continue;
/* if the caller didn't specify this heap ID */
if (!((1 << heap->id) & flags))
continue;
buffer = ion_buffer_create(heap, dev, len, align, flags);
if (!IS_ERR_OR_NULL(buffer))
break;
}
mutex_unlock(&dev->lock);
if (IS_ERR_OR_NULL(buffer))
return ERR_PTR(PTR_ERR(buffer));
handle = ion_handle_create(client, buffer);
if (IS_ERR_OR_NULL(handle))
goto end;
/*
* ion_buffer_create will create a buffer with a ref_cnt of 1,
* and ion_handle_create will take a second reference, drop one here
*/
ion_buffer_put(buffer);
mutex_lock(&client->lock);
ion_handle_add(client, handle);
mutex_unlock(&client->lock);
return handle;
end:
ion_buffer_put(buffer);
return handle;
}
示例8: rblist__delete
void rblist__delete(struct rblist *rblist)
{
if (rblist != NULL) {
struct rb_node *pos, *next = rb_first(&rblist->entries);
while (next) {
pos = next;
next = rb_next(pos);
rblist__remove_node(rblist, pos);
}
free(rblist);
}
}
示例9:
struct str_node *strlist__entry(const struct strlist *self, unsigned int idx)
{
struct rb_node *nd;
for (nd = rb_first(&self->entries); nd; nd = rb_next(nd)) {
struct str_node *pos = rb_entry(nd, struct str_node, rb_node);
if (!idx--)
return pos;
}
return NULL;
}
示例10: osmo_gsm_timers_prepare
/*
* Find the nearest FN and update s_nearest_time
*/
void osmo_gsm_timers_prepare(void)
{
struct rb_node *node;
int current_fn;
current_fn = get_current_fn();
node = rb_first(&timer_root);
if (node) {
struct osmo_gsm_timer_list *this_timer;
this_timer = container_of(node, struct osmo_gsm_timer_list, node);
update_nearest(&this_timer->fn, ¤t_fn);
} else {
示例11: kllds_remove_rbtree
static void kllds_remove_rbtree(void) {
kllds_entry *elem;
struct rb_node *next;
write_lock(&kllds_rwlck);
while ((next = rb_first(&kllds_rbtree))) {
elem = rb_entry(next, kllds_entry, rb);
rb_erase(next, &kllds_rbtree);
kfree(elem->val);
kmem_cache_free(tmp_kllds_cache, elem);
}
write_unlock(&kllds_rwlck);
}
示例12: machine__fprintf
size_t machine__fprintf(struct machine *machine, FILE *fp)
{
size_t ret = 0;
struct rb_node *nd;
for (nd = rb_first(&machine->threads); nd; nd = rb_next(nd)) {
struct thread *pos = rb_entry(nd, struct thread, rb_node);
ret += thread__fprintf(pos, fp);
}
return ret;
}
示例13: remove_all_attrs
static void remove_all_attrs(struct rb_root *root)
{
struct rb_node *node, *next_node;
struct ib_sa_attr_list *attr_list;
write_lock_irq(&rwlock);
for (node = rb_first(root); node; node = next_node) {
next_node = rb_next(node);
attr_list = rb_entry(node, struct ib_sa_attr_list, node);
remove_attr(root, attr_list);
}
write_unlock_irq(&rwlock);
}
示例14:
static struct ion_handle *ion_handle_lookup(struct ion_client *client,
struct ion_buffer *buffer)
{
struct rb_node *n;
for (n = rb_first(&client->handles); n; n = rb_next(n)) {
struct ion_handle *handle = rb_entry(n, struct ion_handle,
node);
if (handle->buffer == buffer)
return handle;
}
return NULL;
}
示例15: o2fsck_icount_free
void o2fsck_icount_free(o2fsck_icount *icount)
{
struct rb_node *node;
icount_node *in;
ocfs2_bitmap_free(icount->ic_single_bm);
while((node = rb_first(&icount->ic_multiple_tree)) != NULL) {
in = rb_entry(node, icount_node, in_node);
rb_erase(node, &icount->ic_multiple_tree);
free(in);
}
free(icount);
}