mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Anton Vorontsov <anton.vorontsov@linaro.org>
To: "Arve Hjønnevåg" <arve@android.com>
Cc: KOSAKI Motohiro <kosaki.motohiro@gmail.com>,
	Greg Kroah-Hartman <gregkh@suse.de>, San Mehat <san@google.com>,
	Colin Cross <ccross@android.com>, Oleg Nesterov <oleg@redhat.com>,
	"Eric W. Biederman" <ebiederm@xmission.com>,
	linux-kernel@vger.kernel.org, kernel-team@android.com,
	linaro-kernel@lists.linaro.org
Subject: [PATCH 2/3] pids: Introduce for_each_tgid() macro
Date: Mon, 30 Jan 2012 05:13:36 +0400	[thread overview]
Message-ID: <20120130011336.GB30274@oksana.dev.rtsoft.ru> (raw)

Just a handy macro. This patch converts procfs user to this new
macro, plus android lowmemorykiller driver will use it as well.

Signed-off-by: Anton Vorontsov <anton.vorontsov@linaro.org>
---
 fs/proc/base.c      |    4 +---
 include/linux/pid.h |    5 +++++
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/fs/proc/base.c b/fs/proc/base.c
index 84b8625..e815d63 100644
--- a/fs/proc/base.c
+++ b/fs/proc/base.c
@@ -3367,9 +3367,7 @@ int proc_pid_readdir(struct file * filp, void * dirent, filldir_t filldir)
 	ns = filp->f_dentry->d_sb->s_fs_info;
 	iter.task = NULL;
 	iter.tgid = filp->f_pos - TGID_OFFSET;
-	for (iter = next_tgid(ns, iter);
-	     iter.task;
-	     iter.tgid += 1, iter = next_tgid(ns, iter)) {
+	for_each_tgid(ns, iter) {
 		if (has_pid_permissions(ns, iter.task, 2))
 			__filldir = filldir;
 		else
diff --git a/include/linux/pid.h b/include/linux/pid.h
index 33e350b..da87cae 100644
--- a/include/linux/pid.h
+++ b/include/linux/pid.h
@@ -206,4 +206,9 @@ struct tgid_iter {
 
 struct tgid_iter next_tgid(struct pid_namespace *ns, struct tgid_iter iter);
 
+#define for_each_tgid(ns, iter)					\
+	for (iter = next_tgid(ns, iter);			\
+	     iter.task;						\
+	     iter.tgid += 1, iter = next_tgid(ns, iter))	\
+
 #endif /* _LINUX_PID_H */
-- 
1.7.7


                 reply	other threads:[~2012-01-30  1:13 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20120130011336.GB30274@oksana.dev.rtsoft.ru \
    --to=anton.vorontsov@linaro.org \
    --cc=arve@android.com \
    --cc=ccross@android.com \
    --cc=ebiederm@xmission.com \
    --cc=gregkh@suse.de \
    --cc=kernel-team@android.com \
    --cc=kosaki.motohiro@gmail.com \
    --cc=linaro-kernel@lists.linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=oleg@redhat.com \
    --cc=san@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®