Lines Matching refs:dev_cgroup
43 struct dev_cgroup { struct
49 static inline struct dev_cgroup *css_to_devcgroup(struct cgroup_subsys_state *s) in css_to_devcgroup() argument
51 return s ? container_of(s, struct dev_cgroup, css) : NULL; in css_to_devcgroup()
54 static inline struct dev_cgroup *task_devcgroup(struct task_struct *task) in task_devcgroup()
88 static int dev_exception_add(struct dev_cgroup *dev_cgroup, in dev_exception_add() argument
99 list_for_each_entry(walk, &dev_cgroup->exceptions, list) { in dev_exception_add()
113 list_add_tail_rcu(&excopy->list, &dev_cgroup->exceptions); in dev_exception_add()
120 static void dev_exception_rm(struct dev_cgroup *dev_cgroup, in dev_exception_rm() argument
127 list_for_each_entry_safe(walk, tmp, &dev_cgroup->exceptions, list) { in dev_exception_rm()
143 static void __dev_exception_clean(struct dev_cgroup *dev_cgroup) in __dev_exception_clean() argument
147 list_for_each_entry_safe(ex, tmp, &dev_cgroup->exceptions, list) { in __dev_exception_clean()
159 static void dev_exception_clean(struct dev_cgroup *dev_cgroup) in dev_exception_clean() argument
163 __dev_exception_clean(dev_cgroup); in dev_exception_clean()
166 static inline bool is_devcg_online(const struct dev_cgroup *devcg) in is_devcg_online()
179 struct dev_cgroup *dev_cgroup = css_to_devcgroup(css); in devcgroup_online() local
180 struct dev_cgroup *parent_dev_cgroup = css_to_devcgroup(css->parent); in devcgroup_online()
186 dev_cgroup->behavior = DEVCG_DEFAULT_ALLOW; in devcgroup_online()
188 ret = dev_exceptions_copy(&dev_cgroup->exceptions, in devcgroup_online()
191 dev_cgroup->behavior = parent_dev_cgroup->behavior; in devcgroup_online()
200 struct dev_cgroup *dev_cgroup = css_to_devcgroup(css); in devcgroup_offline() local
203 dev_cgroup->behavior = DEVCG_DEFAULT_NONE; in devcgroup_offline()
213 struct dev_cgroup *dev_cgroup; in devcgroup_css_alloc() local
215 dev_cgroup = kzalloc(sizeof(*dev_cgroup), GFP_KERNEL); in devcgroup_css_alloc()
216 if (!dev_cgroup) in devcgroup_css_alloc()
218 INIT_LIST_HEAD(&dev_cgroup->exceptions); in devcgroup_css_alloc()
219 dev_cgroup->behavior = DEVCG_DEFAULT_NONE; in devcgroup_css_alloc()
221 return &dev_cgroup->css; in devcgroup_css_alloc()
226 struct dev_cgroup *dev_cgroup = css_to_devcgroup(css); in devcgroup_css_free() local
228 __dev_exception_clean(dev_cgroup); in devcgroup_css_free()
229 kfree(dev_cgroup); in devcgroup_css_free()
272 struct dev_cgroup *devcgroup = css_to_devcgroup(seq_css(m)); in devcgroup_seq_show()
393 static bool verify_new_ex(struct dev_cgroup *dev_cgroup, in verify_new_ex() argument
403 if (dev_cgroup->behavior == DEVCG_DEFAULT_ALLOW) { in verify_new_ex()
416 match = match_exception_partial(&dev_cgroup->exceptions, in verify_new_ex()
433 match = match_exception(&dev_cgroup->exceptions, refex->type, in verify_new_ex()
451 static int parent_has_perm(struct dev_cgroup *childcg, in parent_has_perm()
454 struct dev_cgroup *parent = css_to_devcgroup(childcg->css.parent); in parent_has_perm()
472 static bool parent_allows_removal(struct dev_cgroup *childcg, in parent_allows_removal()
475 struct dev_cgroup *parent = css_to_devcgroup(childcg->css.parent); in parent_allows_removal()
498 static inline int may_allow_all(struct dev_cgroup *parent) in may_allow_all()
518 static void revalidate_active_exceptions(struct dev_cgroup *devcg) in revalidate_active_exceptions()
537 static int propagate_exception(struct dev_cgroup *devcg_root, in propagate_exception()
546 struct dev_cgroup *devcg = css_to_devcgroup(pos); in propagate_exception()
599 static int devcgroup_update_access(struct dev_cgroup *devcgroup, in devcgroup_update_access()
606 struct dev_cgroup *parent = css_to_devcgroup(devcgroup->css.parent); in devcgroup_update_access()
811 struct dev_cgroup *dev_cgroup; in devcgroup_legacy_check_permission() local
815 dev_cgroup = task_devcgroup(current); in devcgroup_legacy_check_permission()
816 if (dev_cgroup->behavior == DEVCG_DEFAULT_ALLOW) in devcgroup_legacy_check_permission()
818 rc = !match_exception_partial(&dev_cgroup->exceptions, in devcgroup_legacy_check_permission()
822 rc = match_exception(&dev_cgroup->exceptions, type, major, in devcgroup_legacy_check_permission()