mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-22 02:27:36 +03:00
Linux 6.18: namespace type moved to ns_common
The namespace type has moved from the namespace ops struct to the "common" base namespace struct. Detect this and define a macro that does the right thing for both versions. Sponsored-by: https://despairlabs.com/sponsor/ Signed-off-by: Rob Norris <robn@despairlabs.com>
This commit is contained in:
@@ -25,6 +25,10 @@
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 2025, Rob Norris <robn@despairlabs.com>
|
||||
*/
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/sysmacros.h>
|
||||
#include <sys/kmem.h>
|
||||
@@ -56,6 +60,19 @@ typedef struct zone_dataset {
|
||||
} zone_dataset_t;
|
||||
|
||||
#ifdef CONFIG_USER_NS
|
||||
|
||||
/*
|
||||
* Linux 6.18 moved the generic namespace type away from ns->ops->type onto
|
||||
* ns_common itself.
|
||||
*/
|
||||
#ifdef HAVE_NS_COMMON_TYPE
|
||||
#define ns_is_newuser(ns) \
|
||||
((ns)->ns_type == CLONE_NEWUSER)
|
||||
#else
|
||||
#define ns_is_newuser(ns) \
|
||||
((ns)->ops != NULL && (ns)->ops->type == CLONE_NEWUSER)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Returns:
|
||||
* - 0 on success
|
||||
@@ -84,7 +101,7 @@ user_ns_get(int fd, struct user_namespace **userns)
|
||||
goto done;
|
||||
}
|
||||
ns = get_proc_ns(file_inode(nsfile));
|
||||
if (ns->ops->type != CLONE_NEWUSER) {
|
||||
if (!ns_is_newuser(ns)) {
|
||||
error = ENOTTY;
|
||||
goto done;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user