mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Stanislav Kinsbursky <skinsbursky@parallels.com>
To: akpm@linux-foundation.org
Cc: serge.hallyn@canonical.com, dhowells@redhat.com, arnd@arndb.de,
	lucas.demarchi@profusion.mobi, linux-kernel@vger.kernel.org,
	criu@openvz.org, mtk.manpages@gmail.com
Subject: [PATCH 1/4] ipc: rename obfuscating MSG_STEAL flag into MSG_PEEK_ALL
Date: Mon, 09 Apr 2012 21:53:57 +0400	[thread overview]
Message-ID: <20120409175357.8358.21000.stgit@localhost6.localdomain6> (raw)
In-Reply-To: <20120409175309.8358.21631.stgit@localhost6.localdomain6>

MSG_PEEK_ALL looks familiar because MSG_PEEK for one socket message is used
already.

---
 include/linux/msg.h |    2 +-
 ipc/compat.c        |    6 +++---
 ipc/msg.c           |   10 +++++-----
 3 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/include/linux/msg.h b/include/linux/msg.h
index 5eb43a2..bd8fe66 100644
--- a/include/linux/msg.h
+++ b/include/linux/msg.h
@@ -11,7 +11,7 @@
 /* msgrcv options */
 #define MSG_NOERROR     010000  /* no error if message is too big */
 #define MSG_EXCEPT      020000  /* recv any msg except of specified type.*/
-#define MSG_STEAL       040000  /* copy (not remove) all queue messages */
+#define MSG_PEEK_ALL    040000  /* copy (not remove) all queue messages */
 
 /* Obsolete, used only for backwards compatibility and libc5 compiles */
 struct msqid_ds {
diff --git a/ipc/compat.c b/ipc/compat.c
index d2b34f8..96cb9db 100644
--- a/ipc/compat.c
+++ b/ipc/compat.c
@@ -335,7 +335,7 @@ long compat_sys_msgsnd(int first, int second, int third, void __user *uptr)
 }
 
 
-static long compat_do_msg_steal(void __user *dest, struct msg_msg *msg, size_t bufsz)
+static long compat_do_msg_peek_all(void __user *dest, struct msg_msg *msg, size_t bufsz)
 {
 	struct compat_msgbuf_a __user *msgp = dest;
 	size_t msgsz;
@@ -387,8 +387,8 @@ long compat_sys_msgrcv(int first, int second, int msgtyp, int third,
 		msgtyp = ipck.msgtyp;
 	}
 	return do_msgrcv(first, uptr, second, msgtyp, third,
-			 (third & MSG_STEAL) ? compat_do_msg_steal
-					      : compat_do_msg_fill);
+			 (third & MSG_PEEK_ALL) ? compat_do_msg_peek_all
+						: compat_do_msg_fill);
 }
 
 static inline int get_compat_msqid64(struct msqid64_ds *m64,
diff --git a/ipc/msg.c b/ipc/msg.c
index 64f83b6..017bf0b 100644
--- a/ipc/msg.c
+++ b/ipc/msg.c
@@ -762,7 +762,7 @@ static inline int convert_mode(long *msgtyp, int msgflg)
 	return SEARCH_EQUAL;
 }
 
-static long do_msg_steal(void __user *dest, struct msg_msg *msg, size_t bufsz)
+static long do_msg_peek_all(void __user *dest, struct msg_msg *msg, size_t bufsz)
 {
 	struct msgbuf_a __user *msgp = dest;
 	size_t msgsz;
@@ -845,7 +845,7 @@ long do_msgrcv(int msqid, void __user *buf, size_t bufsz, long msgtyp,
 						walk_msg->m_type != 1) {
 					msg = walk_msg;
 					msgtyp = walk_msg->m_type - 1;
-				} else if (msgflg & MSG_STEAL) {
+				} else if (msgflg & MSG_PEEK_ALL) {
 					long ret;
 
 					ret = msg_fill(buf, msg, arrsz);
@@ -863,7 +863,7 @@ long do_msgrcv(int msqid, void __user *buf, size_t bufsz, long msgtyp,
 			tmp = tmp->next;
 		}
 		if (!IS_ERR(msg)) {
-			if (msgflg & MSG_STEAL)
+			if (msgflg & MSG_PEEK_ALL)
 				goto out_unlock;
 			/*
 			 * Found a suitable message.
@@ -959,7 +959,7 @@ out_unlock:
 	if (IS_ERR(msg))
 		return PTR_ERR(msg);
 
-	if (msgflg & MSG_STEAL)
+	if (msgflg & MSG_PEEK_ALL)
 		return bufsz - arrsz;
 
 	bufsz = msg_fill(buf, msg, bufsz);
@@ -972,7 +972,7 @@ SYSCALL_DEFINE5(msgrcv, int, msqid, struct msgbuf __user *, msgp, size_t, msgsz,
 		long, msgtyp, int, msgflg)
 {
 	return do_msgrcv(msqid, msgp, msgsz, msgtyp, msgflg,
-			 (msgflg & MSG_STEAL) ? do_msg_steal : do_msg_fill);
+			 (msgflg & MSG_PEEK_ALL) ? do_msg_peek_all : do_msg_fill);
 }
 
 #ifdef CONFIG_PROC_FS


  reply	other threads:[~2012-04-09 17:54 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-09 17:53 [PATCH 0/4] IPC: message queue checkpoint/restore - requested updates Stanislav Kinsbursky
2012-04-09 17:53 ` Stanislav Kinsbursky [this message]
2012-04-09 17:54 ` [PATCH 2/4] ipc: move all checkpoint-restore code under appropriate define Stanislav Kinsbursky
2012-04-09 19:47   ` [CRIU] " Pavel Emelyanov
2012-04-10  9:05     ` Stanislav Kinsbursky
2012-04-10 13:27     ` [CRIU] [PATCH v2 " Stanislav Kinsbursky
2012-04-09 17:54 ` [PATCH 3/4] ipc: handle MSG_PEEK_ALL flag if CONFIG_CHECKPOINT_RESTORE is dropped Stanislav Kinsbursky
2012-04-09 17:54 ` [PATCH 4/4] test: IPC message queue migration test Stanislav Kinsbursky
2012-04-10 19:17   ` Andrew Morton

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=20120409175357.8358.21000.stgit@localhost6.localdomain6 \
    --to=skinsbursky@parallels.com \
    --cc=akpm@linux-foundation.org \
    --cc=arnd@arndb.de \
    --cc=criu@openvz.org \
    --cc=dhowells@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lucas.demarchi@profusion.mobi \
    --cc=mtk.manpages@gmail.com \
    --cc=serge.hallyn@canonical.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

Powered by JetHome