我可以在内核代码之外使用Linux内核链接列表吗? [英] Can I use Linux kernel linked list outside kernel code?

查看:88
本文介绍了我可以在内核代码之外使用Linux内核链接列表吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在内核代码的某些部分中使用它之前,我想使用内核链接列表.但是,如果我仅包含list.h,则由于依赖关系而无法正常工作.

I want to play with kernel linked list before I use it in some part of the kernel code. But if I just include list.h, it doesn't work due to dependencies.

如何使用single.c文件中的列表编写代码,例如test.c,以便仅通过编译test.c即可测试我的代码?希望很快能收到您的回音.

How can I write code using list in a single.c file e.g. test.c so that I can test my code just by compiling test.c? Looking forward to hearing from you soon.

此外,如何使用嵌套链表?

Also, how can I use nested linked list?

推荐答案

您可以从 http://www.mcs.anl.gov/~kazutomo/list/list.h .
它说:

You can get a userspace port from http://www.mcs.anl.gov/~kazutomo/list/list.h.
It says:

这是为用户空间程序烹饪list.h的食谱

Here is a recipe to cook list.h for user space program

  1. 从linux/include/list.h复制list.h
  2. 删除
    • #ifdef KERNE 及其#endif
    • 所有#include行
    • prefetch()和rcu相关功能
  1. copy list.h from linux/include/list.h
  2. remove
    • #ifdef KERNE and its #endif
    • all #include line
    • prefetch() and rcu related functions

这篇关于我可以在内核代码之外使用Linux内核链接列表吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆