[英]How to create shared header file for kernel filesystem and user program?
我应该在哪条路径中包含Linux内核自定义文件系统和用户程序都需要访问的头文件?
Existed filesystem drivers place their headers, which are also intended for user space, under include/uapi/linux/
. 现有的文件系统驱动程序将其标头(也用于用户空间)放在include/uapi/linux/
。 Here you may find jffs2.h
, btrfs.h
and many other filesystems-related headers. 在这里,您可以找到jffs2.h
, btrfs.h
和许多其他与文件系统相关的标头。
These headers are intended to be included with 这些标头旨在与
#include <linux/xxx.h>
This automatically works for the kernel. 这将自动适用于内核。
For user this would work too, after you install "uapi" headers with make headers_install
, rebuild C library ( libc
) against new headers, and rebuild gcc against new C library. 对于用户来说,在使用make headers_install
安装“ uapi”头文件,针对新头文件重建C库( libc
)和针对新C库重建gcc之后,这也将起作用。 Otherwise, you need to copy required headers and adjust include directories manually. 否则,您需要复制所需的标题并手动调整包含目录。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.