Re: [PATCH] kernel/sys: Fix the indent issue in switch.
Peter, Sorry for the noise, I should add this patch into my thread 'A series patchse about sched priority', as some patch depends on this patch. Otherwise, there will be a conflict. Thanx., On 03/11/2014 05:44 PM, Dongsheng Yang wrote: From: Joe Perches Fix the indent issue and add a comment line for /* fall-through */. Signed-off-by: Joe Perches Signed-off-by: Dongsheng Yang --- kernel/sys.c | 204 +-- 1 file changed, 102 insertions(+), 102 deletions(-) diff --git a/kernel/sys.c b/kernel/sys.c index adaeab6..61a2ae9 100644 --- a/kernel/sys.c +++ b/kernel/sys.c @@ -182,39 +182,39 @@ SYSCALL_DEFINE3(setpriority, int, which, int, who, int, niceval) rcu_read_lock(); read_lock(_lock); switch (which) { - case PRIO_PROCESS: - if (who) - p = find_task_by_vpid(who); - else - p = current; - if (p) - error = set_one_prio(p, niceval, error); - break; - case PRIO_PGRP: - if (who) - pgrp = find_vpid(who); - else - pgrp = task_pgrp(current); - do_each_pid_thread(pgrp, PIDTYPE_PGID, p) { + case PRIO_PROCESS: + if (who) + p = find_task_by_vpid(who); + else + p = current; + if (p) + error = set_one_prio(p, niceval, error); + break; + case PRIO_PGRP: + if (who) + pgrp = find_vpid(who); + else + pgrp = task_pgrp(current); + do_each_pid_thread(pgrp, PIDTYPE_PGID, p) { + error = set_one_prio(p, niceval, error); + } while_each_pid_thread(pgrp, PIDTYPE_PGID, p); + break; + case PRIO_USER: + uid = make_kuid(cred->user_ns, who); + user = cred->user; + if (!who) + uid = cred->uid; + else if (!uid_eq(uid, cred->uid) && +!(user = find_user(uid))) + goto out_unlock;/* No processes for this user */ + + do_each_thread(g, p) { + if (uid_eq(task_uid(p), uid)) error = set_one_prio(p, niceval, error); - } while_each_pid_thread(pgrp, PIDTYPE_PGID, p); - break; - case PRIO_USER: - uid = make_kuid(cred->user_ns, who); - user = cred->user; - if (!who) - uid = cred->uid; - else if (!uid_eq(uid, cred->uid) && -!(user = find_user(uid))) - goto out_unlock;/* No processes for this user */ - - do_each_thread(g, p) { - if (uid_eq(task_uid(p), uid)) - error = set_one_prio(p, niceval, error); - } while_each_thread(g, p); - if (!uid_eq(uid, cred->uid)) - free_uid(user); /* For find_user() */ - break; + } while_each_thread(g, p); + if (!uid_eq(uid, cred->uid)) + free_uid(user); /* For find_user() */ + break; } out_unlock: read_unlock(_lock); @@ -244,47 +244,47 @@ SYSCALL_DEFINE2(getpriority, int, which, int, who) rcu_read_lock(); read_lock(_lock); switch (which) { - case PRIO_PROCESS: - if (who) - p = find_task_by_vpid(who); - else - p = current; - if (p) { + case PRIO_PROCESS: + if (who) + p = find_task_by_vpid(who); + else + p = current; + if (p) { + niceval = 20 - task_nice(p); + if (niceval > retval) + retval = niceval; + } + break; + case PRIO_PGRP: + if (who) + pgrp = find_vpid(who); + else + pgrp = task_pgrp(current); + do_each_pid_thread(pgrp, PIDTYPE_PGID, p) { + niceval = 20 - task_nice(p); + if (niceval > retval) + retval = niceval; + } while_each_pid_thread(pgrp, PIDTYPE_PGID, p); +
[PATCH] kernel/sys: Fix the indent issue in switch.
From: Joe Perches Fix the indent issue and add a comment line for /* fall-through */. Signed-off-by: Joe Perches Signed-off-by: Dongsheng Yang --- kernel/sys.c | 204 +-- 1 file changed, 102 insertions(+), 102 deletions(-) diff --git a/kernel/sys.c b/kernel/sys.c index adaeab6..61a2ae9 100644 --- a/kernel/sys.c +++ b/kernel/sys.c @@ -182,39 +182,39 @@ SYSCALL_DEFINE3(setpriority, int, which, int, who, int, niceval) rcu_read_lock(); read_lock(_lock); switch (which) { - case PRIO_PROCESS: - if (who) - p = find_task_by_vpid(who); - else - p = current; - if (p) - error = set_one_prio(p, niceval, error); - break; - case PRIO_PGRP: - if (who) - pgrp = find_vpid(who); - else - pgrp = task_pgrp(current); - do_each_pid_thread(pgrp, PIDTYPE_PGID, p) { + case PRIO_PROCESS: + if (who) + p = find_task_by_vpid(who); + else + p = current; + if (p) + error = set_one_prio(p, niceval, error); + break; + case PRIO_PGRP: + if (who) + pgrp = find_vpid(who); + else + pgrp = task_pgrp(current); + do_each_pid_thread(pgrp, PIDTYPE_PGID, p) { + error = set_one_prio(p, niceval, error); + } while_each_pid_thread(pgrp, PIDTYPE_PGID, p); + break; + case PRIO_USER: + uid = make_kuid(cred->user_ns, who); + user = cred->user; + if (!who) + uid = cred->uid; + else if (!uid_eq(uid, cred->uid) && +!(user = find_user(uid))) + goto out_unlock;/* No processes for this user */ + + do_each_thread(g, p) { + if (uid_eq(task_uid(p), uid)) error = set_one_prio(p, niceval, error); - } while_each_pid_thread(pgrp, PIDTYPE_PGID, p); - break; - case PRIO_USER: - uid = make_kuid(cred->user_ns, who); - user = cred->user; - if (!who) - uid = cred->uid; - else if (!uid_eq(uid, cred->uid) && -!(user = find_user(uid))) - goto out_unlock;/* No processes for this user */ - - do_each_thread(g, p) { - if (uid_eq(task_uid(p), uid)) - error = set_one_prio(p, niceval, error); - } while_each_thread(g, p); - if (!uid_eq(uid, cred->uid)) - free_uid(user); /* For find_user() */ - break; + } while_each_thread(g, p); + if (!uid_eq(uid, cred->uid)) + free_uid(user); /* For find_user() */ + break; } out_unlock: read_unlock(_lock); @@ -244,47 +244,47 @@ SYSCALL_DEFINE2(getpriority, int, which, int, who) rcu_read_lock(); read_lock(_lock); switch (which) { - case PRIO_PROCESS: - if (who) - p = find_task_by_vpid(who); - else - p = current; - if (p) { + case PRIO_PROCESS: + if (who) + p = find_task_by_vpid(who); + else + p = current; + if (p) { + niceval = 20 - task_nice(p); + if (niceval > retval) + retval = niceval; + } + break; + case PRIO_PGRP: + if (who) + pgrp = find_vpid(who); + else + pgrp = task_pgrp(current); + do_each_pid_thread(pgrp, PIDTYPE_PGID, p) { + niceval = 20 - task_nice(p); + if (niceval > retval) + retval = niceval; + } while_each_pid_thread(pgrp, PIDTYPE_PGID, p); + break; + case PRIO_USER: + uid = make_kuid(cred->user_ns, who); + user = cred->user; + if (!who) + uid = cred->uid; + else if (!uid_eq(uid, cred->uid) && +
[PATCH] kernel/sys: Fix the indent issue in switch.
From: Joe Perches j...@perches.com Fix the indent issue and add a comment line for /* fall-through */. Signed-off-by: Joe Perches j...@perches.com Signed-off-by: Dongsheng Yang yangds.f...@cn.fujitsu.com --- kernel/sys.c | 204 +-- 1 file changed, 102 insertions(+), 102 deletions(-) diff --git a/kernel/sys.c b/kernel/sys.c index adaeab6..61a2ae9 100644 --- a/kernel/sys.c +++ b/kernel/sys.c @@ -182,39 +182,39 @@ SYSCALL_DEFINE3(setpriority, int, which, int, who, int, niceval) rcu_read_lock(); read_lock(tasklist_lock); switch (which) { - case PRIO_PROCESS: - if (who) - p = find_task_by_vpid(who); - else - p = current; - if (p) - error = set_one_prio(p, niceval, error); - break; - case PRIO_PGRP: - if (who) - pgrp = find_vpid(who); - else - pgrp = task_pgrp(current); - do_each_pid_thread(pgrp, PIDTYPE_PGID, p) { + case PRIO_PROCESS: + if (who) + p = find_task_by_vpid(who); + else + p = current; + if (p) + error = set_one_prio(p, niceval, error); + break; + case PRIO_PGRP: + if (who) + pgrp = find_vpid(who); + else + pgrp = task_pgrp(current); + do_each_pid_thread(pgrp, PIDTYPE_PGID, p) { + error = set_one_prio(p, niceval, error); + } while_each_pid_thread(pgrp, PIDTYPE_PGID, p); + break; + case PRIO_USER: + uid = make_kuid(cred-user_ns, who); + user = cred-user; + if (!who) + uid = cred-uid; + else if (!uid_eq(uid, cred-uid) +!(user = find_user(uid))) + goto out_unlock;/* No processes for this user */ + + do_each_thread(g, p) { + if (uid_eq(task_uid(p), uid)) error = set_one_prio(p, niceval, error); - } while_each_pid_thread(pgrp, PIDTYPE_PGID, p); - break; - case PRIO_USER: - uid = make_kuid(cred-user_ns, who); - user = cred-user; - if (!who) - uid = cred-uid; - else if (!uid_eq(uid, cred-uid) -!(user = find_user(uid))) - goto out_unlock;/* No processes for this user */ - - do_each_thread(g, p) { - if (uid_eq(task_uid(p), uid)) - error = set_one_prio(p, niceval, error); - } while_each_thread(g, p); - if (!uid_eq(uid, cred-uid)) - free_uid(user); /* For find_user() */ - break; + } while_each_thread(g, p); + if (!uid_eq(uid, cred-uid)) + free_uid(user); /* For find_user() */ + break; } out_unlock: read_unlock(tasklist_lock); @@ -244,47 +244,47 @@ SYSCALL_DEFINE2(getpriority, int, which, int, who) rcu_read_lock(); read_lock(tasklist_lock); switch (which) { - case PRIO_PROCESS: - if (who) - p = find_task_by_vpid(who); - else - p = current; - if (p) { + case PRIO_PROCESS: + if (who) + p = find_task_by_vpid(who); + else + p = current; + if (p) { + niceval = 20 - task_nice(p); + if (niceval retval) + retval = niceval; + } + break; + case PRIO_PGRP: + if (who) + pgrp = find_vpid(who); + else + pgrp = task_pgrp(current); + do_each_pid_thread(pgrp, PIDTYPE_PGID, p) { + niceval = 20 - task_nice(p); + if (niceval retval) + retval = niceval; + } while_each_pid_thread(pgrp, PIDTYPE_PGID, p); + break; + case PRIO_USER: + uid = make_kuid(cred-user_ns, who); + user = cred-user; + if (!who) + uid = cred-uid; +
Re: [PATCH] kernel/sys: Fix the indent issue in switch.
Peter, Sorry for the noise, I should add this patch into my thread 'A series patchse about sched priority', as some patch depends on this patch. Otherwise, there will be a conflict. Thanx., On 03/11/2014 05:44 PM, Dongsheng Yang wrote: From: Joe Perches j...@perches.com Fix the indent issue and add a comment line for /* fall-through */. Signed-off-by: Joe Perches j...@perches.com Signed-off-by: Dongsheng Yang yangds.f...@cn.fujitsu.com --- kernel/sys.c | 204 +-- 1 file changed, 102 insertions(+), 102 deletions(-) diff --git a/kernel/sys.c b/kernel/sys.c index adaeab6..61a2ae9 100644 --- a/kernel/sys.c +++ b/kernel/sys.c @@ -182,39 +182,39 @@ SYSCALL_DEFINE3(setpriority, int, which, int, who, int, niceval) rcu_read_lock(); read_lock(tasklist_lock); switch (which) { - case PRIO_PROCESS: - if (who) - p = find_task_by_vpid(who); - else - p = current; - if (p) - error = set_one_prio(p, niceval, error); - break; - case PRIO_PGRP: - if (who) - pgrp = find_vpid(who); - else - pgrp = task_pgrp(current); - do_each_pid_thread(pgrp, PIDTYPE_PGID, p) { + case PRIO_PROCESS: + if (who) + p = find_task_by_vpid(who); + else + p = current; + if (p) + error = set_one_prio(p, niceval, error); + break; + case PRIO_PGRP: + if (who) + pgrp = find_vpid(who); + else + pgrp = task_pgrp(current); + do_each_pid_thread(pgrp, PIDTYPE_PGID, p) { + error = set_one_prio(p, niceval, error); + } while_each_pid_thread(pgrp, PIDTYPE_PGID, p); + break; + case PRIO_USER: + uid = make_kuid(cred-user_ns, who); + user = cred-user; + if (!who) + uid = cred-uid; + else if (!uid_eq(uid, cred-uid) +!(user = find_user(uid))) + goto out_unlock;/* No processes for this user */ + + do_each_thread(g, p) { + if (uid_eq(task_uid(p), uid)) error = set_one_prio(p, niceval, error); - } while_each_pid_thread(pgrp, PIDTYPE_PGID, p); - break; - case PRIO_USER: - uid = make_kuid(cred-user_ns, who); - user = cred-user; - if (!who) - uid = cred-uid; - else if (!uid_eq(uid, cred-uid) -!(user = find_user(uid))) - goto out_unlock;/* No processes for this user */ - - do_each_thread(g, p) { - if (uid_eq(task_uid(p), uid)) - error = set_one_prio(p, niceval, error); - } while_each_thread(g, p); - if (!uid_eq(uid, cred-uid)) - free_uid(user); /* For find_user() */ - break; + } while_each_thread(g, p); + if (!uid_eq(uid, cred-uid)) + free_uid(user); /* For find_user() */ + break; } out_unlock: read_unlock(tasklist_lock); @@ -244,47 +244,47 @@ SYSCALL_DEFINE2(getpriority, int, which, int, who) rcu_read_lock(); read_lock(tasklist_lock); switch (which) { - case PRIO_PROCESS: - if (who) - p = find_task_by_vpid(who); - else - p = current; - if (p) { + case PRIO_PROCESS: + if (who) + p = find_task_by_vpid(who); + else + p = current; + if (p) { + niceval = 20 - task_nice(p); + if (niceval retval) + retval = niceval; + } + break; + case PRIO_PGRP: + if (who) + pgrp = find_vpid(who); + else + pgrp = task_pgrp(current); + do_each_pid_thread(pgrp, PIDTYPE_PGID, p) { + niceval = 20 - task_nice(p); + if (niceval retval) + retval = niceval; + }