Lines Matching refs:dev_cgroup
40 struct dev_cgroup { struct
46 static inline struct dev_cgroup *css_to_devcgroup(struct cgroup_subsys_state *s) in css_to_devcgroup() argument
48 return s ? container_of(s, struct dev_cgroup, css) : NULL; in css_to_devcgroup()
51 static inline struct dev_cgroup *task_devcgroup(struct task_struct *task) in task_devcgroup()
85 static int dev_exception_add(struct dev_cgroup *dev_cgroup, in dev_exception_add() argument
96 list_for_each_entry(walk, &dev_cgroup->exceptions, list) { in dev_exception_add()
110 list_add_tail_rcu(&excopy->list, &dev_cgroup->exceptions); in dev_exception_add()
117 static void dev_exception_rm(struct dev_cgroup *dev_cgroup, in dev_exception_rm() argument
124 list_for_each_entry_safe(walk, tmp, &dev_cgroup->exceptions, list) { in dev_exception_rm()
140 static void __dev_exception_clean(struct dev_cgroup *dev_cgroup) in __dev_exception_clean() argument
144 list_for_each_entry_safe(ex, tmp, &dev_cgroup->exceptions, list) { in __dev_exception_clean()
156 static void dev_exception_clean(struct dev_cgroup *dev_cgroup) in dev_exception_clean() argument
160 __dev_exception_clean(dev_cgroup); in dev_exception_clean()
163 static inline bool is_devcg_online(const struct dev_cgroup *devcg) in is_devcg_online()
176 struct dev_cgroup *dev_cgroup = css_to_devcgroup(css); in devcgroup_online() local
177 struct dev_cgroup *parent_dev_cgroup = css_to_devcgroup(css->parent); in devcgroup_online()
183 dev_cgroup->behavior = DEVCG_DEFAULT_ALLOW; in devcgroup_online()
185 ret = dev_exceptions_copy(&dev_cgroup->exceptions, in devcgroup_online()
188 dev_cgroup->behavior = parent_dev_cgroup->behavior; in devcgroup_online()
197 struct dev_cgroup *dev_cgroup = css_to_devcgroup(css); in devcgroup_offline() local
200 dev_cgroup->behavior = DEVCG_DEFAULT_NONE; in devcgroup_offline()
210 struct dev_cgroup *dev_cgroup; in devcgroup_css_alloc() local
212 dev_cgroup = kzalloc(sizeof(*dev_cgroup), GFP_KERNEL); in devcgroup_css_alloc()
213 if (!dev_cgroup) in devcgroup_css_alloc()
215 INIT_LIST_HEAD(&dev_cgroup->exceptions); in devcgroup_css_alloc()
216 dev_cgroup->behavior = DEVCG_DEFAULT_NONE; in devcgroup_css_alloc()
218 return &dev_cgroup->css; in devcgroup_css_alloc()
223 struct dev_cgroup *dev_cgroup = css_to_devcgroup(css); in devcgroup_css_free() local
225 __dev_exception_clean(dev_cgroup); in devcgroup_css_free()
226 kfree(dev_cgroup); in devcgroup_css_free()
269 struct dev_cgroup *devcgroup = css_to_devcgroup(seq_css(m)); in devcgroup_seq_show()
389 static bool verify_new_ex(struct dev_cgroup *dev_cgroup, in verify_new_ex() argument
399 if (dev_cgroup->behavior == DEVCG_DEFAULT_ALLOW) { in verify_new_ex()
412 match = match_exception_partial(&dev_cgroup->exceptions, in verify_new_ex()
429 match = match_exception(&dev_cgroup->exceptions, refex->type, in verify_new_ex()
447 static int parent_has_perm(struct dev_cgroup *childcg, in parent_has_perm()
450 struct dev_cgroup *parent = css_to_devcgroup(childcg->css.parent); in parent_has_perm()
468 static bool parent_allows_removal(struct dev_cgroup *childcg, in parent_allows_removal()
471 struct dev_cgroup *parent = css_to_devcgroup(childcg->css.parent); in parent_allows_removal()
494 static inline int may_allow_all(struct dev_cgroup *parent) in may_allow_all()
514 static void revalidate_active_exceptions(struct dev_cgroup *devcg) in revalidate_active_exceptions()
533 static int propagate_exception(struct dev_cgroup *devcg_root, in propagate_exception()
542 struct dev_cgroup *devcg = css_to_devcgroup(pos); in propagate_exception()
595 static int devcgroup_update_access(struct dev_cgroup *devcgroup, in devcgroup_update_access()
602 struct dev_cgroup *parent = css_to_devcgroup(devcgroup->css.parent); in devcgroup_update_access()
807 struct dev_cgroup *dev_cgroup; in __devcgroup_check_permission() local
811 dev_cgroup = task_devcgroup(current); in __devcgroup_check_permission()
812 if (dev_cgroup->behavior == DEVCG_DEFAULT_ALLOW) in __devcgroup_check_permission()
814 rc = !match_exception_partial(&dev_cgroup->exceptions, in __devcgroup_check_permission()
818 rc = match_exception(&dev_cgroup->exceptions, type, major, in __devcgroup_check_permission()