Re: [PATCH] net: add sock_open() for unified socket creation
From: Al Viro
Date: Fri Jun 19 2026 - 12:36:17 EST
On Fri, Jun 19, 2026 at 01:35:56PM +0300, Alex Goltsev wrote:
> > What's the point (and why not make it inline, while we are at it)?
>
> > Are there really callers that would pass a non-constant value as the last argument,
> > and if so, what are they doing next?
>
>
> As for `inline`: in this case, it would have no practical significance.
>
> The compiler already treats a simple inline function as a regular
>
> symbol within the `EXPORT_SYMBOL` context, whereas a static inline
> function (the standard
>
> kernel template for helper functions) would completely break the
> export to the LKM.
How so? All three underlying primitives are exported, so static inline
in whatever include/*/*.h you put it in would work just fine.
> As for the last argument, yes, today it is usually a constant,
>
> but that’s not the point. The purpose of the enumeration is to provide
>
> a unified, explicit control interface. It’s important that if, in the future,
>
> someone adds a new type of socket creation, existing calling programs won’t
>
> panic or throw a compilation error, but will smoothly fall back to
>
> the default case and return -EINVAL, which is a safe failure mode.
Collapsing several functions together is worthless unless the combination
can be _used_ other than a (questionable) syntax sugar. kmalloc() can;
something that would only result in trading multiple identifiers for
functions for multiple identifiers for "which function to call" is not
an improvement.