devcgroup: make a helper to convert cgroup_subsys_state to devs_cgroup
PATCH 1/2 devcgroup: make a helper to convert cgroup_subsys_state to devs_cgroup
This is just picking the container_of out of cgroup_to_devcgroup into a separate function.
This new css_to_devcgroup will be used in the 2nd patch.
Signed-off-by Pavel Emelyanov <[email protected]>
--- security/device_cgroup.c | 8 ++++++-- 1 files changed, 6 insertions(+), 2 deletions(-)
security/device_cgroup.c +6 -2
@@ -49,10 +49,14 @@ struct dev_cgroup {spinlock_t lock; }; +static inline struct dev_cgroup *css_to_devcgroup (struct cgroup_subsys_state *s) +{ + return container_of(s, struct dev_cgroup, css); +} +static inline struct dev_cgroup *cgroup_to_devcgroup (struct cgroup *cgroup) { -return container_of (cgroup_subsys_state (cgroup, devices_subsys_id), - struct dev_cgroup, css); +return css_to_devcgroup (cgroup_subsys_state (cgroup, devices_subsys_id)); }struct cgroup_subsys devices_subsys;
Signature · 1 line
1.5.3.4
Quoted 6 lines · Pavel Emelyanov
This is just picking the
container_ofout ofcgroup_to_devcgroupinto a separate function.This new
css_to_devcgroupwill be used in the 2nd patch.Signed-off-by Pavel Emelyanov <[email protected]>
Thanks, Pavel.
Acked-by Serge Hallyn <[email protected]>
to both, obviously.
-serge
Quoted 27 lines
--- security/device_cgroup.c | 8 ++++++-- 1 files changed, 6 insertions(+), 2 deletions(-)security/device_cgroup.c +6
-2@@ -49,10 +49,14 @@ struct dev_cgroup {spinlock_t lock; }; +static inline struct dev_cgroup *css_to_devcgroup (struct cgroup_subsys_state *s) +{ + return container_of(s, struct dev_cgroup, css); +} +static inline struct dev_cgroup *cgroup_to_devcgroup (struct cgroup *cgroup) { -return container_of (cgroup_subsys_state (cgroup, devices_subsys_id), - struct dev_cgroup, css); +return css_to_devcgroup (cgroup_subsys_state (cgroup, devices_subsys_id)); }struct cgroup_subsys devices_subsys;Signature · 1 line
1.5.3.4