Lines Matching refs:dev_cgroup
42 struct dev_cgroup { struct
48 static inline struct dev_cgroup *css_to_devcgroup(struct cgroup_subsys_state *s) in css_to_devcgroup() argument
50 return s ? container_of(s, struct dev_cgroup, css) : NULL; in css_to_devcgroup()
53 static inline struct dev_cgroup *task_devcgroup(struct task_struct *task) in task_devcgroup()
87 static int dev_exception_add(struct dev_cgroup *dev_cgroup, in dev_exception_add() argument
98 list_for_each_entry(walk, &dev_cgroup->exceptions, list) { in dev_exception_add()
112 list_add_tail_rcu(&excopy->list, &dev_cgroup->exceptions); in dev_exception_add()
119 static void dev_exception_rm(struct dev_cgroup *dev_cgroup, in dev_exception_rm() argument
126 list_for_each_entry_safe(walk, tmp, &dev_cgroup->exceptions, list) { in dev_exception_rm()
142 static void __dev_exception_clean(struct dev_cgroup *dev_cgroup) in __dev_exception_clean() argument
146 list_for_each_entry_safe(ex, tmp, &dev_cgroup->exceptions, list) { in __dev_exception_clean()
158 static void dev_exception_clean(struct dev_cgroup *dev_cgroup) in dev_exception_clean() argument
162 __dev_exception_clean(dev_cgroup); in dev_exception_clean()
165 static inline bool is_devcg_online(const struct dev_cgroup *devcg) in is_devcg_online()
178 struct dev_cgroup *dev_cgroup = css_to_devcgroup(css); in devcgroup_online() local
179 struct dev_cgroup *parent_dev_cgroup = css_to_devcgroup(css->parent); in devcgroup_online()
185 dev_cgroup->behavior = DEVCG_DEFAULT_ALLOW; in devcgroup_online()
187 ret = dev_exceptions_copy(&dev_cgroup->exceptions, in devcgroup_online()
190 dev_cgroup->behavior = parent_dev_cgroup->behavior; in devcgroup_online()
199 struct dev_cgroup *dev_cgroup = css_to_devcgroup(css); in devcgroup_offline() local
202 dev_cgroup->behavior = DEVCG_DEFAULT_NONE; in devcgroup_offline()
212 struct dev_cgroup *dev_cgroup; in devcgroup_css_alloc() local
214 dev_cgroup = kzalloc(sizeof(*dev_cgroup), GFP_KERNEL); in devcgroup_css_alloc()
215 if (!dev_cgroup) in devcgroup_css_alloc()
217 INIT_LIST_HEAD(&dev_cgroup->exceptions); in devcgroup_css_alloc()
218 dev_cgroup->behavior = DEVCG_DEFAULT_NONE; in devcgroup_css_alloc()
220 return &dev_cgroup->css; in devcgroup_css_alloc()
225 struct dev_cgroup *dev_cgroup = css_to_devcgroup(css); in devcgroup_css_free() local
227 __dev_exception_clean(dev_cgroup); in devcgroup_css_free()
228 kfree(dev_cgroup); in devcgroup_css_free()
271 struct dev_cgroup *devcgroup = css_to_devcgroup(seq_css(m)); in devcgroup_seq_show()
392 static bool verify_new_ex(struct dev_cgroup *dev_cgroup, in verify_new_ex() argument
402 if (dev_cgroup->behavior == DEVCG_DEFAULT_ALLOW) { in verify_new_ex()
415 match = match_exception_partial(&dev_cgroup->exceptions, in verify_new_ex()
432 match = match_exception(&dev_cgroup->exceptions, refex->type, in verify_new_ex()
450 static int parent_has_perm(struct dev_cgroup *childcg, in parent_has_perm()
453 struct dev_cgroup *parent = css_to_devcgroup(childcg->css.parent); in parent_has_perm()
471 static bool parent_allows_removal(struct dev_cgroup *childcg, in parent_allows_removal()
474 struct dev_cgroup *parent = css_to_devcgroup(childcg->css.parent); in parent_allows_removal()
497 static inline int may_allow_all(struct dev_cgroup *parent) in may_allow_all()
517 static void revalidate_active_exceptions(struct dev_cgroup *devcg) in revalidate_active_exceptions()
536 static int propagate_exception(struct dev_cgroup *devcg_root, in propagate_exception()
545 struct dev_cgroup *devcg = css_to_devcgroup(pos); in propagate_exception()
598 static int devcgroup_update_access(struct dev_cgroup *devcgroup, in devcgroup_update_access()
605 struct dev_cgroup *parent = css_to_devcgroup(devcgroup->css.parent); in devcgroup_update_access()
810 struct dev_cgroup *dev_cgroup; in devcgroup_legacy_check_permission() local
814 dev_cgroup = task_devcgroup(current); in devcgroup_legacy_check_permission()
815 if (dev_cgroup->behavior == DEVCG_DEFAULT_ALLOW) in devcgroup_legacy_check_permission()
817 rc = !match_exception_partial(&dev_cgroup->exceptions, in devcgroup_legacy_check_permission()
821 rc = match_exception(&dev_cgroup->exceptions, type, major, in devcgroup_legacy_check_permission()