Re: [PATCH 02/18] flag parameters: socket and socketpair

Andrew Morton
2008-05-06T01:59:53Z

On Sun, 4 May 2008 23:42:46 -0400 Ulrich Drepper <drepper@redhat.com> wrote:

> +static const struct flags_rmap sock_file_flags_remap[] = {
> + { SOCK_CLOEXEC, O_CLOEXEC },
> +};
> +
> asmlinkage long sys_socket(int family, int type, int protocol)
> {
> int retval;
> struct socket *sock;
> + int fflags;
> +
> + type = flags_remap(sock_file_flags_remap,
> + ARRAY_SIZE(sock_file_flags_remap),
> + type, &fflags);

oh, so that's what it does.

afaict we only ever remap one or two flags. Would it not be more efficient
to do that inline? Something along the lines of:

type = flag_remap(type, &fflags, SOCK_whatever, O_whatever);
type = flag_remap(type, &fflags, SOCK_whatever2, O_whatever2);

?