1 // SPDX-License-Identifier: GPL-2.0-or-later 2 /* 3 * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. 4 * Copyright (C) 2007 The Regents of the University of California. 5 * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). 6 * Written by Brian Behlendorf <behlendorf1@llnl.gov>. 7 * UCRL-CODE-235197 8 * 9 * This file is part of the SPL, Solaris Porting Layer. 10 * 11 * The SPL is free software; you can redistribute it and/or modify it 12 * under the terms of the GNU General Public License as published by the 13 * Free Software Foundation; either version 2 of the License, or (at your 14 * option) any later version. 15 * 16 * The SPL is distributed in the hope that it will be useful, but WITHOUT 17 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 18 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 19 * for more details. 20 * 21 * You should have received a copy of the GNU General Public License along 22 * with the SPL. If not, see <http://www.gnu.org/licenses/>. 23 */ 24 25 #ifndef _SPL_TYPES_H 26 #define _SPL_TYPES_H 27 28 #include <linux/types.h> 29 30 typedef enum { 31 B_FALSE = 0, 32 B_TRUE = 1 33 } boolean_t; 34 35 typedef unsigned char uchar_t; 36 typedef unsigned short ushort_t; 37 typedef unsigned int uint_t; 38 typedef unsigned long ulong_t; 39 typedef unsigned long long u_longlong_t; 40 typedef long long longlong_t; 41 42 #ifndef HAVE_KERNEL_INTPTR_T 43 typedef long intptr_t; 44 #endif 45 typedef unsigned long long rlim64_t; 46 47 typedef struct task_struct kthread_t; 48 typedef struct task_struct proc_t; 49 50 typedef int id_t; 51 typedef short pri_t; 52 typedef short index_t; 53 typedef longlong_t offset_t; 54 typedef u_longlong_t u_offset_t; 55 typedef ulong_t pgcnt_t; 56 57 typedef int major_t; 58 typedef int minor_t; 59 60 struct user_namespace; 61 #ifdef HAVE_IOPS_CREATE_IDMAP 62 #include <linux/refcount.h> 63 #ifdef HAVE_IDMAP_NO_USERNS 64 #include <linux/user_namespace.h> 65 struct mnt_idmap { 66 struct uid_gid_map uid_map; 67 struct uid_gid_map gid_map; 68 refcount_t count; 69 }; 70 typedef struct mnt_idmap zidmap_t; 71 #define idmap_owner(p) (NULL) 72 #else 73 struct mnt_idmap { 74 struct user_namespace *owner; 75 refcount_t count; 76 }; 77 typedef struct mnt_idmap zidmap_t; 78 #define idmap_owner(p) (((struct mnt_idmap *)p)->owner) 79 #endif 80 #else 81 typedef struct user_namespace zidmap_t; 82 #define idmap_owner(p) ((struct user_namespace *)p) 83 #endif 84 85 extern zidmap_t *zfs_init_idmap; 86 87 #ifdef HAVE_1ARG_ASSIGN_STR 88 #define __assign_str_impl(a, b) __assign_str(a) 89 #else 90 #define __assign_str_impl(a, b) __assign_str(a, b) 91 #endif 92 93 #endif /* _SPL_TYPES_H */ 94