Re: [PATCH] SYS: refactor sethostname setdomainname by introducing shared helper
From: Laurijssen
Date: Sat Nov 21 2026 - 06:38:10 EST
On Friday, November 20th, 2026 at 10:42 AM, Christian Brauner <brauner@xxxxxxxxxx> wrote:
> On Thu, Nov 12, 2026 at 09:11:32AM +0100, Laurijssen wrote:
> > into a new helper, utsname_set_field. The existing implementation
> > duplicated validation, size checks, and uts namespace update steps that
> > are also needed by upcoming changes in related syscalls.
>
> What upcoming changes? If there are any, send this together with them.
This is just a cleanup where the two system calls had the same code with only new_utsname.nodename and new_utsname.domainname and enum uts_proc as difference. In case another system call is introduced that sets other new_utsname fields it's only a oneliner to do that now
>
> > The helper centralizes:
> > - updates to utsname()->nodename/domainname with proper locking
> > - propagation rules for shared uts namespaces.
>
> There are no propagation rules for uts namespaces. The helper does
> exactly what the two syscalls do today.
>
> > handling. The patch reduces code duplication, improves maintainability
> > and prepares for future extensions to utsname management.
>
> It adds a line and a switch with a WARN_ON_ONCE() for a case that can't
> happen. Seems like churn.
>
Nothing fancy indeed, just a cleanup of duplicated code.