All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Namhyung Kim <namhyung@gmail.com>
Cc: Sam Ravnborg <sam@ravnborg.org>, Arnd Bergmann <arnd@arndb.de>,
	Phillip Lougher <phillip@lougher.demon.co.uk>,
	Al Viro <viro@zeniv.linux.org.uk>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v4 1/2] init: add sys-wrapper.h
Date: Fri, 17 Sep 2010 14:40:24 -0700	[thread overview]
Message-ID: <20100917144024.33e66e53.akpm@linux-foundation.org> (raw)
In-Reply-To: <1283268619-10728-2-git-send-email-namhyung@gmail.com>

On Wed,  1 Sep 2010 00:30:18 +0900
Namhyung Kim <namhyung@gmail.com> wrote:

> sys-wrapper.h contains wrapper functions for various syscalls used in init
> code. This wrappers handle proper address space conversion so that it can
> remove a lot of warnings from sparse.

This all looks pretty neat.

> +#define kernel_sys_call(call, ...)		\
> +({						\
> +	long result;				\
> +	mm_segment_t old_fs = get_fs();		\
> +	set_fs(KERNEL_DS);			\
> +	result = call(__VA_ARGS__);		\
> +	set_fs(old_fs);				\
> +	result;					\
> +})

I was worried that some syscalls don't need the set_fs(), and that this
would add overhead.  But I see that the patch addresses that.

> -	int err = sys_mount(name, "/root", fs, flags, data);
> +	int err = kernel_sys_mount(name, "/root", fs, flags, data);

It would be good if we could arrange for _all_ kernel syscalls to use
the wrappers.  ie: cause a direct call to sys_mount() to not compile?

I don't know how practical that would be.

  reply	other threads:[~2010-09-17 21:40 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-31 15:30 [PATCH v4 0/2] init cleanups Namhyung Kim
2010-08-31 15:30 ` [PATCH v4 1/2] init: add sys-wrapper.h Namhyung Kim
2010-09-17 21:40   ` Andrew Morton [this message]
2010-09-18  9:27     ` Arnd Bergmann
2010-09-18  9:50       ` Andrew Morton
2010-08-31 15:30 ` [PATCH v4 2/2] init: use kern_sys_* wrappers instead of syscall Namhyung Kim
2010-09-02  3:26   ` [PATCH v4 2/2] init: use kernel_sys_* " Namhyung Kim

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=20100917144024.33e66e53.akpm@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=arnd@arndb.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=namhyung@gmail.com \
    --cc=phillip@lougher.demon.co.uk \
    --cc=sam@ravnborg.org \
    --cc=viro@zeniv.linux.org.uk \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.