Lines Matching refs:dev_cgroup
48 struct dev_cgroup { struct
54 static inline struct dev_cgroup *css_to_devcgroup(struct cgroup_subsys_state *s) in css_to_devcgroup() argument
56 return s ? container_of(s, struct dev_cgroup, css) : NULL; in css_to_devcgroup()
59 static inline struct dev_cgroup *task_devcgroup(struct task_struct *task) in task_devcgroup()
93 static int dev_exception_add(struct dev_cgroup *dev_cgroup, in dev_exception_add() argument
104 list_for_each_entry(walk, &dev_cgroup->exceptions, list) { in dev_exception_add()
118 list_add_tail_rcu(&excopy->list, &dev_cgroup->exceptions); in dev_exception_add()
125 static void dev_exception_rm(struct dev_cgroup *dev_cgroup, in dev_exception_rm() argument
132 list_for_each_entry_safe(walk, tmp, &dev_cgroup->exceptions, list) { in dev_exception_rm()
148 static void __dev_exception_clean(struct dev_cgroup *dev_cgroup) in __dev_exception_clean() argument
152 list_for_each_entry_safe(ex, tmp, &dev_cgroup->exceptions, list) { in __dev_exception_clean()
164 static void dev_exception_clean(struct dev_cgroup *dev_cgroup) in dev_exception_clean() argument
168 __dev_exception_clean(dev_cgroup); in dev_exception_clean()
171 static inline bool is_devcg_online(const struct dev_cgroup *devcg) in is_devcg_online()
184 struct dev_cgroup *dev_cgroup = css_to_devcgroup(css); in devcgroup_online() local
185 struct dev_cgroup *parent_dev_cgroup = css_to_devcgroup(css->parent); in devcgroup_online()
191 dev_cgroup->behavior = DEVCG_DEFAULT_ALLOW; in devcgroup_online()
193 ret = dev_exceptions_copy(&dev_cgroup->exceptions, in devcgroup_online()
196 dev_cgroup->behavior = parent_dev_cgroup->behavior; in devcgroup_online()
205 struct dev_cgroup *dev_cgroup = css_to_devcgroup(css); in devcgroup_offline() local
208 dev_cgroup->behavior = DEVCG_DEFAULT_NONE; in devcgroup_offline()
218 struct dev_cgroup *dev_cgroup; in devcgroup_css_alloc() local
220 dev_cgroup = kzalloc(sizeof(*dev_cgroup), GFP_KERNEL); in devcgroup_css_alloc()
221 if (!dev_cgroup) in devcgroup_css_alloc()
223 INIT_LIST_HEAD(&dev_cgroup->exceptions); in devcgroup_css_alloc()
224 dev_cgroup->behavior = DEVCG_DEFAULT_NONE; in devcgroup_css_alloc()
226 return &dev_cgroup->css; in devcgroup_css_alloc()
231 struct dev_cgroup *dev_cgroup = css_to_devcgroup(css); in devcgroup_css_free() local
233 __dev_exception_clean(dev_cgroup); in devcgroup_css_free()
234 kfree(dev_cgroup); in devcgroup_css_free()
277 struct dev_cgroup *devcgroup = css_to_devcgroup(seq_css(m)); in devcgroup_seq_show()
397 static bool verify_new_ex(struct dev_cgroup *dev_cgroup, in verify_new_ex() argument
407 if (dev_cgroup->behavior == DEVCG_DEFAULT_ALLOW) { in verify_new_ex()
420 match = match_exception_partial(&dev_cgroup->exceptions, in verify_new_ex()
437 match = match_exception(&dev_cgroup->exceptions, refex->type, in verify_new_ex()
455 static int parent_has_perm(struct dev_cgroup *childcg, in parent_has_perm()
458 struct dev_cgroup *parent = css_to_devcgroup(childcg->css.parent); in parent_has_perm()
476 static bool parent_allows_removal(struct dev_cgroup *childcg, in parent_allows_removal()
479 struct dev_cgroup *parent = css_to_devcgroup(childcg->css.parent); in parent_allows_removal()
502 static inline int may_allow_all(struct dev_cgroup *parent) in may_allow_all()
522 static void revalidate_active_exceptions(struct dev_cgroup *devcg) in revalidate_active_exceptions()
541 static int propagate_exception(struct dev_cgroup *devcg_root, in propagate_exception()
550 struct dev_cgroup *devcg = css_to_devcgroup(pos); in propagate_exception()
603 static int devcgroup_update_access(struct dev_cgroup *devcgroup, in devcgroup_update_access()
610 struct dev_cgroup *parent = css_to_devcgroup(devcgroup->css.parent); in devcgroup_update_access()
815 struct dev_cgroup *dev_cgroup; in __devcgroup_check_permission() local
819 dev_cgroup = task_devcgroup(current); in __devcgroup_check_permission()
820 if (dev_cgroup->behavior == DEVCG_DEFAULT_ALLOW) in __devcgroup_check_permission()
822 rc = !match_exception_partial(&dev_cgroup->exceptions, in __devcgroup_check_permission()
826 rc = match_exception(&dev_cgroup->exceptions, type, major, in __devcgroup_check_permission()