Reputation: 520
At what path should I include a header file that is needed to be accessed by both a linux kernel custom filesystem and a user program?
Upvotes: 0
Views: 278
Reputation: 65928
Existed filesystem drivers place their headers, which are also intended for user space, under include/uapi/linux/
. Here you may find jffs2.h
, btrfs.h
and many other filesystems-related headers.
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. Otherwise, you need to copy required headers and adjust include directories manually.
Upvotes: 2