@@ -779,68 +779,72 @@ static inline struct cgroup *cgroup_from_id(struct cgroup_subsys *ss, int id)
779
779
return idr_find (& ss -> root -> cgroup_idr , id );
780
780
}
781
781
782
- struct cgroup * cgroup_next_child (struct cgroup * pos , struct cgroup * cgrp );
782
+ struct cgroup_subsys_state * css_next_child (struct cgroup_subsys_state * pos ,
783
+ struct cgroup_subsys_state * parent );
783
784
784
785
/**
785
- * cgroup_for_each_child - iterate through children of a cgroup
786
- * @pos: the cgroup * to use as the loop cursor
787
- * @cgrp: cgroup whose children to walk
786
+ * css_for_each_child - iterate through children of a css
787
+ * @pos: the css * to use as the loop cursor
788
+ * @parent: css whose children to walk
788
789
*
789
- * Walk @cgrp 's children. Must be called under rcu_read_lock(). A child
790
- * cgroup which hasn't finished ->css_online() or already has finished
790
+ * Walk @parent 's children. Must be called under rcu_read_lock(). A child
791
+ * css which hasn't finished ->css_online() or already has finished
791
792
* ->css_offline() may show up during traversal and it's each subsystem's
792
793
* responsibility to verify that each @pos is alive.
793
794
*
794
795
* If a subsystem synchronizes against the parent in its ->css_online() and
795
- * before starting iterating, a cgroup which finished ->css_online() is
796
+ * before starting iterating, a css which finished ->css_online() is
796
797
* guaranteed to be visible in the future iterations.
797
798
*
798
799
* It is allowed to temporarily drop RCU read lock during iteration. The
799
800
* caller is responsible for ensuring that @pos remains accessible until
800
801
* the start of the next iteration by, for example, bumping the css refcnt.
801
802
*/
802
- #define cgroup_for_each_child (pos , cgrp ) \
803
- for ((pos) = cgroup_next_child (NULL, (cgrp )); (pos); \
804
- (pos) = cgroup_next_child ((pos), (cgrp )))
803
+ #define css_for_each_child (pos , parent ) \
804
+ for ((pos) = css_next_child (NULL, (parent )); (pos); \
805
+ (pos) = css_next_child ((pos), (parent )))
805
806
806
- struct cgroup * cgroup_next_descendant_pre (struct cgroup * pos ,
807
- struct cgroup * cgroup );
808
- struct cgroup * cgroup_rightmost_descendant (struct cgroup * pos );
807
+ struct cgroup_subsys_state *
808
+ css_next_descendant_pre (struct cgroup_subsys_state * pos ,
809
+ struct cgroup_subsys_state * css );
810
+
811
+ struct cgroup_subsys_state *
812
+ css_rightmost_descendant (struct cgroup_subsys_state * pos );
809
813
810
814
/**
811
- * cgroup_for_each_descendant_pre - pre-order walk of a cgroup 's descendants
812
- * @pos: the cgroup * to use as the loop cursor
813
- * @cgroup: cgroup whose descendants to walk
815
+ * css_for_each_descendant_pre - pre-order walk of a css 's descendants
816
+ * @pos: the css * to use as the loop cursor
817
+ * @root: css whose descendants to walk
814
818
*
815
- * Walk @cgroup 's descendants. Must be called under rcu_read_lock(). A
816
- * descendant cgroup which hasn't finished ->css_online() or already has
819
+ * Walk @root 's descendants. Must be called under rcu_read_lock(). A
820
+ * descendant css which hasn't finished ->css_online() or already has
817
821
* finished ->css_offline() may show up during traversal and it's each
818
822
* subsystem's responsibility to verify that each @pos is alive.
819
823
*
820
824
* If a subsystem synchronizes against the parent in its ->css_online() and
821
825
* before starting iterating, and synchronizes against @pos on each
822
- * iteration, any descendant cgroup which finished ->css_online() is
826
+ * iteration, any descendant css which finished ->css_online() is
823
827
* guaranteed to be visible in the future iterations.
824
828
*
825
829
* In other words, the following guarantees that a descendant can't escape
826
830
* state updates of its ancestors.
827
831
*
828
- * my_online(@cgrp )
832
+ * my_online(@css )
829
833
* {
830
- * Lock @cgrp-> parent and @cgrp ;
831
- * Inherit state from @cgrp-> parent;
834
+ * Lock @css's parent and @css ;
835
+ * Inherit state from the parent;
832
836
* Unlock both.
833
837
* }
834
838
*
835
- * my_update_state(@cgrp )
839
+ * my_update_state(@css )
836
840
* {
837
- * Lock @cgrp ;
838
- * Update @cgrp 's state;
839
- * Unlock @cgrp ;
841
+ * Lock @css ;
842
+ * Update @css 's state;
843
+ * Unlock @css ;
840
844
*
841
- * cgroup_for_each_descendant_pre (@pos, @cgrp ) {
845
+ * css_for_each_descendant_pre (@pos, @css ) {
842
846
* Lock @pos;
843
- * Verify @pos is alive and inherit state from @pos-> parent;
847
+ * Verify @pos is alive and inherit state from @pos's parent;
844
848
* Unlock @pos;
845
849
* }
846
850
* }
@@ -851,8 +855,7 @@ struct cgroup *cgroup_rightmost_descendant(struct cgroup *pos);
851
855
* visible by walking order and, as long as inheriting operations to the
852
856
* same @pos are atomic to each other, multiple updates racing each other
853
857
* still result in the correct state. It's guaranateed that at least one
854
- * inheritance happens for any cgroup after the latest update to its
855
- * parent.
858
+ * inheritance happens for any css after the latest update to its parent.
856
859
*
857
860
* If checking parent's state requires locking the parent, each inheriting
858
861
* iteration should lock and unlock both @pos->parent and @pos.
@@ -865,25 +868,26 @@ struct cgroup *cgroup_rightmost_descendant(struct cgroup *pos);
865
868
* caller is responsible for ensuring that @pos remains accessible until
866
869
* the start of the next iteration by, for example, bumping the css refcnt.
867
870
*/
868
- #define cgroup_for_each_descendant_pre (pos , cgroup ) \
869
- for (pos = cgroup_next_descendant_pre (NULL, (cgroup )); (pos); \
870
- pos = cgroup_next_descendant_pre ((pos), (cgroup )))
871
+ #define css_for_each_descendant_pre (pos , css ) \
872
+ for (( pos) = css_next_descendant_pre (NULL, (css )); (pos); \
873
+ ( pos) = css_next_descendant_pre ((pos), (css )))
871
874
872
- struct cgroup * cgroup_next_descendant_post (struct cgroup * pos ,
873
- struct cgroup * cgroup );
875
+ struct cgroup_subsys_state *
876
+ css_next_descendant_post (struct cgroup_subsys_state * pos ,
877
+ struct cgroup_subsys_state * css );
874
878
875
879
/**
876
- * cgroup_for_each_descendant_post - post-order walk of a cgroup 's descendants
877
- * @pos: the cgroup * to use as the loop cursor
878
- * @cgroup: cgroup whose descendants to walk
880
+ * css_for_each_descendant_post - post-order walk of a css 's descendants
881
+ * @pos: the css * to use as the loop cursor
882
+ * @css: css whose descendants to walk
879
883
*
880
- * Similar to cgroup_for_each_descendant_pre () but performs post-order
884
+ * Similar to css_for_each_descendant_pre () but performs post-order
881
885
* traversal instead. Note that the walk visibility guarantee described in
882
886
* pre-order walk doesn't apply the same to post-order walks.
883
887
*/
884
- #define cgroup_for_each_descendant_post (pos , cgroup ) \
885
- for (pos = cgroup_next_descendant_post (NULL, (cgroup )); (pos); \
886
- pos = cgroup_next_descendant_post ((pos), (cgroup )))
888
+ #define css_for_each_descendant_post (pos , css ) \
889
+ for (( pos) = css_next_descendant_post (NULL, (css )); (pos); \
890
+ ( pos) = css_next_descendant_post ((pos), (css )))
887
891
888
892
/* A cgroup_iter should be treated as an opaque object */
889
893
struct cgroup_iter {
0 commit comments