Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1666048
| From | Shaohua Li <shli@kernel.org> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH V2 07/12] cgroup: export fhandle info for a cgroup |
| Date | 2017-06-14 18:20 +0200 |
| Message-ID | <tSjbt-7qT-47@gated-at.bofh.it> (permalink) |
| References | <tSjbr-7qT-3@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
From: Shaohua Li <shli@fb.com>
Add an API to export cgroup fhandle info. We don't export a full 'struct
file_handle', there are unrequired info. Sepcifically, cgroup is always
a directory, so we don't need a 'FILEID_KERNFS_WITH_PARENT' type
fhandle, we only need export the inode number and generation number.
Since the first part of 'kernfs_fid' and 'kernfs_node_id' have the same
layout, we can just export a 'kernfs_node_id'.
Signed-off-by: Shaohua Li <shli@fb.com>
---
include/linux/cgroup.h | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/include/linux/cgroup.h b/include/linux/cgroup.h
index 30c6877..5ebe89f 100644
--- a/include/linux/cgroup.h
+++ b/include/linux/cgroup.h
@@ -609,6 +609,10 @@ static inline void cgroup_kthread_ready(void)
current->no_cgroup_migration = 0;
}
+static inline struct kernfs_node_id *cgroup_get_node_id(struct cgroup *cgrp)
+{
+ return &cgrp->kn->id;
+}
#else /* !CONFIG_CGROUPS */
struct cgroup_subsys_state;
@@ -631,6 +635,10 @@ static inline int cgroup_init_early(void) { return 0; }
static inline int cgroup_init(void) { return 0; }
static inline void cgroup_init_kthreadd(void) {}
static inline void cgroup_kthread_ready(void) {}
+static inline struct kernfs_node_id *cgroup_get_node_id(struct cgroup *cgrp)
+{
+ return NULL;
+}
static inline bool task_under_cgroup_hierarchy(struct task_struct *task,
struct cgroup *ancestor)
--
2.9.3
Back to linux.kernel | Previous | Next — Previous in thread | Find similar | Unroll thread
[PATCH V2 00/12]blktrace: output cgroup info Shaohua Li <shli@kernel.org> - 2017-06-14 18:20 +0200 [PATCH V2 06/12] kernfs: add exportfs operations Shaohua Li <shli@kernel.org> - 2017-06-14 18:20 +0200 [PATCH V2 05/12] kernfs: introduce kernfs_node_id Shaohua Li <shli@kernel.org> - 2017-06-14 18:20 +0200 [PATCH V2 02/12] kernfs: use idr instead of ida to manage inode number Shaohua Li <shli@kernel.org> - 2017-06-14 18:20 +0200 [PATCH V2 01/12] kernfs: implement i_generation Shaohua Li <shli@kernel.org> - 2017-06-14 18:20 +0200 [PATCH V2 08/12] blktrace: export cgroup info in trace Shaohua Li <shli@kernel.org> - 2017-06-14 18:20 +0200 [PATCH V2 03/12] kernfs: add an API to get kernfs node from inode number Shaohua Li <shli@kernel.org> - 2017-06-14 18:20 +0200 [PATCH V2 04/12] kernfs: don't set dentry->d_fsdata Shaohua Li <shli@kernel.org> - 2017-06-14 18:20 +0200 [PATCH V2 07/12] cgroup: export fhandle info for a cgroup Shaohua Li <shli@kernel.org> - 2017-06-14 18:20 +0200
csiph-web