• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ rb_first函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中rb_first函数的典型用法代码示例。如果您正苦于以下问题:C++ rb_first函数的具体用法?C++ rb_first怎么用?C++ rb_first使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了rb_first函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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);
	}
}
开发者ID:3null,项目名称:linux,代码行数:12,代码来源:map.c


示例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;
}
开发者ID:shinsec,项目名称:linux-parrot,代码行数:12,代码来源:nommu.c


示例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;
}
开发者ID:KHATEEBNSIT,项目名称:lsdk_ar9531,代码行数:12,代码来源:symbol.c


示例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);
	}
}
开发者ID:383530895,项目名称:linux,代码行数:12,代码来源:symbol.c


示例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);
	}
}
开发者ID:KHATEEBNSIT,项目名称:lsdk_ar9531,代码行数:12,代码来源:symbol.c


示例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");
	}
}
开发者ID:CyberShadow,项目名称:duperemove,代码行数:12,代码来源:d_tree.c


示例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;
}
开发者ID:Ntemis,项目名称:Bexus-N,代码行数:52,代码来源:ion.c


示例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);
	}
}
开发者ID:020gzh,项目名称:linux,代码行数:13,代码来源:rblist.c


示例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;
}
开发者ID:YaFilthy,项目名称:android_kernel_lge_voltdos,代码行数:13,代码来源:strlist.c


示例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, &current_fn);
	} else {
开发者ID:telenoobie,项目名称:osmo-pcu,代码行数:16,代码来源:gsm_timer.cpp


示例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);
}
开发者ID:HackLinux,项目名称:llds,代码行数:13,代码来源:llds.c


示例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;
}
开发者ID:33d,项目名称:linux-2.6.21-hh20,代码行数:13,代码来源:thread.c


示例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);
}
开发者ID:edgar-pek,项目名称:PerspicuOS,代码行数:13,代码来源:local_sa.c


示例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;
}
开发者ID:mcrosson,项目名称:samsung_kernel_comanche,代码行数:13,代码来源:ion.c


示例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);
}
开发者ID:abligh,项目名称:ocfs2-tools,代码行数:13,代码来源:icount.c


示例16: rb_next

rb_node__t* rb_next(const rb_node__t *node){
   if (node == NULL){
      return NULL;
   }
   rb_node__t* parent = node->parent;
   if(node->right != NULL)
      return rb_first(node->right);
   while(parent != NULL && parent->right == node){
      node = parent;
      parent = node->parent;
   }
   return parent;
}
开发者ID:PhamNuwen,项目名称:my-playground,代码行数:13,代码来源:rb_tree.c


示例17: map_first

/**
 * Get first node in the map.
 */
static struct tree_node* map_first(const struct map *tmap)
{
    struct rb_node *node;

    if (!tmap) {
        return NULL;
    }
    node = rb_first(&tmap->root);
    if (!node) {
        return NULL;
    }
    return container_of(node, struct tree_node, node);
}
开发者ID:walb-linux,项目名称:walb-driver,代码行数:16,代码来源:treemap.c


示例18: perf_event__synthesize_modules

int perf_event__synthesize_modules(perf_event__handler_t process,
                                   struct perf_session *session,
                                   struct machine *machine)
{
    struct rb_node *nd;
    struct map_groups *kmaps = &machine->kmaps;
    union perf_event *event = zalloc((sizeof(event->mmap) +
                                          session->id_hdr_size));
    if (event == NULL) {
        pr_debug("Not enough memory synthesizing mmap event "
                 "for kernel modules\n");
        return -1;
    }

    event->header.type = PERF_RECORD_MMAP;

    /*
     * kernel uses 0 for user space maps, see kernel/perf_event.c
     * __perf_event_mmap
     */
    if (machine__is_host(machine))
        event->header.misc = PERF_RECORD_MISC_KERNEL;
    else
        event->header.misc = PERF_RECORD_MISC_GUEST_KERNEL;

    for (nd = rb_first(&kmaps->maps[MAP__FUNCTION]);
            nd; nd = rb_next(nd)) {
        size_t size;
        struct map *pos = rb_entry(nd, struct map, rb_node);

        if (pos->dso->kernel)
            continue;

        size = ALIGN(pos->dso->long_name_len + 1, sizeof(u64));
        event->mmap.header.type = PERF_RECORD_MMAP;
        event->mmap.header.size = (sizeof(event->mmap) -
                                   (sizeof(event->mmap.filename) - size));
        memset(event->mmap.filename + size, 0, session->id_hdr_size);
        event->mmap.header.size += session->id_hdr_size;
        event->mmap.start = pos->start;
        event->mmap.len   = pos->end - pos->start;
        event->mmap.pid   = machine->pid;

        memcpy(event->mmap.filename, pos->dso->long_name,
               pos->dso->long_name_len + 1);
        process(event, &synth_sample, session);
    }

    free(event);
    return 0;
}
开发者ID:AbheekG,项目名称:XIA-for-Linux,代码行数:51,代码来源:event.c


示例19: ion_debug_find_buffer_owner

static int ion_debug_find_buffer_owner(const struct ion_client *client,
				       const struct ion_buffer *buf)
{
	struct rb_node *n;

	for (n = rb_first(&client->handles); n; n = rb_next(n)) {
		const struct ion_handle *handle = rb_entry(n,
						     const struct ion_handle,
						     node);
		if (handle->buffer == buf)
			return 1;
	}
	return 0;
}
开发者ID:fulmix,项目名称:fulmix.Kernel,代码行数:14,代码来源:ion.c


示例20: cgwb_bdi_exit

static void cgwb_bdi_exit(struct backing_dev_info *bdi)
{
	struct rb_node *rbn;

	spin_lock_irq(&cgwb_lock);
	while ((rbn = rb_first(&bdi->cgwb_congested_tree))) {
		struct bdi_writeback_congested *congested =
			rb_entry(rbn, struct bdi_writeback_congested, rb_node);

		rb_erase(rbn, &bdi->cgwb_congested_tree);
		congested->__bdi = NULL;	/* mark @congested unlinked */
	}
	spin_unlock_irq(&cgwb_lock);
}
开发者ID:SantoshShilimkar,项目名称:linux,代码行数:14,代码来源:backing-dev.c



注:本文中的rb_first函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ rb_float_new函数代码示例发布时间:2022-05-30
下一篇:
C++ rb_exc_raise函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap