mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Nick Huang <sef1548@gmail.com>
To: linux-kernel@vger.kernel.org
Cc: kusogame68@gmail.com, Nick Huang <sef1548@gmail.com>
Subject: [PATCH] ipc/msg: Replace testmsg with  msg_matchs_type
Date: Tue,  2 Sep 2025 22:05:48 +0800	[thread overview]
Message-ID: <20250902140548.110167-1-sef1548@gmail.com> (raw)

The function name testmsg is misleading, as its purpose is not to test a message
but to check whether a message matches the given mode and type conditions.

To more clearly convey its role in validating whether a message can be used for
send or receive operations, it has been renamed to msg_matchs_type.

Signed-off-by: Nick Huang <sef1548@gmail.com>
---
 ipc/msg.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/ipc/msg.c b/ipc/msg.c
index ee6af4fe52..0831a3589c 100644
--- a/ipc/msg.c
+++ b/ipc/msg.c
@@ -791,7 +791,7 @@ COMPAT_SYSCALL_DEFINE3(old_msgctl, int, msqid, int, cmd, void __user *, uptr)
 #endif
 #endif
 
-static int testmsg(struct msg_msg *msg, long type, int mode)
+static int msg_matchs_type(struct msg_msg *msg, long type, int mode)
 {
 	switch (mode) {
 	case SEARCH_ANY:
@@ -819,7 +819,7 @@ static inline int pipelined_send(struct msg_queue *msq, struct msg_msg *msg,
 	struct msg_receiver *msr, *t;
 
 	list_for_each_entry_safe(msr, t, &msq->q_receivers, r_list) {
-		if (testmsg(msg, msr->r_msgtype, msr->r_mode) &&
+		if (msg_matchs_type(msg, msr->r_msgtype, msr->r_mode) &&
 		    !security_msg_queue_msgrcv(&msq->q_perm, msg, msr->r_tsk,
 					       msr->r_msgtype, msr->r_mode)) {
 
@@ -1077,7 +1077,7 @@ static struct msg_msg *find_msg(struct msg_queue *msq, long *msgtyp, int mode)
 	long count = 0;
 
 	list_for_each_entry(msg, &msq->q_messages, m_list) {
-		if (testmsg(msg, *msgtyp, mode) &&
+		if (msg_matchs_type(msg, *msgtyp, mode) &&
 		    !security_msg_queue_msgrcv(&msq->q_perm, msg, current,
 					       *msgtyp, mode)) {
 			if (mode == SEARCH_LESSEQUAL && msg->m_type != 1) {
-- 
2.48.1


                 reply	other threads:[~2025-09-02 14:06 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=20250902140548.110167-1-sef1548@gmail.com \
    --to=sef1548@gmail.com \
    --cc=kusogame68@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    /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®