diff options
Diffstat (limited to 'lib/libspl/include/os/linux/sys')
-rw-r--r-- | lib/libspl/include/os/linux/sys/byteorder.h | 238 | ||||
-rw-r--r-- | lib/libspl/include/os/linux/sys/errno.h | 47 | ||||
-rw-r--r-- | lib/libspl/include/os/linux/sys/ia32/asm_linkage.h | 212 | ||||
-rw-r--r-- | lib/libspl/include/os/linux/sys/mnttab.h | 90 | ||||
-rw-r--r-- | lib/libspl/include/os/linux/sys/mount.h | 99 | ||||
-rw-r--r-- | lib/libspl/include/os/linux/sys/param.h | 68 | ||||
-rw-r--r-- | lib/libspl/include/os/linux/sys/stat.h | 56 | ||||
-rw-r--r-- | lib/libspl/include/os/linux/sys/sysmacros.h | 103 | ||||
-rw-r--r-- | lib/libspl/include/os/linux/sys/zfs_context_os.h | 29 |
9 files changed, 0 insertions, 942 deletions
diff --git a/lib/libspl/include/os/linux/sys/byteorder.h b/lib/libspl/include/os/linux/sys/byteorder.h deleted file mode 100644 index 4fba62addd3b..000000000000 --- a/lib/libspl/include/os/linux/sys/byteorder.h +++ /dev/null @@ -1,238 +0,0 @@ -// SPDX-License-Identifier: CDDL-1.0 -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License (the "License"). - * You may not use this file except in compliance with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or https://opensource.org/licenses/CDDL-1.0. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ - -/* - * Copyright 2007 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -/* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */ -/* All Rights Reserved */ - -/* - * University Copyright- Copyright (c) 1982, 1986, 1988 - * The Regents of the University of California - * All Rights Reserved - * - * University Acknowledgment- Portions of this document are derived from - * software developed by the University of California, Berkeley, and its - * contributors. - */ - -#ifndef _SYS_BYTEORDER_H -#define _SYS_BYTEORDER_H - -#if defined(__GNUC__) && defined(_ASM_INLINES) && \ - (defined(__i386) || defined(__amd64)) -#include <asm/byteorder.h> -#endif - -#include <sys/isa_defs.h> -#include <inttypes.h> - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * macros for conversion between host and (internet) network byte order - */ - -#if defined(_ZFS_BIG_ENDIAN) && !defined(ntohl) && !defined(__lint) -/* big-endian */ -#define ntohl(x) (x) -#define ntohs(x) (x) -#define htonl(x) (x) -#define htons(x) (x) - -#elif !defined(ntohl) /* little-endian */ - -#ifndef _IN_PORT_T -#define _IN_PORT_T -typedef uint16_t in_port_t; -#endif - -#ifndef _IN_ADDR_T -#define _IN_ADDR_T -typedef uint32_t in_addr_t; -#endif - -#if !defined(_XPG4_2) || defined(__EXTENSIONS__) || defined(_XPG5) -extern uint32_t htonl(uint32_t); -extern uint16_t htons(uint16_t); -extern uint32_t ntohl(uint32_t); -extern uint16_t ntohs(uint16_t); -#else -extern in_addr_t htonl(in_addr_t); -extern in_port_t htons(in_port_t); -extern in_addr_t ntohl(in_addr_t); -extern in_port_t ntohs(in_port_t); -#endif /* !defined(_XPG4_2) || defined(__EXTENSIONS__) || defined(_XPG5) */ -#endif - -#if !defined(_XPG4_2) || defined(__EXTENSIONS__) - -#ifdef __COVERITY__ -/* - * Coverity's taint warnings from byteswapping are false positives for us. - * Suppress them by hiding byteswapping from Coverity. - */ -#define BSWAP_8(x) ((x) & 0xff) -#define BSWAP_16(x) ((x) & 0xffff) -#define BSWAP_32(x) ((x) & 0xffffffff) -#define BSWAP_64(x) (x) - -#else /* __COVERITY__ */ - -/* - * Macros to reverse byte order - */ -#define BSWAP_8(x) ((x) & 0xff) -#define BSWAP_16(x) ((BSWAP_8(x) << 8) | BSWAP_8((x) >> 8)) -#define BSWAP_32(x) ((BSWAP_16(x) << 16) | BSWAP_16((x) >> 16)) -#define BSWAP_64(x) ((BSWAP_32(x) << 32) | BSWAP_32((x) >> 32)) - -#endif /* __COVERITY__ */ - -#define BMASK_8(x) ((x) & 0xff) -#define BMASK_16(x) ((x) & 0xffff) -#define BMASK_32(x) ((x) & 0xffffffff) -#define BMASK_64(x) (x) - -/* - * Macros to convert from a specific byte order to/from native byte order - */ -#ifdef _ZFS_BIG_ENDIAN -#define BE_8(x) BMASK_8(x) -#define BE_16(x) BMASK_16(x) -#define BE_32(x) BMASK_32(x) -#define BE_64(x) BMASK_64(x) -#define LE_8(x) BSWAP_8(x) -#define LE_16(x) BSWAP_16(x) -#define LE_32(x) BSWAP_32(x) -#define LE_64(x) BSWAP_64(x) -#else -#define LE_8(x) BMASK_8(x) -#define LE_16(x) BMASK_16(x) -#define LE_32(x) BMASK_32(x) -#define LE_64(x) BMASK_64(x) -#define BE_8(x) BSWAP_8(x) -#define BE_16(x) BSWAP_16(x) -#define BE_32(x) BSWAP_32(x) -#define BE_64(x) BSWAP_64(x) -#endif - -#ifdef _ZFS_BIG_ENDIAN -static __inline__ uint64_t -htonll(uint64_t n) -{ - return (n); -} - -static __inline__ uint64_t -ntohll(uint64_t n) -{ - return (n); -} -#else -static __inline__ uint64_t -htonll(uint64_t n) -{ - return ((((uint64_t)htonl(n)) << 32) + htonl(n >> 32)); -} - -static __inline__ uint64_t -ntohll(uint64_t n) -{ - return ((((uint64_t)ntohl(n)) << 32) + ntohl(n >> 32)); -} -#endif - -/* - * Macros to read unaligned values from a specific byte order to - * native byte order - */ - -#define BE_IN8(xa) \ - *((uint8_t *)(xa)) - -#define BE_IN16(xa) \ - (((uint16_t)BE_IN8(xa) << 8) | BE_IN8((uint8_t *)(xa)+1)) - -#define BE_IN32(xa) \ - (((uint32_t)BE_IN16(xa) << 16) | BE_IN16((uint8_t *)(xa)+2)) - -#define BE_IN64(xa) \ - (((uint64_t)BE_IN32(xa) << 32) | BE_IN32((uint8_t *)(xa)+4)) - -#define LE_IN8(xa) \ - *((uint8_t *)(xa)) - -#define LE_IN16(xa) \ - (((uint16_t)LE_IN8((uint8_t *)(xa) + 1) << 8) | LE_IN8(xa)) - -#define LE_IN32(xa) \ - (((uint32_t)LE_IN16((uint8_t *)(xa) + 2) << 16) | LE_IN16(xa)) - -#define LE_IN64(xa) \ - (((uint64_t)LE_IN32((uint8_t *)(xa) + 4) << 32) | LE_IN32(xa)) - -/* - * Macros to write unaligned values from native byte order to a specific byte - * order. - */ - -#define BE_OUT8(xa, yv) *((uint8_t *)(xa)) = (uint8_t)(yv); - -#define BE_OUT16(xa, yv) \ - BE_OUT8((uint8_t *)(xa) + 1, yv); \ - BE_OUT8((uint8_t *)(xa), (yv) >> 8); - -#define BE_OUT32(xa, yv) \ - BE_OUT16((uint8_t *)(xa) + 2, yv); \ - BE_OUT16((uint8_t *)(xa), (yv) >> 16); - -#define BE_OUT64(xa, yv) \ - BE_OUT32((uint8_t *)(xa) + 4, yv); \ - BE_OUT32((uint8_t *)(xa), (yv) >> 32); - -#define LE_OUT8(xa, yv) *((uint8_t *)(xa)) = (uint8_t)(yv); - -#define LE_OUT16(xa, yv) \ - LE_OUT8((uint8_t *)(xa), yv); \ - LE_OUT8((uint8_t *)(xa) + 1, (yv) >> 8); - -#define LE_OUT32(xa, yv) \ - LE_OUT16((uint8_t *)(xa), yv); \ - LE_OUT16((uint8_t *)(xa) + 2, (yv) >> 16); - -#define LE_OUT64(xa, yv) \ - LE_OUT32((uint8_t *)(xa), yv); \ - LE_OUT32((uint8_t *)(xa) + 4, (yv) >> 32); - -#endif /* !defined(_XPG4_2) || defined(__EXTENSIONS__) */ - -#ifdef __cplusplus -} -#endif - -#endif /* _SYS_BYTEORDER_H */ diff --git a/lib/libspl/include/os/linux/sys/errno.h b/lib/libspl/include/os/linux/sys/errno.h deleted file mode 100644 index dd0120100a3d..000000000000 --- a/lib/libspl/include/os/linux/sys/errno.h +++ /dev/null @@ -1,47 +0,0 @@ -// SPDX-License-Identifier: CDDL-1.0 -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or https://opensource.org/licenses/CDDL-1.0. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 2017 Zettabyte Software, LLC. All rights reserved. - * Use is subject to license terms. - */ - -/* - * Compiling against musl correctly points out that including sys/errno.h is - * disallowed by the Single UNIX Specification when building in userspace, so - * we implement a dummy header to redirect the include to the proper header. - */ -#ifndef _LIBSPL_SYS_ERRNO_H -#define _LIBSPL_SYS_ERRNO_H - -#include <errno.h> -/* - * We'll take the unused errnos, 'EBADE' and 'EBADR' (from the Convergent - * graveyard) to indicate checksum errors and fragmentation. - */ -#define ECKSUM EBADE -#define EFRAGS EBADR - -/* Similar for ENOACTIVE */ -#define ENOTACTIVE ENOANO - -#endif /* _LIBSPL_SYS_ERRNO_H */ diff --git a/lib/libspl/include/os/linux/sys/ia32/asm_linkage.h b/lib/libspl/include/os/linux/sys/ia32/asm_linkage.h deleted file mode 100644 index e1d25346b13e..000000000000 --- a/lib/libspl/include/os/linux/sys/ia32/asm_linkage.h +++ /dev/null @@ -1,212 +0,0 @@ -// SPDX-License-Identifier: CDDL-1.0 -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License (the "License"). - * You may not use this file except in compliance with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or https://opensource.org/licenses/CDDL-1.0. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ - -/* - * Copyright 2008 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#ifndef _IA32_SYS_ASM_LINKAGE_H -#define _IA32_SYS_ASM_LINKAGE_H - -#if defined(_KERNEL) && defined(__linux__) -#include <linux/linkage.h> -#endif - -#ifndef ENDBR -#if defined(__ELF__) && defined(__CET__) && defined(__has_include) -/* CSTYLED */ -#if __has_include(<cet.h>) - -#include <cet.h> - -#ifdef _CET_ENDBR -#define ENDBR _CET_ENDBR -#endif /* _CET_ENDBR */ - -#endif /* <cet.h> */ -#endif /* __ELF__ && __CET__ && __has_include */ -#endif /* !ENDBR */ - -#ifndef ENDBR -#define ENDBR -#endif -#ifndef RET -#define RET ret -#endif - -/* You can set to nothing on Unix platforms */ -#undef ASMABI -#define ASMABI __attribute__((sysv_abi)) - -#define SECTION_TEXT .text -#define SECTION_STATIC .section .rodata - -#ifdef __cplusplus -extern "C" { -#endif - -#ifdef _ASM /* The remainder of this file is only for assembly files */ - -/* - * make annoying differences in assembler syntax go away - */ - -/* - * D16 and A16 are used to insert instructions prefixes; the - * macros help the assembler code be slightly more portable. - */ -#if !defined(__GNUC_AS__) -/* - * /usr/ccs/bin/as prefixes are parsed as separate instructions - */ -#define D16 data16; -#define A16 addr16; - -/* - * (There are some weird constructs in constant expressions) - */ -#define _CONST(const) [const] -#define _BITNOT(const) -1!_CONST(const) -#define _MUL(a, b) _CONST(a \* b) - -#else -/* - * Why not use the 'data16' and 'addr16' prefixes .. well, the - * assembler doesn't quite believe in real mode, and thus argues with - * us about what we're trying to do. - */ -#define D16 .byte 0x66; -#define A16 .byte 0x67; - -#define _CONST(const) (const) -#define _BITNOT(const) ~_CONST(const) -#define _MUL(a, b) _CONST(a * b) - -#endif - -/* - * C pointers are different sizes between i386 and amd64. - * These constants can be used to compute offsets into pointer arrays. - */ -#if defined(__amd64) -#define CLONGSHIFT 3 -#define CLONGSIZE 8 -#define CLONGMASK 7 -#elif defined(__i386) -#define CLONGSHIFT 2 -#define CLONGSIZE 4 -#define CLONGMASK 3 -#endif - -/* - * Since we know we're either ILP32 or LP64 .. - */ -#define CPTRSHIFT CLONGSHIFT -#define CPTRSIZE CLONGSIZE -#define CPTRMASK CLONGMASK - -#if CPTRSIZE != (1 << CPTRSHIFT) || CLONGSIZE != (1 << CLONGSHIFT) -#error "inconsistent shift constants" -#endif - -#if CPTRMASK != (CPTRSIZE - 1) || CLONGMASK != (CLONGSIZE - 1) -#error "inconsistent mask constants" -#endif - -#define ASM_ENTRY_ALIGN 16 - -/* - * SSE register alignment and save areas - */ - -#define XMM_SIZE 16 -#define XMM_ALIGN 16 - -/* - * ENTRY provides the standard procedure entry code and an easy way to - * insert the calls to mcount for profiling. ENTRY_NP is identical, but - * never calls mcount. - */ -#undef ENTRY -#define ENTRY(x) \ - .text; \ - .balign ASM_ENTRY_ALIGN; \ - .globl x; \ - .type x, @function; \ -x: MCOUNT(x) - -#define ENTRY_NP(x) \ - .text; \ - .balign ASM_ENTRY_ALIGN; \ - .globl x; \ - .type x, @function; \ -x: - -#define ENTRY_ALIGN(x, a) \ - .text; \ - .balign a; \ - .globl x; \ - .type x, @function; \ -x: - -#define FUNCTION(x) \ - .type x, @function; \ -x: - -/* - * ENTRY2 is identical to ENTRY but provides two labels for the entry point. - */ -#define ENTRY2(x, y) \ - .text; \ - .balign ASM_ENTRY_ALIGN; \ - .globl x, y; \ - .type x, @function; \ - .type y, @function; \ -x:; \ -y: MCOUNT(x) - -#define ENTRY_NP2(x, y) \ - .text; \ - .balign ASM_ENTRY_ALIGN; \ - .globl x, y; \ - .type x, @function; \ - .type y, @function; \ -x:; \ -y: - - -/* - * SET_SIZE trails a function and set the size for the ELF symbol table. - */ -#define SET_SIZE(x) \ - .size x, [.-x] - -#define SET_OBJ(x) .type x, @object - -#endif /* _ASM */ - -#ifdef __cplusplus -} -#endif - -#endif /* _IA32_SYS_ASM_LINKAGE_H */ diff --git a/lib/libspl/include/os/linux/sys/mnttab.h b/lib/libspl/include/os/linux/sys/mnttab.h deleted file mode 100644 index c1b7f3b389c0..000000000000 --- a/lib/libspl/include/os/linux/sys/mnttab.h +++ /dev/null @@ -1,90 +0,0 @@ -// SPDX-License-Identifier: CDDL-1.0 -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or https://opensource.org/licenses/CDDL-1.0. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ -/* All Rights Reserved */ -/* - * Copyright 2004 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ -/* Copyright 2006 Ricardo Correia */ - -#ifndef _SYS_MNTTAB_H -#define _SYS_MNTTAB_H - -#include <stdio.h> -#include <mntent.h> -#include <sys/stat.h> -#include <sys/types.h> - -#ifdef MNTTAB -#undef MNTTAB -#endif /* MNTTAB */ - -#define MNTTAB "/proc/self/mounts" -#define MNT_LINE_MAX 4108 - -#define MNT_TOOLONG 1 /* entry exceeds MNT_LINE_MAX */ -#define MNT_TOOMANY 2 /* too many fields in line */ -#define MNT_TOOFEW 3 /* too few fields in line */ - -struct mnttab { - char *mnt_special; - char *mnt_mountp; - char *mnt_fstype; - char *mnt_mntopts; -}; - -/* - * NOTE: fields in extmnttab should match struct mnttab till new fields - * are encountered, this allows hasmntopt to work properly when its arg is - * a pointer to an extmnttab struct cast to a mnttab struct pointer. - */ - -struct extmnttab { - char *mnt_special; - char *mnt_mountp; - char *mnt_fstype; - char *mnt_mntopts; - uint_t mnt_major; - uint_t mnt_minor; -}; - -struct statfs; - -extern int getmntany(FILE *fp, struct mnttab *mp, struct mnttab *mpref); -extern int _sol_getmntent(FILE *fp, struct mnttab *mp); -extern int getextmntent(const char *path, struct extmnttab *mp, - struct stat64 *statbuf); -static inline char *_sol_hasmntopt(struct mnttab *mnt, const char *opt) -{ - struct mntent mnt_new; - - mnt_new.mnt_opts = mnt->mnt_mntopts; - - return (hasmntopt(&mnt_new, opt)); -} - -#define hasmntopt _sol_hasmntopt -#define getmntent _sol_getmntent - -#endif diff --git a/lib/libspl/include/os/linux/sys/mount.h b/lib/libspl/include/os/linux/sys/mount.h deleted file mode 100644 index c4a291f5c22d..000000000000 --- a/lib/libspl/include/os/linux/sys/mount.h +++ /dev/null @@ -1,99 +0,0 @@ -// SPDX-License-Identifier: CDDL-1.0 -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or https://opensource.org/licenses/CDDL-1.0. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 2006 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#include_next <sys/mount.h> - -#ifndef _LIBSPL_SYS_MOUNT_H -#define _LIBSPL_SYS_MOUNT_H - -#include <assert.h> -#include <string.h> -#include <stdlib.h> - -/* - * Some old glibc headers don't define BLKGETSIZE64 - * and we don't want to require the kernel headers - */ -#if !defined(BLKGETSIZE64) -#define BLKGETSIZE64 _IOR(0x12, 114, size_t) -#endif - -/* - * Some old glibc headers don't correctly define MS_DIRSYNC and - * instead use the enum name S_WRITE. When using these older - * headers define MS_DIRSYNC to be S_WRITE. - */ -#if !defined(MS_DIRSYNC) -#define MS_DIRSYNC S_WRITE -#endif - -/* - * Some old glibc headers don't correctly define MS_POSIXACL and - * instead leave it undefined. When using these older headers define - * MS_POSIXACL to the reserved value of (1<<16). - */ -#if !defined(MS_POSIXACL) -#define MS_POSIXACL (1<<16) -#endif - -#define MS_USERS (MS_NOEXEC|MS_NOSUID|MS_NODEV) -#define MS_OWNER (MS_NOSUID|MS_NODEV) -#define MS_GROUP (MS_NOSUID|MS_NODEV) -#define MS_COMMENT 0 - -/* - * Older glibc <sys/mount.h> headers did not define all the available - * umount2(2) flags. Both MNT_FORCE and MNT_DETACH are supported in the - * kernel back to 2.4.11 so we define them correctly if they are missing. - */ -#ifdef MNT_FORCE -#define MS_FORCE MNT_FORCE -#else -#define MS_FORCE 0x00000001 -#endif /* MNT_FORCE */ - -#ifdef MNT_DETACH -#define MS_DETACH MNT_DETACH -#else -#define MS_DETACH 0x00000002 -#endif /* MNT_DETACH */ - -/* - * Overlay mount is default in Linux, but for solaris/zfs - * compatibility, MS_OVERLAY is defined to explicitly have the user - * provide a flag (-O) to mount over a non empty directory. - */ -#define MS_OVERLAY 0x00000004 - -/* - * MS_CRYPT indicates that encryption keys should be loaded if they are not - * already available. This is not defined in glibc, but it is never seen by - * the kernel so it will not cause any problems. - */ -#define MS_CRYPT 0x00000008 - -#endif /* _LIBSPL_SYS_MOUNT_H */ diff --git a/lib/libspl/include/os/linux/sys/param.h b/lib/libspl/include/os/linux/sys/param.h deleted file mode 100644 index 814f8feaf37f..000000000000 --- a/lib/libspl/include/os/linux/sys/param.h +++ /dev/null @@ -1,68 +0,0 @@ -// SPDX-License-Identifier: CDDL-1.0 -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or https://opensource.org/licenses/CDDL-1.0. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 2006 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#ifndef _LIBSPL_SYS_PARAM_H -#define _LIBSPL_SYS_PARAM_H - -#include_next <sys/param.h> -#include <unistd.h> - -/* - * File system parameters and macros. - * - * The file system is made out of blocks of at most MAXBSIZE units, - * with smaller units (fragments) only in the last direct block. - * MAXBSIZE primarily determines the size of buffers in the buffer - * pool. It may be made larger without any effect on existing - * file systems; however making it smaller may make some file - * systems unmountable. - * - * Note that the blocked devices are assumed to have DEV_BSIZE - * "sectors" and that fragments must be some multiple of this size. - */ -#define MAXBSIZE 8192 -#define DEV_BSIZE 512 -#define DEV_BSHIFT 9 /* log2(DEV_BSIZE) */ - -#define MAXNAMELEN 256 -#define MAXOFFSET_T LLONG_MAX - -#define UID_NOBODY 60001 /* user ID no body */ -#define GID_NOBODY UID_NOBODY -#define UID_NOACCESS 60002 /* user ID no access */ - -#define MAXUID UINT32_MAX /* max user id */ -#define MAXPROJID MAXUID /* max project id */ - -#ifdef PAGESIZE -#undef PAGESIZE -#endif /* PAGESIZE */ - -extern size_t spl_pagesize(void); -#define PAGESIZE (spl_pagesize()) - -#endif diff --git a/lib/libspl/include/os/linux/sys/stat.h b/lib/libspl/include/os/linux/sys/stat.h deleted file mode 100644 index 13cc0b46ac93..000000000000 --- a/lib/libspl/include/os/linux/sys/stat.h +++ /dev/null @@ -1,56 +0,0 @@ -// SPDX-License-Identifier: CDDL-1.0 -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or https://opensource.org/licenses/CDDL-1.0. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. - */ - -#ifndef _LIBSPL_SYS_STAT_H -#define _LIBSPL_SYS_STAT_H - -#include_next <sys/stat.h> - -#include <sys/mount.h> /* for BLKGETSIZE64 */ - -#ifdef HAVE_STATX -#include <fcntl.h> -#include <sys/stat.h> -#endif - -/* - * Emulate Solaris' behavior of returning the block device size in fstat64(). - */ -static inline int -fstat64_blk(int fd, struct stat64 *st) -{ - if (fstat64(fd, st) == -1) - return (-1); - - /* In Linux we need to use an ioctl to get the size of a block device */ - if (S_ISBLK(st->st_mode)) { - if (ioctl(fd, BLKGETSIZE64, &st->st_size) != 0) - return (-1); - } - - return (0); -} -#endif /* _LIBSPL_SYS_STAT_H */ diff --git a/lib/libspl/include/os/linux/sys/sysmacros.h b/lib/libspl/include/os/linux/sys/sysmacros.h deleted file mode 100644 index 66e0da6b5afe..000000000000 --- a/lib/libspl/include/os/linux/sys/sysmacros.h +++ /dev/null @@ -1,103 +0,0 @@ -// SPDX-License-Identifier: CDDL-1.0 -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or https://opensource.org/licenses/CDDL-1.0. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 2007 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#ifndef _LIBSPL_SYS_SYSMACROS_H -#define _LIBSPL_SYS_SYSMACROS_H - -#include_next <sys/sysmacros.h> - -/* common macros */ -#ifndef MIN -#define MIN(a, b) ((a) < (b) ? (a) : (b)) -#endif -#ifndef MAX -#define MAX(a, b) ((a) < (b) ? (b) : (a)) -#endif -#ifndef ABS -#define ABS(a) ((a) < 0 ? -(a) : (a)) -#endif -#ifndef ARRAY_SIZE -#define ARRAY_SIZE(a) (sizeof (a) / sizeof (a[0])) -#endif -#ifndef DIV_ROUND_UP -#define DIV_ROUND_UP(n, d) (((n) + (d) - 1) / (d)) -#endif - -#define makedevice(maj, min) makedev(maj, min) -#define _sysconf(a) sysconf(a) - -/* - * Compatibility macros/typedefs needed for Solaris -> Linux port - */ -// Deprecated. Use P2ALIGN_TYPED instead. -// #define P2ALIGN(x, align) ((x) & -(align)) -#define P2CROSS(x, y, align) (((x) ^ (y)) > (align) - 1) -#define P2ROUNDUP(x, align) ((((x) - 1) | ((align) - 1)) + 1) -#define P2BOUNDARY(off, len, align) \ - (((off) ^ ((off) + (len) - 1)) > (align) - 1) -#define P2PHASE(x, align) ((x) & ((align) - 1)) -#define P2NPHASE(x, align) (-(x) & ((align) - 1)) -#define P2NPHASE_TYPED(x, align, type) \ - (-(type)(x) & ((type)(align) - 1)) -#define ISP2(x) (((x) & ((x) - 1)) == 0) -#define IS_P2ALIGNED(v, a) ((((uintptr_t)(v)) & ((uintptr_t)(a) - 1)) == 0) - -/* - * Typed version of the P2* macros. These macros should be used to ensure - * that the result is correctly calculated based on the data type of (x), - * which is passed in as the last argument, regardless of the data - * type of the alignment. For example, if (x) is of type uint64_t, - * and we want to round it up to a page boundary using "PAGESIZE" as - * the alignment, we can do either - * P2ROUNDUP(x, (uint64_t)PAGESIZE) - * or - * P2ROUNDUP_TYPED(x, PAGESIZE, uint64_t) - */ -#define P2ALIGN_TYPED(x, align, type) \ - ((type)(x) & -(type)(align)) -#define P2PHASE_TYPED(x, align, type) \ - ((type)(x) & ((type)(align) - 1)) -#define P2NPHASE_TYPED(x, align, type) \ - (-(type)(x) & ((type)(align) - 1)) -#define P2ROUNDUP_TYPED(x, align, type) \ - ((((type)(x) - 1) | ((type)(align) - 1)) + 1) -#define P2END_TYPED(x, align, type) \ - (-(~(type)(x) & -(type)(align))) -#define P2PHASEUP_TYPED(x, align, phase, type) \ - ((type)(phase) - (((type)(phase) - (type)(x)) & -(type)(align))) -#define P2CROSS_TYPED(x, y, align, type) \ - (((type)(x) ^ (type)(y)) > (type)(align) - 1) -#define P2SAMEHIGHBIT_TYPED(x, y, type) \ - (((type)(x) ^ (type)(y)) < ((type)(x) & (type)(y))) - - -/* avoid any possibility of clashing with <stddef.h> version */ -#if defined(_KERNEL) && !defined(_KMEMUSER) && !defined(offsetof) -#define offsetof(s, m) ((size_t)(&(((s *)0)->m))) -#endif - -#endif /* _LIBSPL_SYS_SYSMACROS_H */ diff --git a/lib/libspl/include/os/linux/sys/zfs_context_os.h b/lib/libspl/include/os/linux/sys/zfs_context_os.h deleted file mode 100644 index bbfb4d17e06d..000000000000 --- a/lib/libspl/include/os/linux/sys/zfs_context_os.h +++ /dev/null @@ -1,29 +0,0 @@ -// SPDX-License-Identifier: CDDL-1.0 -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or https://opensource.org/licenses/CDDL-1.0. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ - -#ifndef ZFS_CONTEXT_OS_H -#define ZFS_CONTEXT_OS_H - -#define HAVE_LARGE_STACKS 1 - -#endif |