summaryrefslogtreecommitdiff
path: root/include/linux/kernfs.h
diff options
context:
space:
mode:
authorShaohua Li <shli@fb.com>2017-07-12 11:49:51 -0700
committerJens Axboe <axboe@kernel.dk>2017-07-29 09:00:03 -0600
commitaa8188253474b4053bc2900d9fcb545ce68bdf5c (patch)
tree7d7afd563e9f2cd46cf8c0a0299aab42fcf764e9 /include/linux/kernfs.h
parentc53cd490b1a491ebf1d8e30da97e7231459a4208 (diff)
kernfs: add exportfs operations
Now we have the facilities to implement exportfs operations. The idea is cgroup can export the fhandle info to userspace, then userspace uses fhandle to find the cgroup name. Another example is userspace can get fhandle for a cgroup and BPF uses the fhandle to filter info for the cgroup. Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Shaohua Li <shli@fb.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'include/linux/kernfs.h')
-rw-r--r--include/linux/kernfs.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/include/linux/kernfs.h b/include/linux/kernfs.h
index 06a0c5913e1d..d149361e5875 100644
--- a/include/linux/kernfs.h
+++ b/include/linux/kernfs.h
@@ -69,6 +69,12 @@ enum kernfs_root_flag {
* following flag enables that behavior.
*/
KERNFS_ROOT_EXTRA_OPEN_PERM_CHECK = 0x0002,
+
+ /*
+ * The filesystem supports exportfs operation, so userspace can use
+ * fhandle to access nodes of the fs.
+ */
+ KERNFS_ROOT_SUPPORT_EXPORTOP = 0x0004,
};
/* type-specific structures for kernfs_node union members */
@@ -98,6 +104,12 @@ struct kernfs_elem_attr {
/* represent a kernfs node */
union kernfs_node_id {
struct {
+ /*
+ * blktrace will export this struct as a simplified 'struct
+ * fid' (which is a big data struction), so userspace can use
+ * it to find kernfs node. The layout must match the first two
+ * fields of 'struct fid' exactly.
+ */
u32 ino;
u32 generation;
};