linux-kselftest.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Laight <David.Laight@ACULAB.COM>
To: David Laight <David.Laight@ACULAB.COM>,
	'Zhangjin Wu' <falcon@tinylab.org>, "w@1wt.eu" <w@1wt.eu>
Cc: "arnd@arndb.de" <arnd@arndb.de>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-kselftest@vger.kernel.org"
	<linux-kselftest@vger.kernel.org>,
	"linux-riscv@lists.infradead.org"
	<linux-riscv@lists.infradead.org>,
	"thomas@t-8ch.de" <thomas@t-8ch.de>
Subject: RE: [PATCH v2 4/4] tools/nolibc: sys.h: apply __syscall() helper
Date: Sat, 10 Jun 2023 16:58:54 +0000	[thread overview]
Message-ID: <6dcd7c69f95f4fed8cc3d0add1f7d6e9@AcuMS.aculab.com> (raw)
In-Reply-To: <0295105fe0744200bf2ef99e5bf7bc09@AcuMS.aculab.com>

From: David Laight
> Sent: 10 June 2023 17:34
> 
> From: Zhangjin Wu
> > Sent: 07 June 2023 06:39
> ...
> > As a summary, will use 'sysret()' and something like:
> >
> >    static __attribute__((unused))
> >    int chdir(const char *path)
> >    {
> >    	return sysret(chdir(path));
> >    }
> >
> > to renew the syscall helper patchset, Thanks you very much.
> 
> While I'm all for using 'cpp-magic' to abstract and (hopefully)
> simplify things. Token-pasting the sys_ here doesn't seem to gain
> anything.
> Anyone grepping the code for 'sys_chdir' is also going to
> wonder where it is used.

I think I've spotted a later version of the patch
that doesn't paste the sys_

> There might be scope for something like:
> #define syscall_wrapper(func, type) \
> 	static __attribute__((unused)) \
> 	int func(type *arg) \
> 	{ \
> 		return sysret(sys_#func(arg)); \
> 	}
> and then:
> syscall_wrapper(chdir, const char *)
> would expand to the code above.
> 
> I think you'd need separate defines for each number of arguments.

It is also worth pointing out that once the 'static unused'
functions have been defined, all the #define 'goop' used to
define them can be summarily #undef'ed.
That (mostly) solves the namespace problem.

	David

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)

      reply	other threads:[~2023-06-10 16:59 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-06  8:08 [PATCH v2 0/4] tools/nolibc: add two new syscall helpers Zhangjin Wu
2023-06-06  8:09 ` [PATCH v2 1/4] tools/nolibc: sys.h: add __syscall() and __sysret() helpers Zhangjin Wu
2023-06-06 10:33   ` Zhangjin Wu
2023-06-08 14:35   ` David Laight
2023-06-08 16:06     ` Thomas Weißschuh
2023-06-09  4:42       ` Zhangjin Wu
2023-06-09  9:15         ` David Laight
2023-06-06  8:11 ` [PATCH v2 2/4] tools/nolibc: unistd.h: apply __sysret() helper Zhangjin Wu
2023-06-06  8:16 ` [PATCH v2 3/4] tools/nolibc: sys.h: " Zhangjin Wu
2023-06-06  8:17 ` [PATCH v2 4/4] tools/nolibc: sys.h: apply __syscall() helper Zhangjin Wu
2023-06-06 18:36   ` Thomas Weißschuh
2023-06-07  0:34     ` Zhangjin Wu
2023-06-07  4:05       ` Willy Tarreau
2023-06-07  5:39         ` Zhangjin Wu
2023-06-07  6:05           ` Thomas Weißschuh
2023-06-07  6:38             ` Zhangjin Wu
2023-06-10 16:34           ` David Laight
2023-06-10 16:58             ` David Laight [this message]

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=6dcd7c69f95f4fed8cc3d0add1f7d6e9@AcuMS.aculab.com \
    --to=david.laight@aculab.com \
    --cc=arnd@arndb.de \
    --cc=falcon@tinylab.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=linux-riscv@lists.infradead.org \
    --cc=thomas@t-8ch.de \
    --cc=w@1wt.eu \
    /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;
as well as URLs for NNTP newsgroup(s).