user-util,storagectl: introduce USERNS_RANGE_SIZE macro

The mount.storage helper open-codes the conventional 64K UID/GID
delegation block size as 0x10000 / 0x10000U in four places. Several
other places in the tree do the same (nspawn's arg_uid_range default,
homed's mount setup, …), but with no shared name.

Add USERNS_RANGE_SIZE in user-util.h alongside UID_NOBODY and friends,
and switch storagectl over to it. Other call sites can adopt it
incrementally.

Signed-off-by: Christian Brauner (Amutable) <brauner@kernel.org>
This commit is contained in:
Christian Brauner
2026-05-06 10:30:13 +02:00
parent 9d2df9daf6
commit eaa0073027
3 changed files with 12 additions and 7 deletions
+2 -1
View File
@@ -2,9 +2,10 @@
#pragma once
#include "shared-forward.h"
#include "user-util.h"
/* Helpful constants for the only numbers of UIDs that can currently be allocated */
#define NSRESOURCE_UIDS_64K 0x10000U
#define NSRESOURCE_UIDS_64K USERNS_RANGE_SIZE
#define NSRESOURCE_UIDS_1 1U
int nsresource_connect(sd_varlink **ret);