mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Gleb Fotengauer-Malinovskiy <glebfm@altlinux.org>
To: Arnd Bergmann <arnd@arndb.de>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Souptick Joarder <jrdr.linux@gmail.com>,
	Al Viro <viro@zeniv.linux.org.uk>
Cc: Gleb Fotengauer-Malinovskiy <glebfm@altlinux.org>,
	linux-kernel@vger.kernel.org, Vitaly Chikunov <vt@altlinux.org>
Subject: [PATCH] vmci_host: print unexpanded names of ioctl requests in debug messages
Date: Tue,  2 Mar 2021 18:33:46 +0300	[thread overview]
Message-ID: <20210302153346.300416-1-glebfm@altlinux.org> (raw)

__stringify macro function expands its arguments, but in this messages
we expect to see ioctl request name instead of it's _IOC macro
expansion.

$ cat stringify.c

#include <stdio.h>
#include <asm/ioctl.h>

#define __stringify_1(x)	#x
#define __stringify(x)		__stringify_1(x)

#define VMCI_DO_IOCTL(ioctl_name) \
    char *name = __stringify(IOCTL_VMCI_ ## ioctl_name);

int main() {
        VMCI_DO_IOCTL(INIT_CONTEXT)
        printf("%s\n", name);
}
$ cc stringify.c
$ ./a.out
(((0U) << (((0+8)+8)+14)) | (((7)) << (0+8)) | (((0xa0)) << 0) | ((0) << ((0+8)+8)))

Signed-off-by: Gleb Fotengauer-Malinovskiy <glebfm@altlinux.org>
---
 drivers/misc/vmw_vmci/vmci_host.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/misc/vmw_vmci/vmci_host.c b/drivers/misc/vmw_vmci/vmci_host.c
index 2d8328d928d5..da1e2a773823 100644
--- a/drivers/misc/vmw_vmci/vmci_host.c
+++ b/drivers/misc/vmw_vmci/vmci_host.c
@@ -908,7 +908,7 @@ static long vmci_host_unlocked_ioctl(struct file *filp,
 				     unsigned int iocmd, unsigned long ioarg)
 {
 #define VMCI_DO_IOCTL(ioctl_name, ioctl_fn) do {			\
-		char *name = __stringify(IOCTL_VMCI_ ## ioctl_name);	\
+		char *name = "IOCTL_VMCI_" # ioctl_name;		\
 		return vmci_host_do_ ## ioctl_fn(			\
 			vmci_host_dev, name, uptr);			\
 	} while (0)
-- 
glebfm

                 reply	other threads:[~2021-03-02 19:47 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=20210302153346.300416-1-glebfm@altlinux.org \
    --to=glebfm@altlinux.org \
    --cc=arnd@arndb.de \
    --cc=gregkh@linuxfoundation.org \
    --cc=jrdr.linux@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=viro@zeniv.linux.org.uk \
    --cc=vt@altlinux.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®