Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 124002
b: refs/heads/master
c: 8e8ba85
h: refs/heads/master
v: v3
  • Loading branch information
Li Zefan authored and David S. Miller committed Dec 30, 2008
1 parent 779d9d0 commit 824a868
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 10 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 2f068bf8711c35b98bf9a0172555b8390a762fc0
refs/heads/master: 8e8ba85417366afd2361e315c6ba5949d3eff56f
23 changes: 14 additions & 9 deletions trunk/net/sched/cls_cgroup.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,16 @@ struct cgroup_cls_state
u32 classid;
};

static inline struct cgroup_cls_state *net_cls_state(struct cgroup *cgrp)
static inline struct cgroup_cls_state *cgrp_cls_state(struct cgroup *cgrp)
{
return (struct cgroup_cls_state *)
cgroup_subsys_state(cgrp, net_cls_subsys_id);
return container_of(cgroup_subsys_state(cgrp, net_cls_subsys_id),
struct cgroup_cls_state, css);
}

static inline struct cgroup_cls_state *task_cls_state(struct task_struct *p)
{
return container_of(task_subsys_state(p, net_cls_subsys_id),
struct cgroup_cls_state, css);
}

static struct cgroup_subsys_state *cgrp_create(struct cgroup_subsys *ss,
Expand All @@ -39,27 +45,27 @@ static struct cgroup_subsys_state *cgrp_create(struct cgroup_subsys *ss,
return ERR_PTR(-ENOMEM);

if (cgrp->parent)
cs->classid = net_cls_state(cgrp->parent)->classid;
cs->classid = cgrp_cls_state(cgrp->parent)->classid;

return &cs->css;
}

static void cgrp_destroy(struct cgroup_subsys *ss, struct cgroup *cgrp)
{
kfree(net_cls_state(cgrp));
kfree(cgrp_cls_state(cgrp));
}

static u64 read_classid(struct cgroup *cgrp, struct cftype *cft)
{
return net_cls_state(cgrp)->classid;
return cgrp_cls_state(cgrp)->classid;
}

static int write_classid(struct cgroup *cgrp, struct cftype *cft, u64 value)
{
if (!cgroup_lock_live_group(cgrp))
return -ENODEV;

net_cls_state(cgrp)->classid = (u32) value;
cgrp_cls_state(cgrp)->classid = (u32) value;

cgroup_unlock();

Expand Down Expand Up @@ -115,8 +121,7 @@ static int cls_cgroup_classify(struct sk_buff *skb, struct tcf_proto *tp,
return -1;

rcu_read_lock();
cs = (struct cgroup_cls_state *) task_subsys_state(current,
net_cls_subsys_id);
cs = task_cls_state(current);
if (cs->classid && tcf_em_tree_match(skb, &head->ematches, NULL)) {
res->classid = cs->classid;
res->class = 0;
Expand Down

0 comments on commit 824a868

Please sign in to comment.