Re: [PATCH v4 1/2] init: add sys-wrapper.h

From: Andrew Morton
Date: Fri Sep 17 2010 - 17:41:07 EST


On Wed, 1 Sep 2010 00:30:18 +0900
Namhyung Kim <namhyung@xxxxxxxxx> 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.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/